-
Notifications
You must be signed in to change notification settings - Fork 88
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-compilation fails when dependencies have build-scripts #181
Comments
From what I can tell, compilation is done in two stages, first it compiles and runs the build scripts (for procmacros and build.rs), then the cross-compilation phase occurs. The first phase requires a native compiler, but because
the native compiler cannot interpret libpthread.a when compiling the build scripts. To verify this, running |
doing this seems to fix the build for me, however, this will probably fail if the build scripts have dependencies that need to be specified |
preBuild = ''
export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUSTFLAGS="-C link-args=''$(echo $NIX_LDFLAGS | tr ' ' '\n' | grep -- '^-L' | tr '\n' ' ')"
export NIX_LDFLAGS=
''; adding this seems to fix compilation, however, this is pretty much a hack. |
FWIW, something like that should work (following the strictDeps = true;
depsBuildBuild = with pkgs; [
pkgsCross.mingwW64.stdenv.cc
pkgsCross.mingwW64.windows.pthreads
]; I'll try to refresh the example once I find some time 🙂 |
To reproduce, one can copy the cross-windows example, and add this as a dependency:
Remember to
cargo update
to update the lock file!This is the output i get:
The text was updated successfully, but these errors were encountered: