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
$ rustup run nightly make KERNEL_BUILD_PATH=/lib/modules/4.17.11-arch1/build/ CARGO=/home/frol/.cargo/bin/xargo
error: failed to run `rustc` to learn about target-specific information
Caused by:
process didn't exit successfully: `rustc - --crate-name ___ --print=file-names --sysroot /home/frol/.xargo -Z force-unstable-if-unmarked --target x86_64-unknown-none-gnu --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro` (exit code: 1)
--- stderr
error: Error loading target specification: Field target-c-int-width in target specification is required
|
= help: Use `--print target-list` for a list of built-in targets
I have updated the x86_64-unknown-none-gnu.json file with the version from rust-barebones-kernel, but still cannot get through error:
$ rustup run nightly make KERNEL_BUILD_PATH=/lib/modules/4.17.11-arch1/build/ CARGO=/home/frol/.cargo/bin/xargo
Compiling core v0.1.0 (https://github.com/phil-opp/nightly-libcore.git#54571deb)
Compiling kernel32-sys v0.2.2
Compiling log v0.4.3
Compiling clang-sys v0.5.4
error: Error loading target specification: Could not find specification for target "x86_64-unknown-none-gnu"
|
= help: Use `--print target-list` for a list of built-in targets
error: Could not compile `core`.
warning: build failed, waiting for other jobs to finish...
error: build failed
make[2]: *** [/mnt/storage/projects/linux-kernel-basecamp/rust.ko/build/Makefile:46: /mnt/storage/projects/linux-kernel-basecamp/rust.ko/build/libhello.a] Error 101
make[1]: *** [Makefile:1571: _module_/mnt/storage/projects/linux-kernel-basecamp/rust.ko/build] Error 2
make: *** [Makefile:36: all] Error 2
Can anyone help me?
The text was updated successfully, but these errors were encountered:
I got past this error by adding RUST_TARGET_PATH='${BASE_DIR}' as an additional environment variable to the cargo command in kbuild.mk on line 46. It appears there's a bug in Cargo where when it changes directory to build other crates, it loses where to find the target specification, so you have to set that variable to make it remember. See rust-lang/cargo#4905
But after fixing that, I get a ton of errors from the nightly-libcore crate, which it seems has not been kept up to date.
Ah, it seems the proper way going forward is to use Xargo instead of Cargo and this nightly-libcore hack. Xargo takes care of building libcore for the proper target for you. I've done a bit of work on my fork (https://github.com/wfraser/rust.ko) that involves this, and also updating the bindgen version used, among other things, that gets it building on the current nightly rustc.
I have updated the
x86_64-unknown-none-gnu.json
file with the version fromrust-barebones-kernel
, but still cannot get through error:Can anyone help me?
The text was updated successfully, but these errors were encountered: