From f7b22f6de56dde9eb22558a7bb2168058cd60b7f Mon Sep 17 00:00:00 2001 From: Tristan Ross Date: Mon, 27 May 2024 21:57:35 -0700 Subject: [PATCH] tbb: fix version script with lld 17+ LLVM 17 enabled "--no-undefined-version" by default in Clang. We disable this by specifying the "--undefined-version" flag to $NIX_LDFLAGS when we use LLVM 17+. Ref: #315243 --- pkgs/development/libraries/tbb/2020_3.nix | 3 +++ pkgs/development/libraries/tbb/default.nix | 3 +++ 2 files changed, 6 insertions(+) diff --git a/pkgs/development/libraries/tbb/2020_3.nix b/pkgs/development/libraries/tbb/2020_3.nix index aa526591eb9e..dcd21b27ff33 100644 --- a/pkgs/development/libraries/tbb/2020_3.nix +++ b/pkgs/development/libraries/tbb/2020_3.nix @@ -60,6 +60,9 @@ stdenv.mkDerivation rec { else if stdenv.hostPlatform.isi686 then "arch=ia32" else throw "Unsupported cross architecture")); + # Fix undefined reference errors with version script under LLVM. + NIX_LDFLAGS = lib.optionalString (stdenv.cc.bintools.isLLVM && lib.versionAtLeast stdenv.cc.bintools.version "17") "--undefined-version"; + enableParallelBuilding = true; installPhase = '' diff --git a/pkgs/development/libraries/tbb/default.nix b/pkgs/development/libraries/tbb/default.nix index c02a9ed49577..73ea56b30686 100644 --- a/pkgs/development/libraries/tbb/default.nix +++ b/pkgs/development/libraries/tbb/default.nix @@ -39,6 +39,9 @@ stdenv.mkDerivation rec { # https://gcc.gnu.org/PR108854 lib.optionals (stdenv.cc.isGNU && stdenv.isx86_32) [ "-O2" ]; + # Fix undefined reference errors with version script under LLVM. + NIX_LDFLAGS = lib.optionalString (stdenv.cc.bintools.isLLVM && lib.versionAtLeast stdenv.cc.bintools.version "17") "--undefined-version"; + # Disable failing test on musl # test/conformance/conformance_resumable_tasks.cpp:37:24: error: ‘suspend’ is not a member of ‘tbb::v1::task’; did you mean ‘tbb::detail::r1::suspend’? postPatch = lib.optionalString stdenv.hostPlatform.isMusl ''