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

Cross compiling from Linux to Windows with disabled default features for std is giving error #313

Closed
Selyatin opened this issue Apr 10, 2021 · 6 comments · Fixed by #315
Closed

Comments

@Selyatin
Copy link

I'm getting this error when trying to build with xargo with default std features off, I can compile just fine using normal cargo.

user@localhost:~/Documents/project> xargo build --release --target x86_64-pc-windows-gnu
error: couldn't copy /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/crt2.o to /home/user/.xargo/lib/rustlib/x86_64-pc-windows-gnu/lib/crt2.o
caused by: No such file or directory (os error 2)
note: run with `RUST_BACKTRACE=1` for a backtrace

@RalfJung
Copy link
Collaborator

The error is caused here:

for file in ["rsbegin.o", "rsend.o", "crt2.o", "dllcrt2.o"].iter() {

You need to install the x86_64-pc-windows-gnu target, I think, to get those files? I am not an expert in Windows matters but I assume that xargo code was added for a reason.^^

I can compile just fine using normal cargo.

How are you building the standard library using normal cargo?

@Selyatin
Copy link
Author

I'm not building the standard library using normal cargo and I've x86_64-pc-windows-gnu installed, otherwise I wouldn't be able to compile it using standard cargo.

@RalfJung
Copy link
Collaborator

I'm not building the standard library using normal cargo

Then what do you mean by "I can compile just fine using normal cargo"? I thought you meant building the standard library, now I am not sure.

I've x86_64-pc-windows-gnu installed

Hm, can you check if the file "crt2.o" exists anywhere in /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu? It used to be at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/crt2.o but maybe it moved...

@RalfJung
Copy link
Collaborator

Looks like these days the files reside at

~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/self-contained/crt2.o
~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/self-contained/dllcrt2.o
~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/rsbegin.o
~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/rsend.o

@RalfJung
Copy link
Collaborator

FWIW, the PR that broke this is probably rust-lang/rust#72999.

@Selyatin
Copy link
Author

The pull request works. Thanks for your help.

bors bot added a commit that referenced this issue Apr 15, 2021
315: windows extra files: support both old and new locations r=RalfJung a=RalfJung

@Selyatin  can you test if this fixes #313?

Co-authored-by: Ralf Jung <post@ralfj.de>
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 a pull request may close this issue.

2 participants