Error when compiling using bootimage
I have installed the nightly build, xbuild, and bootimage and checked that the versions all seem correct. Everything works up to the point of creating an image, the project even builds with cargo xbuild --target...but when I run bootimage build --target ... I get this error, here is the backtrace:
wwestlake@kali:~/Projects/rust/os-dev$ RUST_BACKTRACE=1 bootimage build --target x86_64-hacker-os.json
thread 'main' panicked at 'Could not read crate name from cargo metadata', src/libcore/option.rs:1038:5
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
1: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:70
2: std::panicking::default_hook::{{closure}}
at src/libstd/sys_common/backtrace.rs:58
at src/libstd/panicking.rs:200
3: std::panicking::default_hook
at src/libstd/panicking.rs:215
4: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:478
5: std::panicking::continue_panic_fmt
at src/libstd/panicking.rs:385
6: rust_begin_unwind
at src/libstd/panicking.rs:312
7: core::panicking::panic_fmt
at src/libcore/panicking.rs:85
8: core::option::expect_failed
at src/libcore/option.rs:1038
9: bootimage::build::build_impl
10: bootimage::build::build
11: bootimage::main
12: std::rt::lang_start::{{closure}}
13: std::panicking::try::do_call
at src/libstd/rt.rs:49
at src/libstd/panicking.rs:297
14: __rust_maybe_catch_panic
at src/libpanic_unwind/lib.rs:92
15: std::rt::lang_start_internal
at src/libstd/panicking.rs:276
at src/libstd/panic.rs:388
at src/libstd/rt.rs:48
16: main
17: __libc_start_main
18: _start
Thank you for the code example, it was really helpful!
The problem was that bootimage defaulted to the workspace root if no --manifest-path was passed. I published a new version (0.6.0) that defaults to the current directory instead.
Thanks :) I updated bootimage and it works now from the actual OS project, I assume that's the only place you would want to run bootimage in, other crates in the workspace would be built with cargo xbuild from the workspace root?
On Sun, Jan 20, 2019 at 1:21 PM Philipp Oppermann [email protected] wrote:
Thank you for the code example, it was really helpful!
The problem was that bootimage defaulted to the workspace root if no --manifest-path was passed. I published a new version (0.6.0) that defaults to the current directory instead.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rust-osdev/bootimage/issues/28#issuecomment-455889793, or mute the thread https://github.com/notifications/unsubscribe-auth/ADBc_zkjJMeafeQj5C-qUhGht1su5VzCks5vFLOjgaJpZM4aI34u .
-- Bill Westlake (586) 405-4533 [email protected] Server: minecraft.lagdaemon.com:25765 (Whitelisted, contact me first)
Perfect, thanks for testing! There is still a bug with bootimage test on Windows, but it should be fixed tomorrow.
I'm not sure if I understand your question correctly. If the other crates are dependencies of your OS, cargo should build them automatically with your OS. If you want to invoke bootimage from the workspace root, you can still do this: bootimage (and also cargo xbuild and cargo build) support a --manifest-path argument to specify which project to build. To build your OS crate from the workspace root, run bootimage build --manifest-path hacker-os/Cargo.toml.
Perfect, you understood my question perfectly :) thanks, I am a newbie to rust but have been a developer for 40+ years. I will help contribute to these things more once I get a better handle on rust. Thanks for this great book on OS design. I have done some work on the Linux kernel back in the '90s when it was still very backwater! But that was long ago and I didn't do anything all that significant. Rust is an amazing language, I look forward to continuing with your book on OS design.
Thanks,
Bill
On Sun, Jan 20, 2019 at 4:46 PM Philipp Oppermann [email protected] wrote:
Perfect, thanks for testing! There is still a bug with bootimage test on Windows, but it should be fixed tomorrow.
I'm not sure if I understand your question correctly. If the other crates are dependencies of your OS, cargo should build them automatically with your OS. If you want to invoke bootimage from the workspace root, you can still do this: bootimage (and also cargo xbuild and cargo build) support a --manifest-path argument to specify which project to build. To build your OS crate from the workspace root, run bootimage build --manifest-path hacker-os/Cargo.toml.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rust-osdev/bootimage/issues/28#issuecomment-455905370, or mute the thread https://github.com/notifications/unsubscribe-auth/ADBc_89asg2L5h0XJ671s0atkiLKzgFnks5vFOOVgaJpZM4aI34u .
-- Bill Westlake (586) 405-4533 [email protected] Server: minecraft.lagdaemon.com:25765 (Whitelisted, contact me first)
Wow, that's a lot of experience! Let me know if something in the book is unclear. Thanks again for the bug report!