Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ch11- Compilation Error #44

Open
Flinner opened this issue Aug 11, 2021 · 12 comments
Open

Ch11- Compilation Error #44

Flinner opened this issue Aug 11, 2021 · 12 comments

Comments

@Flinner
Copy link

Flinner commented Aug 11, 2021

running cargo +nightly run on ch11/ch11-fledge-os-0 returns the following:

error[E0557]: feature has been removed
 --> /home/username/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/x86_64-0.13.5/src/lib.rs:5:43
  |
5 | #![cfg_attr(feature = "const_fn", feature(const_fn))] // Needed for generic access to associated consts
  |                                           ^^^^^^^^ feature has been removed
  |
  = note: split into finer-grained feature gates

For more information about this error, try `rustc --explain E0557`.

no issues opened for this in https://github.com/rust-osdev/x86_64, related rust-lang/rust#84510

any help appriciated!

@timClicks
Copy link
Contributor

timClicks commented Aug 11, 2021

Thanks for raising this @Flinner. It looks like this changed in Rust 1.54. I will investigate and get back to you.

@ArshiAAkhavan
Copy link

i have the same problem
is there any updates?

@bonjune
Copy link

bonjune commented Aug 26, 2021

! My system is macOS Big Sur 11.5.2.

In Cargo.toml, I updated x86_64 crate to "0.14" and it worked.

So the dependencies should be like,

[dependencies]
bootloader = "0.9"
x86_64 = "0.14"

I also tried to updated bootloader to "0.10", but there is a change that it does not use bootimage crate any more. So I just leave to be "0.9". (Seems like there be more configuration to run that in 0.10)

@ArshiAAkhavan
Copy link

works for me too!
thanks

@ocampeau
Copy link

ocampeau commented Sep 3, 2021

Thanks! It solved my issue too!

@RobWalt
Copy link

RobWalt commented Dec 20, 2021

I'm still having this issue, the fix @bonjune posted doesn't work on my system (Manjaro) or isn't up to date anymore due to newer versions of rust. (I suppose)

@RobWalt
Copy link

RobWalt commented Jan 20, 2022

Ok, so I found the final workaround. You should add this to the manuscript @timClicks

Due to the rapid evolution of rust, installing nightly breaks your example. Because of this, I suggest installing a specific nightly version. This was the only fix that worked for me at least. I installed a pretty random version, before the error of this issue here popped up.

$ rustup toolchain install nightly-2021-03-01

This corresponds to v1.52.0-nightly. You might be able to install a newer version before v1.56.0-nightly.

After that, You have to make it default, as written in the book

$ rustup default nightly-2021-03-01

And then install the components

$ rustup component add rust-src
$ rustup component add llvm-tools-preview

This should do the trick for the future for everyone.

@timClicks
Copy link
Contributor

I did wonder if using an untagged nightly would end up biting readers. Sorry for putting through everyone through so much hassle.

I will investigate how best to recommend using the fixed nightly that works..

@RobWalt
Copy link

RobWalt commented Jan 21, 2022

I also stumbled upon an issue considering the dependencies versions. I tested some combinations. The one with the latest versions which was still compiling and executing fine was:

bootloader = "<=0.9.18"
x86_64 = "<0.14.0"

@mattfite
Copy link

mattfite commented Apr 4, 2022

Hi. I've tried the suggestions to use the specific nightly, and I've also tried the suggestions to update the dependencies in Cargo.toml but I still get the original error. Additionally, I receive many errors that the macro 'asm' can't be found. I'm running on macOS Monterey 12.2.

@ewenmcneill
Copy link

ewenmcneill commented Jan 13, 2023

For anyone else finding this issue, see also #88, which has a working solution, using these versions:

[dependencies]
bootloader = "0.9.22"
x86_64 = "0.14.10"

and clearing the cargo cache. (It then built for me in an Ubuntu 22.04 LTS VM, with rust nightly of 2023-01-13.)

FTR, I found that trying to use the latest bootloader / x86_64 caused a different set of build problems, presumably because there are larger changes between bootloader 0.9.x and 0.11.x (in particular it seemed to be dragging in dependencies which needed std::lib not just std::core).

FTR, to get qemu working on Ubuntu 22.04 LTS I also needed:

sudo apt-get install qemu qemu-system-x86 libgl1-mesa-dri

to be able to run the GUI qemu and see the console (at least when displayed via Forwarded X11 over SSH).

ETA: A similar fix also works for the other ch11 examples, which use a random variety of other bootloader / x86_64 crates as shipped. ch11-fledgeos-2 also needs the qemu startup parameters set in Cargo.toml.

Ewen

@jumzzz
Copy link

jumzzz commented Mar 12, 2023

While the solutions written in this thread are correct, there's something missing in my case. In case you run with similar issue like mine, these steps might be worth taking.

It turns out my cargo registry got messed up so I was forced to do this

rm -rf ~/.cargo/registry/index/*

Also following the dependency setting at Cargo.toml which was also mentioned above

[dependencies]
bootloader = "0.9"
x86_64 = "0.14"

Additional Note
If you also like to start with cargo new, make sure that you don't forget adding .cargo/config.toml with the following configuration

[build]
target = "fledge.json"

[unstable]
build-std = ["core", "compiler_builtins"]
build-std-features = ["compiler-builtins-mem"]

[target.'cfg(target_os = "none")']
runner = "bootimage runner"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants