-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
ENV var RUSTFLAGS="-L..." seems to be ignored #347
Comments
I'm quite sure rustflags are passed.
And they are passed to the final rustc invocation
You need to pass |
I'm trying to compile a project named Quite obviously Maybe there's a different way to get this working, I'll try patching the |
I've run
Out of the 16 calls to Also an extra note, not setting |
I tried creating a [target.x86_64-unknown-linux-gnu.unwind]
rustc-link-lib = ["unwind"]
rustc-link-search = ["/pkg/main/sys-libs.llvm-libunwind.libs.linux.amd64/lib64"]
rustc-flags = "-L/pkg/main/sys-libs.llvm-libunwind.libs.linux.amd64/lib64" |
You do not have to patch anything, see the linked cargo documentation :)
The problems seems rayon-core, you may set also the env var for I'll document the behaviour better since it is an interesting pitfall. |
I didn't post it in full because it's a huge error log and just added I tried setting variables such as |
I finally got this working with a less clean method, but it's OK since this is run in a temporary environment that is rebuilt on each build. # replace rustc with a wrapper because cargo-cbuild seems to block any rustflags
rm /bin/rustc
cat >/bin/rustc <<EOF
#!/bin/sh
exec /pkg/main/dev-lang.rust.core/bin/rustc $RUSTFLAGS "\$@"
EOF
chmod +x /bin/rustc This allows forcing the injection of |
I looked at it again.
So the additional rustflags are not passed to the build-only-dependencies while target-dependencies get the rustflags passed. But your build dependencies also need the same flags. |
I tried adding the following line before export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS="$RUSTFLAGS" Still results in:
|
if you do Today and the past days are hectic, so I cannot lookup which is the correct env var to tell You found a good corner case to tackle. |
Once rust-lang/cargo#9452 hits stable your problem would be solved. |
I'm building packages on a system where some libraries might be found in non-standard paths that can typically be queried from
pkg-config
, but because some packages just assume libs to be in/usr/lib
etc I also pass location to those libraries via env vars as-L
flags to ensure the linker knows where to find the libraries.This works fine for
cargo build
butcargo cbuild
fails because it can't find a library despite running in the same environment.(bunch of successful stuff)
The text was updated successfully, but these errors were encountered: