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

xargo build error #296

Open
chaozju opened this issue Jun 8, 2020 · 3 comments
Open

xargo build error #296

chaozju opened this issue Jun 8, 2020 · 3 comments

Comments

@chaozju
Copy link

chaozju commented Jun 8, 2020

I am trying out nightly xargo for further customizing target riscv64gc-unknown-linux-musl for cross building inspired by this issue
but I failed at the very beginning :)

I want a statically linked executable so targetting x86_64-unknown-linux-musl
with

xargo build --release --target x86_64-unknown-linux-musl

then got

xargo build --release --target x86_64-unknown-linux-musl
   Compiling hello v0.1.0 (/home/chao/rust_playground/hello)
error[E0463]: can't find crate for `std`
  |
  = note: the `x86_64-unknown-linux-musl` 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 `hello`.

To learn more, run the command again with --verbose.
Makefile:3: recipe for target 'x86-musl' failed
make: *** [x86-musl] Error 101

my rustup show

chao@DESKTOP-B79IRTG:~/rust_playground/hello$ rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/chao/.rustup

installed toolchains
--------------------

stable-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu (default)
1.40.0-x86_64-unknown-linux-gnu

installed targets for active toolchain
--------------------------------------

wasm32-unknown-unknown
x86_64-unknown-linux-gnu
x86_64-unknown-linux-musl

active toolchain
----------------

nightly-x86_64-unknown-linux-gnu (default)
rustc 1.44.0-nightly (f509b26a7 2020-03-18)

Things work fine without nightly but with getting WARNING: the sysroot can't be built for the Stable channel. Switch to nightly. in customizing sysroot and target

@RalfJung
Copy link
Collaborator

RalfJung commented Jun 8, 2020

Looks like something is wrong with your Xargo.toml then.

But note that xargo is basically unmaintained. Maybe try using the build-std support that is native in cargo these days? https://github.com/rust-lang/wg-cargo-std-aware

@chaozju
Copy link
Author

chaozju commented Jun 11, 2020

@RalfJung
When assigning build-std to cargo build, some dep will be auto-configed into #!cfg[not[has_std]] where Hashmap is no-longer available.

Is there a way to build std ahead of other dep?

Multi-stage builds seems to be a Xargo feature?

@RalfJung
Copy link
Collaborator

RalfJung commented Jun 12, 2020

Sorry, I don't understand the question. HashMap is in std, so if you use no_std ("[not[has_std]]" doesn't exist so I have no idea what you mean) then you do not have a HashMap, that is expected.

If -Zbuild-std does not work, please report a bug at https://github.com/rust-lang/wg-cargo-std-aware/issues. I have never used that feature, nor have I ever worked with musl, so I'm afraid I don't think I can help you here.

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

2 participants