blog_os
blog_os copied to clipboard
rust-lld is only available on tier 1 platforms
See https://github.com/rust-lang/rust/issues/52362#issuecomment-409844742
Reported in https://github.com/phil-opp/blog_os/issues/403#issuecomment-587255050
Since some people might end up here if they try to follow the blog on FreeBSD (like myself), I'd like to add this here as note.
The pkg
repo version of nightly rust does have rust-lld
built so the guide can be followed with tiny modifications, though I couldn't get everything to build (yet). cargo-xbuild
fails, but xargo
seems to work. The xargo bootimage
command needs some extra tweaking too, it might be that the nightly (1.44.0) is old, it seems to not have the embed-bitcode
codegen option, but at least it's a start...
Steps:
- remove
rustup
$ rustup self uninstall
- install the
rustup-nightly
package
# pkg install rust-nightly
- set
RUST_SRC_PATH
to point to the nightly package location e.g. in.shrc
export RUST_SRC_PATH="/usr/local/lib/rustlib/src"
- add
rust-lld
to PATH
PATH="/usr/local/lib/rustlib/x86_64-unknown-freebsd/bin:${PATH}"
Just wanted to add that I'm running into this issue on a MacBook, Catalina (10.15.5), and currently searching for a workaround (if anyone knows one, I'd appreciate it), otherwise I'll be tinkering and seeing if I can drum one up myself.
rust-lld should be available on macOS, as it is a tier 1 platform. The only problem with the macOS version should be that linking machO binaries with it may result in runtime crashes. blog_os uses ELF binaries, so there should be no problems.
Update: got it fixed- I added a .toml
to the .cargo/config file, and that file extension was causing the hiccup!
Hmm... that's interesting- It seems to have worked fine before, and the error first popped up when I tried to run cargo xtest
in post 04. The odd thing is that I can still rebuild the project, and generate an executable, I just can't run the test command.
error: linker
rust-lld
not found | = note: No such file or directory (os error 2)error: aborting due to previous error; 16 warnings emitted
error: could not compile
kurogane_os
.Caused by: process didn't exit successfully:
rustc --crate-name kurogane_os --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --emit=dep-info,link -Cembed-bitcode=no -C debuginfo=2 --test -C metadata=22837689760f7da2 -C extra-filename=-22837689760f7da2 --out-dir /Users/lambda_school_loaner_94/Desktop/Contents/Languages/Rust/kurogane_os/target/x86_64-kurogane_os/debug/deps --target /Users/lambda_school_loaner_94/Desktop/Contents/Languages/Rust/kurogane_os/x86_64-kurogane_os.json -C incremental=/Users/lambda_school_loaner_94/Desktop/Contents/Languages/Rust/kurogane_os/target/x86_64-kurogane_os/debug/incremental -L dependency=/Users/lambda_school_loaner_94/Desktop/Contents/Languages/Rust/kurogane_os/target/x86_64-kurogane_os/debug/deps -L dependency=/Users/lambda_school_loaner_94/Desktop/Contents/Languages/Rust/kurogane_os/target/debug/deps --extern bootloader=/Users/lambda_school_loaner_94/Desktop/Contents/Languages/Rust/kurogane_os/target/x86_64-kurogane_os/debug/deps/libbootloader-f798ee13ab623df9.rlib --extern lazy_static=/Users/lambda_school_loaner_94/Desktop/Contents/Languages/Rust/kurogane_os/target/x86_64-kurogane_os/debug/deps/liblazy_static-7b90784f48196b84.rlib --extern spin=/Users/lambda_school_loaner_94/Desktop/Contents/Languages/Rust/kurogane_os/target/x86_64-kurogane_os/debug/deps/libspin-5e133f942883f10a.rlib --extern volatile=/Users/lambda_school_loaner_94/Desktop/Contents/Languages/Rust/kurogane_os/target/x86_64-kurogane_os/debug/deps/libvolatile-bb79fc42086685a4.rlib --sysroot /Users/lambda_school_loaner_94/Desktop/Contents/Languages/Rust/kurogane_os/target/sysroot
(exit code: 1)
I get this same error on GhostBSD (FreeBSD 12.2-STABLE FreeBSD 12.2-STABLE GENERIC amd64), but the rust-lld is installed on my computer. All I had to do was add these lines to my .profile.
export RUST_SRC_PATH="/usr/local/lib/rustlib/src"
PATH="/usr/local/lib/rustlib/x86_64-unknown-freebsd/bin:${PATH}"
But now I get other errors. I have yet to find a rust demo that actually works. So frustrating.