rust-osdev / bootimage

Tool to create bootable disk images from a Rust OS kernel.
Apache License 2.0
764 stars 67 forks source link

Getting some weird bugs after trying to update bootimage #10

Closed steveklabnik closed 6 years ago

steveklabnik commented 6 years ago

So, I'm working on updating intermezzos to the new version of bootimage, however I'm getting some failures on CI and locally that are strange. The only change I've made is to add the build subcommand to `bootimage.

Here's the CI failure: https://travis-ci.org/intermezzOS/kernel/jobs/370152249#L521

error: current package believes it's in a workspace when it's not:
current:   /home/travis/build/intermezzOS/kernel/target/intermezzos/debug/bootloader/Cargo.toml
workspace: /home/travis/build/intermezzOS/kernel/Cargo.toml
this may be fixable by ensuring that this crate is depended on by the workspace root: /home/travis/build/intermezzOS/kernel/Cargo.toml
thread 'main' panicked at 'Bootloader download failed.', src/build.rs:250:5

and locally:

> bootimage build --target=intermezzos
Building kernel
   Compiling rlibc v1.0.0
   Compiling vga v0.1.0 (file:///C:/Users/steve/src/intermezzos/kernel/vga)
error[E0463]: can't find crate for `compiler_builtins`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: Could not compile `rlibc`.
warning: build failed, waiting for other jobs to finish...
error[E0463]: can't find crate for `compiler_builtins`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: Could not compile `vga`.

To learn more, run the command again with --verbose.

Any ideas on what's going on here? I'm using bootimage 0.2.6 and rustc 1.27.0-nightly (ac3c2288f 2018-04-18).

phil-opp commented 6 years ago

Thanks for reporting!

I think I have a pretty good idea what's going on: Bootimage creates a dummy project in the target folder to download the bootloader through cargo's dependency fetch process. By living inside target, this dummy crate is in a subfolder of the project root. Thus cargo thinks that it should belong to the workspace and errors because it doesn't. (I found that cargo behavior strange since workspaces were introduced, because it also breaks things like git worktree, but that's a different story.)

Your local build throws a different error because it already fails to compile the kernel, so no bootloader is downloaded. The error looks like it's caused by the recent automatic injection of compiler_builtins. More specific, I think you might have an old xargo version that doesn't include https://github.com/japaric/xargo/pull/213.

About the bootimage problem: I think we could create the dummy project in /tmp instead of the target subfolder. I will look into it.

phil-opp commented 6 years ago

Should be fixed in https://github.com/rust-osdev/bootimage/commit/df6c73c44bb102eeb8b7f4f4d4583895400165a7. Published as version 0.2.7. I also verified that intermezzos builds again.

steveklabnik commented 6 years ago

Thank you! As always, you're the best <3