You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was facing the following issues building ch11-fledgos-0 on my MacBook M1 Pro (2021). I don't think this has anything to do with macos or the ARM architecture, just that tools have changed in the meanwhile.
NOTE: Before anything I applied #88 - I was not able to build the kernel with the current versions of bootloader and x86_64 crates - the serde dependency just does not compile.
Then, the first error I was getting is:
error: failed to run `rustc` to learn about target-specific information
Caused by:
process didn't exit successfully: `/Users/lukasknuth/.rustup/toolchains/nightly-aarch64-apple-darwin/bin/rustc - --crate-name ___ --print=file-names --target /Users/lukasknuth/hobbies/rust_in_action/chapter11-fledge-os/fledge.json --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg -Wwarnings` (exit status: 1)
--- stderr
error: error loading target specification: target feature `soft-float` is incompatible with the ABI but gets enabled in target spec
|
= help: run `rustc --print target-list` for a list of built-in targets
I found rust-osdev/bootloader#492 which describes that with recent toolchain/compiler changes, one must now also declare "rustc-abi": "x86-softfloat" in the custom target to allow enabling soft-floats.
After making this change, the next error is:
error: data-layout for target `fledge-14973612785232118897`, `e-m:e-i64:64-f80:128-n8:16:32:64-S128`, differs from LLVM target's `x86_64-unknown-none` default layout, `e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128`
Simply taking the expected data-layout from the error message and setting it in fledge.json fixes this error.
The next error is (shortened):
error: unsafe attribute used without unsafe
--> src/main.rs:9:3
|
9 | #[no_mangle]
| ^^^^^^^^^ usage of unsafe attribute
|
help: wrap the attribute in `unsafe(...)`
|
9 | #[unsafe(no_mangle)]
| +++++++ +
This is solved as described by switching to #[unsafe(no_mangle)] in the code.
The final error then is:
error: linking with `rust-lld` failed: exit status: 1
|
= note: "rust-lld" "-flavor" "gnu" "/var/folders/01/lvsv345j2m16h2d2ks2w3nw40000gn/T/rustcBjevRz/symbols.o" "<7 object files omitted>" "--as-needed" "-Bstatic" "/Users/lukasknuth/hobbies/rust_in_action/chapter11-fledge-os/target/fledge/debug/deps/{librustc_std_workspace_core-94ce5ca059995fe4.rlib,libcore-a32fa862e11c7483.rlib,libcompiler_builtins-a86ee3a353d6be3b.rlib}.rlib" "-L" "/var/folders/01/lvsv345j2m16h2d2ks2w3nw40000gn/T/rustcBjevRz/raw-dylibs" "-Bdynamic" "--eh-frame-hdr" "-z" "noexecstack" "-o" "/Users/lukasknuth/hobbies/rust_in_action/chapter11-fledge-os/target/fledge/debug/deps/chapter11_fledge_os-5803033311904355" "--gc-sections"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: rust-lld: error: undefined symbol: __rustc::rust_begin_unwind
>>> referenced by panicking.rs:117 (src/panicking.rs:117)
>>> core-a32fa862e11c7483.core.865a4b62d07742b3-cgu.12.rcgu.o:(core::panicking::panic_nounwind_fmt::runtime::he4cecbc9d0af3e80) in archive /Users/lukasknuth/hobbies/rust_in_action/chapter11-fledge-os/target/fledge/debug/deps/libcore-a32fa862e11c7483.rlib
This is again due to a recent change in the nightly rust compiler as described by rust-osdev/bootloader#500 - we must drop the #[unsafe(no_mangle)] from the pub fn panic handler.
Now I can build and run the sample again. Here are the full changes again:
I was facing the following issues building
ch11-fledgos-0
on my MacBook M1 Pro (2021). I don't think this has anything to do with macos or the ARM architecture, just that tools have changed in the meanwhile.NOTE: Before anything I applied #88 - I was not able to build the kernel with the current versions of
bootloader
andx86_64
crates - theserde
dependency just does not compile.Then, the first error I was getting is:
I found rust-osdev/bootloader#492 which describes that with recent toolchain/compiler changes, one must now also declare
"rustc-abi": "x86-softfloat"
in the custom target to allow enabling soft-floats.After making this change, the next error is:
Simply taking the expected
data-layout
from the error message and setting it infledge.json
fixes this error.The next error is (shortened):
This is solved as described by switching to
#[unsafe(no_mangle)]
in the code.The final error then is:
This is again due to a recent change in the nightly rust compiler as described by rust-osdev/bootloader#500 - we must drop the
#[unsafe(no_mangle)]
from thepub fn panic
handler.Now I can build and run the sample again. Here are the full changes again:
Cargo.toml
Same changes as in #88
fledge.json
src/main.rs
The text was updated successfully, but these errors were encountered: