This is the supported way rocm is tested.
It makes packaging in nix a *lot* easier (see the code size).
An important change is the dontLink detection in the clang/clang++
wrapper script: When compiling with --cuda-device-only,
the linker must not be set, otherwise e.g. the blender kernels fail to
compile.
This seems to fix the notorious "CommandLine Error: Option 'xxxxx'
registered more than once!" error in applications that use both Mesa and
ROCm.
Since Mesa is built with llvmPackages_latest and ROCm stuff is built
with llvmPackages_rocm, applications that use both (such as Blender) end
up with two different `libLLVM*.so`s loaded, which breaks things.
This seems like a straightforward way to fix the problem, and since the
ROCm stack seems to be the only thing in Nixpkgs that uses
llvmPackages_rocm this hopefully shouldn't break anything.
While there might be another way to fix this problem that doesn't
require disabling the shared libraries, I haven't been able to find it
yet, and since this issue seems to affect a lot of people I think it
might make sense to merge this fix for now and revisit it later if a
better solution is found.
This also removes a small patch to rocm-comgr since there are no longer
LLVM shared libraries for it to link against.
Since both static and shared libs are installed to the same `lib`
output, we override the ActiveLibDir unconditionally.
Fixes `llvm-config-native --link-static --libs`
Naive concatenation of $LD_LIBRARY_PATH can result in an empty
colon-delimited segment; this tells glibc to load libraries from the
current directory, which is definitely wrong, and may be a security
vulnerability if the current directory is untrusted. (See #67234, for
example.) Fix this throughout the tree.
Followup to #76804. Fixes#144646.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
I currently do not have much time to work on nixpkgs. Remove
myself as a maintainer from a bunch of packages to avoid that
people are waiting on me for a review.
- AMD GPU packages: AMD removed support for the RX5x0 GPUs from ROCm, so
I cannot test these packages anymore.
- A small number of GUI packages: I switched back to macOS on the
desktop for work reasons, so I cannot easily test these.
- broot: I took over maintainership from someone else, but do not really
use broot.
Also begin to start work on cross compilation, though that will have to
be finished later.
The patches are based on the first version of
https://reviews.llvm.org/D99484. It's very annoying to do the
back-porting but the review has uncovered nothing super major so I'm
fine sticking with what I've got.
Beyond making the outputs work, I also strove to re-sync the packages,
as they have been drifting pointlessly apart for some time.
----
Other misc notes, highly incomplete
- lvm-config-native and llvm-config are put in `dev` because they are
tools just for build time.
- Clang no longer has an lld dep. That was introduced in
db29857eb3, but if clang needs help
finding lld when it is used we should just pass it flags / put in the
resource dir. Providing it at build time increases critical path
length for no good reason.
----
A note on `nativeCC`:
`stdenv` takes tools from the previous stage, so:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.stdenv.cc`: `(?0, ?1, x)`
while:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.targetPackages`: `(x, x, ?2)`
3. `pkgsBuildBuild.targetPackages.stdenv.cc`: `(?1, x, x)`
Matches generic clang compilers, and fixes isClang inspection, which
0710308402 depends on for the
`--gcc-toolchain` flag to be set up properly.
Fixes rocm-comgr