rust-osdev/bootimage

Can't install bootimage

sytzemeijer opened this issue · 10 comments

I cannot install boot image. I am using the nightly-2020-07-15. When I run cargo install bootimage it stops with three dependencies with about 2000 errors.

I won't be able to access my laptop until tomorrow, so I'll forward the errors then.

It's difficult to guess without the actual errors, but the problem might be that you're running the cargo install command from a folder that contains a .cargo/config.toml file with build-std settings. If that's the case, try running it again from a parent directory or from your home directory.

If I run cargo install bootimage on C: I get this error

C:\>cargo install bootimage
warning: unused config key `unstable.build-std-features` in `C:\Users\Sytze Meijer\.cargo\config.toml`
    Updating crates.io index
  Installing bootimage v0.10.3
   Compiling compiler_builtins v0.1.32
   Compiling core v0.0.0 (C:\Users\Sytze Meijer\.rustup\toolchains\nightly-2020-07-15-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libcore)
   Compiling proc-macro2 v1.0.47
   Compiling unicode-ident v1.0.5
   Compiling quote v1.0.21
   Compiling syn v1.0.103
   Compiling serde v1.0.147
   Compiling serde_json v1.0.89
   Compiling serde_derive v1.0.147
   Compiling thiserror v1.0.37
   Compiling anyhow v1.0.66
error[E0635]: unknown feature `proc_macro_span_shrink`
  --> C:\Users\Sytze Meijer\.cargo\registry\src\github.com-1ecc6299db9ec823\proc-macro2-1.0.47\src\lib.rs:92:30
   |
92 |     feature(proc_macro_span, proc_macro_span_shrink)
   |                              ^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0635`.
error: could not compile `proc-macro2`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
    Building [========================>                                ] 20/44: core

Two things:

  • You probably don't want to set any unstable features in the .cargo/config.toml in your user directory since these settings will then be used for all your Rust projects. Instead, create a local .cargo/config.toml file in your project directory. For details, see https://doc.rust-lang.org/cargo/reference/config.html#hierarchical-structure.
  • It looks like you're using a nightly from 2020, which is way to old. Try running rustup update.

It now installs but the bin file has no extension and when I run it in qemu nothing happens.

Which bin file are you talking about?

I'm following your tutorial on how to create a operating system in rust. edition-2, A Minimal Rust Kernel

Does the cargo bootimage command work? If so, what error occurs when you're trying to start the bootimage-blog_os.bin in QEMU?

thanks it's now working

but are you going to continue writing the tutorial?

Great to hear that it's working now!

but are you going to continue writing the tutorial?

I'm planning to create a new third edition, which will do some things a bit differently (bootimage is no longer needed, support for UEFI booting, APIC instead of PIC, etc.).