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

fix compile error in the latest nightly 1.33.0. #1

Merged
merged 2 commits into from
Apr 12, 2019

Conversation

tomoyuki-nakabayashi
Copy link
Contributor

Hi Souvik,
Thank you for your email.

First of all, I really love this humorous but challenging project.
And I am pleased to contribute to this project.

BTW, I found that the latest xargo is something wrong.
When I try to build the project using xargo, the following error occurs:

$ make
   Updating crates.io index
   Compiling cc v1.0.28
...
error[E0463]: can't find crate for `std`
  |
  = note: the `x86_64-unknown-none-gnu` target may not be installed

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: Could not compile `rustc-std-workspace-core`.
warning: build failed, waiting for other jobs to finish...
error: build failed
...

I'm not sure the cause.
Instead, I use cargo xbuild that looks like working fine.

Here is my current compiler version

rustc 1.33.0-nightly (4c2be9c97 2019-01-22)
cargo 1.33.0-nightly (907c0febe 2019-01-20)
xargo 0.3.12 # this won't work!

I'll investigate this xargo matter.

thanks,

@Skarlett
Copy link

Skarlett commented Mar 2, 2019

Fails to build on my machine.

@tomoyuki-nakabayashi

cp "kbuild.mk" "build/Makefile"
make -C "/lib/modules/4.20.13-arch1-1-ARCH/build" M="/home/god/projects/kernel-roulette/build" modules
make[1]: Entering directory '/usr/lib/modules/4.20.13-arch1-1-ARCH/build'
  CC [M]  /home/god/projects/kernel-roulette/build/src/shim.o
(cd /home/god/projects/kernel-roulette; env RUST_TARGET_PATH=/home/god/projects/kernel-roulette cargo xbuild   --target x86_64-unknown-none-gnu)
error: no such subcommand: `xbuild`

	Did you mean `build`?

make[2]: *** [/home/god/projects/kernel-roulette/build/Makefile:35: /home/god/projects/kernel-roulette/build/libroulette.a] Error 101
make[1]: *** [Makefile:1562: _module_/home/god/projects/kernel-roulette/build] Error 2
make[1]: Leaving directory '/usr/lib/modules/4.20.13-arch1-1-ARCH/build'
make: *** [Makefile:35: all] Error 2

after replacing build...

make -C "/lib/modules/4.20.13-arch1-1-ARCH/build" M="/home/god/projects/kernel-roulette/build" modules
make[1]: Entering directory '/usr/lib/modules/4.20.13-arch1-1-ARCH/build'
(cd /home/god/projects/kernel-roulette; env RUST_TARGET_PATH=/home/god/projects/kernel-roulette cargo build   --target x86_64-unknown-none-gnu)
  Downloaded spin v0.4.9
   Compiling spin v0.4.9
   Compiling rand v0.4.2
error[E0463]: can't find crate for `core`
  |
  = note: the `x86_64-unknown-none-gnu` target may not be installed

Using xargo instead...

make -C "/lib/modules/4.20.13-arch1-1-ARCH/build" M="/home/god/projects/kernel-roulette/build" modules
make[1]: Entering directory '/usr/lib/modules/4.20.13-arch1-1-ARCH/build'
(cd /home/god/projects/kernel-roulette; env RUST_TARGET_PATH=/home/god/projects/kernel-roulette xargo build   --target x86_64-unknown-none-gnu)
    Updating crates.io index
   Compiling cc v1.0.30
   Compiling core v0.0.0 (/home/god/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore)
   Compiling compiler_builtins v0.1.7
   Compiling rustc-std-workspace-core v1.0.0 (/home/god/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/tools/rustc-std-workspace-core)
error[E0658]: `cfg(target_vendor)` is experimental and subject to change (see issue #29718)
  --> /home/god/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.7/src/lib.rs:52:15
   |
52 |           all(target_vendor = "fortanix", target_env = "sgx")))]
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: add #![feature(cfg_target_vendor)] to the crate attributes to enable

error: aborting due to previous error

For more information about this error, try `rustc --explain E0658`.
error: Could not compile `compiler_builtins`.

To learn more, run the command again with --verbose.
error: `"cargo" "build" "--release" "--manifest-path" "/tmp/xargo.y7O3qEsPsDnd/Cargo.toml" "--target" "x86_64-unknown-none-gnu" "-p" "alloc"` failed with exit code: Some(101)
note: run with `RUST_BACKTRACE=1` for a backtrace
make[2]: *** [/home/god/projects/kernel-roulette/build/Makefile:35: /home/god/projects/kernel-roulette/build/libroulette.a] Error 1
make[1]: *** [Makefile:1562: _module_/home/god/projects/kernel-roulette/build] Error 2
make[1]: Leaving directory '/usr/lib/modules/4.20.13-arch1-1-ARCH/build'
make: *** [Makefile:35: all] Error 2

@tomoyuki-nakabayashi
Copy link
Contributor Author

@Skarlett

Thank you for trying out.

error: no such subcommand: xbuild

It looks like your environment lacks xbuild,
Could you try it again after installing xbuild with the command :

cargo install cargo-xbuild

@Skarlett
Copy link

Skarlett commented Mar 2, 2019

cargo install cargo-xbuild

cp "kbuild.mk" "build/Makefile"
make -C "/lib/modules/4.20.13-arch1-1-ARCH/build" M="/home/god/projects/kernel-roulette/build" modules
make[1]: Entering directory '/usr/lib/modules/4.20.13-arch1-1-ARCH/build'
  CC [M]  /home/god/projects/kernel-roulette/build/src/shim.o
(cd /home/god/projects/kernel-roulette; env RUST_TARGET_PATH=/home/god/projects/kernel-roulette cargo xbuild   --target x86_64-unknown-none-gnu)
    Updating crates.io index
   Compiling core v0.0.0 (/home/god/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore)
   Compiling compiler_builtins v0.1.7
   Compiling rustc-std-workspace-core v1.0.0 (/home/god/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/tools/rustc-std-workspace-core)
error[E0658]: `cfg(target_vendor)` is experimental and subject to change (see issue #29718)
  --> /home/god/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.7/src/lib.rs:52:15
   |
52 |           all(target_vendor = "fortanix", target_env = "sgx")))]
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: add #![feature(cfg_target_vendor)] to the crate attributes to enable

error: aborting due to previous error

For more information about this error, try `rustc --explain E0658`.
error: Could not compile `compiler_builtins`.

To learn more, run the command again with --verbose.
error: `"cargo" "rustc" "-p" "alloc" "--release" "--manifest-path" "/tmp/xargo.qhhLAv2fZMT4/Cargo.toml" "--target" "x86_64-unknown-none-gnu" "--" "-Z" "force-unstable-if-unmarked"` failed with exit code: Some(101)
note: run with `RUST_BACKTRACE=1` for a backtrace
make[2]: *** [/home/god/projects/kernel-roulette/build/Makefile:35: /home/god/projects/kernel-roulette/build/libroulette.a] Error 1
make[1]: *** [Makefile:1562: _module_/home/god/projects/kernel-roulette/build] Error 2
make[1]: Leaving directory '/usr/lib/modules/4.20.13-arch1-1-ARCH/build'
make: *** [Makefile:35: all] Error 2

@tomoyuki-nakabayashi
Copy link
Contributor Author

In my environment, it still works with the latest compiler:

$ rustc --version
rustc 1.34.0-nightly (c1d2d83ca 2019-03-01)

I'm not sure the cause but it may be related to the latest update: target_vendor is stabilized at version 1.33 (see rust-lang/rust#57465 for details).
Could you please check if the compiler is the latest version?

@Skarlett
Copy link

Skarlett commented Mar 3, 2019

In my environment, it still works with the latest compiler:

$ rustc --version
rustc 1.34.0-nightly (c1d2d83ca 2019-03-01)

I'm not sure the cause but it may be related to the latest update: target_vendor is stabilized at version 1.33 (see rust-lang/rust#57465 for details).
Could you please check if the compiler is the latest version?

Apologies, I'm running 1.33, I wont be able to test this until the rls component is released for Arch linux, unkown-gnu-x86_64

Copy link

@Skarlett Skarlett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tomoyuki-nakabayashi After finally get the RLS released - Thanks for the wait. I reviewed the commit and found only one minor issue. You do need eh_personality or else the compilation fails
src/lang.rs

#[lang = "eh_personality"]
#[no_mangle]
pub extern "C" fn eh_personality() {}

@tomoyuki-nakabayashi
Copy link
Contributor Author

@Skarlett
Thanks for your review.
I added eh_personality, please check it out.

@souvik1997
Copy link
Owner

Sorry I just saw this. Thanks for your pull request, I'll merge it.

@souvik1997 souvik1997 merged commit 26ecfcd into souvik1997:master Apr 12, 2019
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

Successfully merging this pull request may close these issues.

3 participants