-
Notifications
You must be signed in to change notification settings - Fork 500
Fails to compile with nvcc when passing RUSTFLAGS='-C target-feature=+crt-static' #772
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
Comments
While I know how to fix it, one can wonder what's up the |
On a tangential note. As for "cc-rs never links anything." One can also argue that cc-rs shouldn't issue |
Just in case. Tracing the introduction of corresponding methods back suggests that it was triggered by a linking error suggesting to recompile with |
An additional note. gcc-3-ish did require As for defaulting to -fPIC. Normally -fPIC doesn't affect your chances for static link, at least not on x86_64 Linux. Which is why it's not a problem to default to PIC. |
To summarize. The suggestion for resolution is to either no-op static_flag() and shared_flag() methods, or have them pass a suitable value to pic() method. |
The remark is arguably a bit misleading in the context of the original query. Because it's about static_flag() and shared_flag() methods, while passing |
This is a bug, pretty much. A concern I have is how many people in the wild are relying on it, though... |
I agree for |
cc-rs always calls the compiler with the Just in case, In case you wonder, I for one would advocate for b) with the following rationale. It's consistent with the cc-rs' nature, producing some object files for rustc to link with. (Recall that rustc can produce shared libraries, so what's up with linking shared libraries with cc-rs anyway?) If a user has a legitimate need to produce a shared library for rustc to link with, then they should be advised to use other means like cmake-rs. They would probably be better off anyway, as linking a shared library can get pretty nuanced. |
Yeah, I'm not sure. I agree with your assessment, but think that cmake-rs also doesn't handle cross-compilation as well as cc-rs, not to mention needing to use cmake. |
When I'm trying to make a static build of my rust application with some cuda code doing:
RUSTFLAGS='-C target-feature=+crt-static' cargo build --release
I'm getting the following error under linux:
Tested with CUDA 12
The text was updated successfully, but these errors were encountered: