blog_os: Project doesn't build after upgrade to rust 1.47.0-nightly

Hi,

I am reading Allocator design : LinkedList Allocator until now I have been building the project with rustc 1.44.0-nightly (b543afca9 2020-04-05). I was used to launch test withcargo xtest and run the OS with cargo xrun.

After a rustup upgrade the rust compiler version was upgraded up to 1.47. And when I try to launch test I have this error:

$ cargo xtest
error: `rust-src` component not found. Run `rustup component add rust-src`.
note: run with `RUST_BACKTRACE=1` for a backtrace
$

I tried to build test with cargo test as it seems the command given in the blog post but I get error when compiling x86_64

.cargo/registry/src/github.com-1ecc6299db9ec823/x86_64-0.9.6/src/instructions/interrupts.rs:18:9
   |
18 |         asm!("sti" :::: "volatile");
   |         ----^^^^^^^^^^^^^^^^^^^^^^^^
   |         |
   |         help: replace with: `llvm_asm!`
   |
   = note: consider migrating to the new asm! syntax specified in RFC 2873
   = note: alternatively, switch to llvm_asm! to keep your code working as it is

I have checked x86_64 in my Cargo.toml its version is “0.11.2” which seems the last version of the crate.

Should I downgrade rustc for this project ? How can I do that ? I give up for now. I will come back to this issue later. If you have some hints please let me know.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 21 (8 by maintainers)

Most upvoted comments

@w93163red It seems like you’re using cargo’s build-std feature. In that case, you should not use cargo-xbuild because then the core library is built twice. Instead, try a normal cargo +nightly build (or cargo build if you have set a rustup override). Using this command, your project builds and runs fine for me.

If you’re using the latest version of cargo-xbuild you need at least rustc nightly 2020-07-30. On older nighlies, you need an older version of cargo-xbuild. See the Readme of cargo-xbuild for more information:

Note: The latest version of cargo-xbuild supports all nightlies after 2020-07-30. If you are on an older nightly, you need to install version 0.5.35: cargo install cargo-xbuild --version 0.5.35.

If you’re trying to use build-std, make sure to include extern crate rlibc; in your lib.rs file too.

I had this issue, made the changes to support build-std instead of cargo-xbuild, and it worked. I had to reinstall cargo-xbuild along the way to support the bootimage crate, but regular cargo run works for me now.