From 9c8eda7f38c071c725c86627d1dce78ea5334c7a Mon Sep 17 00:00:00 2001 From: InternetUnexplorer Date: Fri, 11 Mar 2022 11:33:56 -0800 Subject: [PATCH] llvmPackages_rocm.llvm: don't build shared libs 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. --- pkgs/development/compilers/llvm/rocm/llvm/default.nix | 4 ++-- pkgs/development/libraries/rocm-comgr/default.nix | 9 --------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/pkgs/development/compilers/llvm/rocm/llvm/default.nix b/pkgs/development/compilers/llvm/rocm/llvm/default.nix index 724fd6b63f76..003fb4998c36 100644 --- a/pkgs/development/compilers/llvm/rocm/llvm/default.nix +++ b/pkgs/development/compilers/llvm/rocm/llvm/default.nix @@ -12,7 +12,7 @@ , zlib , debugVersion ? false , enableManpages ? false -, enableSharedLibraries ? !stdenv.hostPlatform.isStatic +, enableSharedLibraries ? false , version , src @@ -59,7 +59,7 @@ in stdenv.mkDerivation rec { "-DSPHINX_WARNINGS_AS_ERRORS=OFF" ]; - postPatch = '' + postPatch = lib.optional enableSharedLibraries '' substitute '${./outputs.patch}' ./outputs.patch --subst-var lib patch -p1 < ./outputs.patch ''; diff --git a/pkgs/development/libraries/rocm-comgr/default.nix b/pkgs/development/libraries/rocm-comgr/default.nix index 3ae872f23158..73075c9669a5 100644 --- a/pkgs/development/libraries/rocm-comgr/default.nix +++ b/pkgs/development/libraries/rocm-comgr/default.nix @@ -27,15 +27,6 @@ stdenv.mkDerivation rec { "-DLLVM_TARGETS_TO_BUILD=\"AMDGPU;X86\"" ]; - # The comgr build tends to link against the static LLVM libraries - # *and* the dynamic library. Linking against both causes errors - # about command line options being registered twice. This patch - # removes the static library linking. - patchPhase = '' - sed -e '/^llvm_map_components_to_libnames/,/[[:space:]]*Symbolize)/d' \ - -i CMakeLists.txt - ''; - passthru.updateScript = writeScript "update.sh" '' #!/usr/bin/env nix-shell #!nix-shell -i bash -p curl jq common-updater-scripts