-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
zig cc
: unsupported linker args (--as-needed
, -Bstatic
, -Bdynamic
, and more)
#10050
Comments
It looks like cargo is passing gcc linker flags, im not 100% sure how to tell it to pass lld ones but i have found rust-lang/rust#40018 which might let you do it. |
LLD supports these arguments just fine, although I'm not sure why it's telling you they were unsupported. |
I see. Do you know how I can fix this? |
Hi @philipahlberg there are two workarounds I am aware of:
The second option is much better but requires nightly. |
We are considering using |
for |
#10056 add support of
|
The space is required:
|
I try to use zig as the linker of cargo,but I got the same output like you ,I wonder how you solve it? [...]
warning: unsupported linker arg: -znoexecstack
warning: unsupported linker arg: -zrelro
warning: unsupported linker arg: -znow
error: static library 'unwind' not found. search paths:
G:\work2\Rust\task\target\x86_64-unknown-linux-musl\debug\deps\libunwind.a
G:\work2\Rust\task\target\debug\deps\libunwind.a
H:\RustTools\rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\x86_64-unknown-linux-musl\lib\libunwind.a
H:\RustTools\rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\x86_64-unknown-linux-musl\lib\libunwind.a
suggestion: use full paths to static libraries on the command line rather than using -l and -L arguments
[...] if i try to force zig cc to include the rust libunwind.a in rust's self-contained folder,I receive
this is my rustflag in my cargo config
|
sorry,i solved it , I found the all the duplicate symbol are in the same rlib file ,and i remove them by hand in build script,now it works fine , just a little trouble |
Could we do that? It seems fairly reasonable for The workarounds suggested here work fine, but those are all one-offs, and don't help to fulfill |
Done in 2836cd5. |
Awesome, thank you! |
Since libgcc_s also includes the exception handling functions, I think |
Zig Version
0.9.0-dev.1444+e2a2e6c14
Steps to Reproduce
In a nutshell:
zig-cc
:The list of unsupported linker args is:
--as-needed
-Bstatic
-Bdynamic
-znoexecstack
-zrelro
-znow
See philipahlberg/rust-zig-cc-docker for exact steps to reproduce.
Expected Behavior
It compiles succesfully, installing the binary onto the machine.
Actual Behavior
Note: the error message is with an
aarch64
host targetingx86_64
. The description swaps these arround, assuming that is the more common case.The text was updated successfully, but these errors were encountered: