-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
cudaPackages: extend cc-wrapper and rewrite cudaStdenv to properly solve libstdc++ issues #226165
Comments
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/cuda-team-roadmap-update-2023-08-29/32379/1 |
By the way, is there any quick-and-dirty way to fix this? Just to get something workable while we wait for a "proper" fix. For example, would it be possible to just patch/ |
The current "quick&dirty" way is to use
Usage example:
The present issue is open because
There's a bunch of places where you could do the override, but you'll also likely need to add |
The cuda-specific part had been addressed by #275947 (again, thanks to rrbutani for highlighting the |
@SomeoneSerge Is it currently possible to build CUDA-using apps and libraries with For example, OpenCV now has this: nixpkgs/pkgs/development/libraries/opencv/4.x.nix Lines 96 to 99 in 752c634
If I want to build OpenCV with Is Thank you! |
Hi @nh2! The intention is for opencv and other downstream code to stay as it is, and for the user to pass a modified |
NVCC dictates the host C++ compiler version we use to build CUDA programs, and often drifts behind the nixpkgs' stdenv. At the time of writing nixpkgs' default nvcc uses gcc11, but the stdenv on linux is already at gcc12. When we pass gcc11 to NVCC the naive way the builds pick up gcc11's older libstdc++ and we face runtime issues when dynamically linking normal nixpkgs libraries which expect the newer libstdc++: #220341. For this reason we want the CUDA programs built with GCC11 (or whichever toolchain is pinned) to link a libstdc++ compatible with the rest of nixpkgs. Apparently this is also what nixpkgs llvm toolchains do, because libraries linked against libc++ could not have co-existed with those linked against libstdc++
To accommodate that we currently abuse the
libcxx
argument ofwrapCCWith
: https://github.com/SomeoneSerge/nixpkgs/blob/8fd02ce2c20b8c7f6b7be39681cdf71a5b4847e2/pkgs/development/compilers/cudatoolkit/stdenv.nix#L14-L20This actually has worked for a number of packages, cf. #223664, but for absolutely accidental reasons:
wrapCCWith
propagateslibcxx
to downstream packages'buildInputs
andcc
happily picks it up. Unless it doesn't: #225661, #224150 (comment)The better solution would be to adjust cc-wrapper to our needs, as discussed in #225661 (comment)
The text was updated successfully, but these errors were encountered: