llvm-config is a tool to output compile and linker flags, when compiling against llvm.
The tool however outputs static library names despite libllvm is build
as shared library on nixos. This was fixed for llvm 3.4, 3.5 and 3.7.
For llvm 3.8 and 3.9 it printed the library extension twice (.so.so).
This was fixed in 4.0 and the patch is backported to 3.8 and 3.9 in
this pull request.
```
$ for i in 34 35 37 38 39; do echo "\nllvm-$i"; nix-shell -p llvmPackages_$i.llvm --run 'llvm-config --libnames'; done
llvm-34
libLLVMInstrumentation.so libLLVMIRReader.so libLLVMAsmParser.so
...
llvm-35
libLLVMLTO.so libLLVMObjCARCOpts.so libLLVMLinker.so libLLVMipo.so
...
llvm-37
libLLVMLTO.so libLLVMObjCARCOpts.so libLLVMLinker.so libLLVMBitWriter.so
...
llvm-38
libLLVM-3.8.1.so
llvm-39
libLLVM-3.9.so
```
fixes#26713
Needed to build an executable that uses OpenMP with clang. This
includes a header file and a library that clang will link into an
executable whose source makes use of ‘omp‘ pragmas.
This is in preparation for the LLVM 4 upgrade (which gets more strict
about e.g., return false in xcbuild itself) and also for using xcbuild
more extensively in the Darwin stdenv bootstrap process, which is why I
killed the unnecessary gcc dependency in the toolchain. llvm-cov pretends
to be gcov anyway, so we're fine.
Splits outputs in clang like we do in 3.8 and 4.0 to avoid runtime
dependency on Python in the main derivation.
I also disable TSAN on Darwin to maintain consistency with 4.0, which
disables it because it forces an unfree dependency in the stdenv.
Split outputs because there's no point in keeping a reference to Python
and it causes trouble during the Darwin stdenv bootstrap. There's also
an unnecessary dependency on LLVM in libc++ which causes us to rebuild
LLVM several more times than necessary during bootstrap, and an awkward
dependency on XPC in the TSAN that we turn off. This is in preparation
for using LLVM 4 in the Darwin stdenv and by default across nixpkgs.
This reflects upstream versioning change, and allows
us to replace 4.0 with 4.1 (which is now a minor revision)
without changing the attribute name.
Thanks to @vcunat for the idea.
On 3.9 the substituteInPlace is equivalent to the patch,
hopefully this is a slightly more robust way to make
the same substitution for the 4.0 version.
Apply this change unconditionally for consistency across versions,
even if the changed strings are unused on other platforms.
Discussion:
https://github.com/NixOS/nixpkgs/pull/22970#discussion_r101926144