Commit Graph

171 Commits

Author SHA1 Message Date
Alyssa Ross
ee036ed5a4 llvmPackages: don't exclude FreeBSD from -lunwind
The exception for FreeBSD was added in 0afe9d1f70 ("freebsd packages:
Init at 13.1"), but it seems to have been erroneous, as e.g. ncurses
fails to build:

	x86_64-unknown-freebsd13-clang++  -o demo ../obj_s/demo.o -L../lib -lncurses++w -L../lib -lformw -lmenuw -lpanelw -lncursesw   -lutil     -DHAVE_CONFIG_H -DBUILDING_NCURSES_CXX -I../c++ -I. -I../include  -DNDEBUG -O2  -fPIC -DPIC
	x86_64-unknown-freebsd13-ld: error: undefined symbol: _Unwind_Resume
	>>> referenced by demo.cc
	>>>               ../obj_s/demo.o:(TestApplication::run())
	>>> referenced by demo.cc
	>>>               ../obj_s/demo.o:(_GLOBAL__sub_I_demo.cc)
	>>> referenced by demo.cc
	>>>               ../obj_s/demo.o:(NCursesUserItem<UserData>::NCursesUserItem(char const*, char const*, UserData const*))
	>>> referenced 46 more times
	clang-12: error: linker command failed with exit code 1 (use -v to see invocation)

This is fixed by undoing the change, adding -lunwind on FreeBSD.
2023-01-24 21:18:39 +00:00
sternenseemann
eb4d3bc796 lib.teams.llvm: create
As a first stop towards getting a bit more organized for #171047, add a
maintainer team and add myself and John Ericson as new members. Michael
Raskin asked to be removed.

A second step could be creating a github team additionally.
2023-01-22 01:28:16 +01:00
Alyssa Ross
f5e63a0e9e bintools: add isGNU and isLLVM attributes 2023-01-20 18:35:25 +01:00
Alyssa Ross
a5e1363258 llvmPackages.bintools: remove as -> llvm-as symlink
"llvm-as is an LLVM IR -> LLVM bitcode assembler not a system
assembler"[1], and therefore should not be linked as "as".

The "as" symlink was removed in 46e5ea5af6 ("llvm*: remove symlinks
to llvm-diff, llvm-as and associated LLVM IR utilities."), but that
was partially reverted by b331c72f03 ("llvm: setup some symlinks for
compatibility with binutils"), which restored a bunch of symlinks that
were incorrectly removed, but also incorrectly restored "as".  This
was pointed out[2] at the time but apparently never fixed.

[1]: https://github.com/NixOS/nixpkgs/issues/93523#issue-661663683
[2]: b331c72f03 (commitcomment-40981705)
2023-01-18 11:36:45 +00:00
Alyssa Ross
3d1e039332 llvmPackages.bintools-unwrapped: add missing symlinks
We were missing symlinks for some programs e.g. strings, which caused
e.g. pkgsLLVM.x264 to fail to build.

Here, I have filled in all the symlinks that LLVM would create if
built with the LLVM_INSTALL_BINUTILS_SYMLINKS option.  Where an
existing symlink's target has changed, it's to avoid a double
indirection e.g. strip -> llvm-strip -> llvm-objcopy has because just
strip -> llvm-objcopy.

There's also the related problem that we are creating a as -> llvm-as
symlink, which doesn't make sense, but I'll remove that in a
subsequent commit so that if it somehow breaks something it's easy to
revert just that change.

Fixes: https://github.com/NixOS/nixpkgs/pull/210983
2023-01-18 11:36:45 +00:00
Dmitry Kalinkin
a8f6f12879 llvmPackages_8.lldb: fix darwin build
Co-authored-by: Weijia Wang <9713184+wegank@users.noreply.github.com>
2023-01-03 01:36:48 -05:00
Alyssa Ross
126229f810
llvm: disable libpfm on all non-Linux platforms
libpfm is Linux-specific, it should be disabled on e.g. FreeBSD as
well as Darwin.
2022-12-09 19:08:16 +00:00
Martin Weinelt
fe8eef1ae4 Merge remote-tracking branch 'origin/master' into staging-next 2022-12-04 22:06:42 +01:00
Sandro
cb170c2cfc
Merge pull request #193004 from ShamrockLee/clang-mainprogram 2022-12-04 20:01:46 +01:00
Vladimír Čunát
9ab35fe3ad
Merge #201268: libcxx: link correct libcxxabi version
...into staging
2022-11-28 10:00:21 +01:00
github-actions[bot]
e31b8a36d7
Merge staging-next into staging 2022-11-23 00:02:46 +00:00
Josh Channings
2252245f92 llvm: Find otool bin from targetPrefix
This is to fix the stdenvBootstrapTools issue where otool & others are
not available in PATH, but only under the targetPrefix.
2022-11-22 21:37:47 +00:00
Artturi
006c56abc4
Merge pull request #197674 from squalus/openmp-cross
openmp: fix cross compile
2022-11-22 23:29:54 +02:00
Josh Channings
252ea6511d libcxxabi: Skip dylib fixups for version symlinks
Apart from being a no-op, this seems to cause the install to make a
copy, rather than keeping the symlinks intact.
2022-11-22 19:22:18 +00:00
Josh Channings
67f11a2185 libcxx: Link libc++.dylib to matching libc++abi.dylib
Same adjustment as made for libc++abi in #185766, for the same reason:
the unamended dylib links to the libc++abi in the build stdenv, which
is the wrong version.

Tested on Darwin with LLVM 14 stdenv, but the phase is added to all
versions, including 11 - so this will cause a mass rebuild.

See: https://github.com/NixOS/nixpkgs/pull/185766
2022-11-22 19:22:18 +00:00
7c6f434c
5559f2b772
Merge pull request #199844 from vincentbernat/fix/git-clang-format
llvmpackages: patch shebangs for python subpackages
2022-11-15 21:41:58 +00:00
Vincent Bernat
ad5aecbb6b llvmpackages: patch shebangs for python subpackages
Notably, "git-clang-format" fails with:

    /usr/bin/env: ‘python’: No such file or directory
2022-11-06 12:56:47 +01:00
John Ericson
0afe9d1f70 freebsd packages: Init at 13.1
Always set `SRCTOP`, set it with abs path

llvmPackages: Bump minimum version for FreeBSD

llvmPackages_*, libgcc, compiler_rt: Hack in enough libs that one can compiler C

freebsd.compat: Rename some things to work around cc-wrapper change

0bea4a194f / #191724 in particular
2022-11-04 16:50:26 -04:00
squalus
4b07aeae16 openmp: fix cross compile 2022-10-24 23:47:27 -07:00
Artturin
7e49471316 treewide: optional -> optionals where the argument is a list
the argument to optional should not be list
2022-10-10 15:40:21 +03:00
toonn
6a132cf2f3
Merge pull request #185766 from stephank/fix/libcxxabi
libcxxabi: remove link with build libcxxabi
2022-10-05 12:58:32 +02:00
Shamrock Lee
8afdfd9e64 clang: specify meta.mainProgram 2022-09-23 01:55:21 +08:00
Bernardo Meurer
ee33222938
Merge pull request #188540 from OPNA2608/fix/llvm-parallel-tests
llvm*: Fix core usage & remove progress bar in tests
2022-09-07 12:29:53 -03:00
OPNA2608
bd332c848c llvm*: Don't show progress bar on tests
Since the progress bar results in large output that is broken due to the use of
ncurses and we already use the flag that gives verbose output on test failures,
let's just disable the progress bar.
2022-09-03 18:38:44 +02:00
OPNA2608
6c6f4a9724 llvm*: Fix core usage in tests
lit (LLVM Integrated Tester) [0] by default uses as many threads as the build host
has cores, ignoring the user's core settings for the build.
This passes the configured core count on to lit, along with LLVM's default
settings for it which we otherwise override in the process [1].

[0]: https://www.llvm.org/docs/CommandGuide/lit.html
[1]: 329fda39c5/llvm/CMakeLists.txt (L559-L565)
2022-09-03 17:20:46 +02:00
Stéphan Kochen
96e4a0f05c libcxxabi: remove link with build libcxxabi 2022-08-26 17:02:11 +02:00
John Ericson
dbc5a792a2 llvmPackages*.libunwind: Don't redo install phase from scratch
I can't think of any good reason it was the way it was before. I think
CMake can be made to install the headers too, but this is a fine first
step.
2022-08-18 00:10:08 -04:00
sternenseemann
0083a683d7 Revert "llvmPackages: do not include static archives when shared…"
Reverts #162607 / 1748887ff2.

Reason for revert: This change caused llvm-config{,-native} to be unable
to find static archives bundled with LLVM, as has been [reported]. Ever
since #152944 using moveToOutput in LLVM is _evil_ because llvm-config
obtains it knowledge about the installation locations from the CMake
configure step.

Consequently a change like #162607 will need to be implemented by making
LLVM itself install the static archives to the correct location or by
adding yet another patch which updates llvm-config's knowledge of the
location. The latter is not desireable in my opinion, though, since it
is just asking for this sort of trouble: Before #152944 we had an
outputs.patch that did this sort of things which broke spectacularly in
edge cases.

Fixes #148117.

[reported]: https://github.com/NixOS/nixpkgs/issues/148117#issuecomment-1158245576
2022-07-05 15:03:12 +02:00
Rick van Schijndel
0b45cae8a3
treewide: pkgs/development/compilers: mark broken for darwin 2022-05-30 13:41:09 +02:00
Lassulus
a1780e4b7d
Merge pull request #162607 from waldheinz/libllvm-drop-static
llvmPackages/libllvm: do not include static archives when shared is r…
2022-04-08 19:39:18 +01:00
Aleksey Kladov
6d111cbf61 Clarify that lld package provides unwrapped lld
lld package provides an unwrapped lld. It doesn't always work on NixOS
(eg, it doesn't set rpath), and so dosen't always work.

What one should be using instead is the `lld` from
`llvmPackages.bintools` package. This super counterintutive.

One incremental step we can take here is to clarify that the `lld`
package is unrwapped -- right now, it looks like 100% legit thing one
should be using!
2022-03-27 18:14:55 -04:00
Matthias Treydte
1748887ff2 llvmPackages/libllvm: move static archives to dev output
Reduces closure size by ~240MiB (down to ~100MiB) for
LLVM 13, the others are similar.

Having those archives in the lib output makes no sense
as they are no runtime dependencies. Removing them
alltogether is also not an option because the dynamic
libraries offer only the C API while many users of
libllvm require the C++ API. Those users must have an
dependency on libllvm.dev anyway and will find those
files for linking.
2022-03-04 13:05:53 +01:00
John Ericson
baf290023c
Merge pull request #153790 from sternenseemann/cross-bootstrap-logic
Cross bootstrapping logic fixes benefitting llvmPackages
2022-01-08 12:39:30 -08:00
sternenseemann
e238f456b8 llvmPackages_*.clang: pick clangUseLLVM if targetPlatform.useLLVM
libcxxClang still depends on cc wrapper's gccForLibs for libgcc which is
not available when useLLVM is set. In such cases we need to switch to
clangUseLLVM and (try) to use compiler-rt instead.

Resolves #153759: pkgsLLVM.llvmPackages.stdenv now correctly
clangUseLLVM as cc, allowing compilation to work as expected.
2022-01-07 14:52:13 +01:00
sternenseemann
766f5ffb76 llvmPackages_*: respect cc for target when choosing C++ flavour
llvmPackages_*.clang should check the default compiler for the package
set it is targeting (targetPackages.stdenv.cc) instead of the compiler
that has been used to build it (stdenv.cc) in order to get some sense of
whether to use libc++ or libstdc++.

Since we are now inspecting targetPackages in the llvmPackages.clang
attribute, we need to avoid using it in the cross stdenv — which just
forces us to explicitly request libcxxClang for darwin instead of
relying on the clang attribute to pick it for us.

We also need to do something similar for targetPackages.stdenv.cc: Here
the llvmPackages.clang logic would work as we want (inspect
targetPackages.stdenv.cc and if it doesn't exist, make the choice based
on stdenv.cc), but it gets locked in a cycle with the previous package.
We can easily break this, however: We know that the previous set had
clang and the next one doesn't exist, so we'd choose libcxxClang any day
of the week.
2022-01-07 14:42:41 +01:00
sternenseemann
e5ccc412d2 llvmPackages_*.libllvm: only build tests if doCheck
To make the value of doCheck in the argument attribute set accurate we
also need to include the condition for cross compilation which normally
is added by stdenv.mkDerivation.
2022-01-04 18:40:32 +01:00
sternenseemann
c70dca8249 llvmPackages_*.libllvm: make llvm-config and llvm-config equivalent
LLVM's build system creates NATIVE/bin/llvm-config by reexecuting cmake
with entirely new flags. Problematically, the `CMAKE_INSTALL_*` flags
are not inherited, causing llvm-config-native to return wrong
installation paths, e. g. CMAKE_INSTALL_LIBDIR would default to `lib64`
on x86_64-linux. Previously this was masked by outputs.patch which
replaced ActiveLibDir with a string passed in from Nix, however
`--cmakedir` for example would turn out to be wrong always, breaking
cross-compilation of e. g. lld.

Additionally LLVM_ENABLE_RTTI needs to be repassed, as it is used to
determine if RTTI is available. Passing LLVM_LINK_LLVM_DYLIB is crucial
if we are building LLVM non-statically: It influences the --shared-mode
flag (which should indicate that -lLLVM is enough to link all
components) and makes --link-shared work in the first place,
i. e. llvm-config-native believes the built shared libs don't exist
unless we repass this flag.

Passing LLVM_LINK_LLVM_DYLIB=ON, however, makes the native build produce
a full libLLVM.so which is something we don't want, so we introduce a
patch which forces llvm-config to link statically against the LLVM
components it needs.
2022-01-04 11:09:43 +01:00
sternenseemann
d807aaa30c llvmPackages*.libllvm: drop outputs.patch for llvm-config.patch
Due to gnu-install-dirs.patch llvm-config will return correct results
for --link-shared as well as --link-static even without this patch.
2022-01-04 11:09:43 +01:00
sternenseemann
c58517aeed llvmPackages_*.clang: stop passing LLVM_CONFIG_PATH unnecessarily
Starting with LLVM 8, clang does no longer use llvm-config to detect the
LLVM installation: https://github.com/llvm/llvm-project/commit/e4faa5c7986b7
Consequently, there is no point passing LLVM_CONFIG_PATH (in fact the
variable is unused currently).
2022-01-03 16:46:38 +01:00
7c6f434c
84fb429d21
Merge pull request #150018 from trofi/fix-llvm-for-gcc-12
llvm_{5..12}: fix tests against upcoming gcc-12
2021-12-31 21:45:53 +00:00
7c6f434c
58a27ea378
Merge pull request #148367 from r-burns/llvm-config-static
llvmPackages_*.llvm: fix llvm-config-native with static libs
2021-12-24 10:25:03 +00:00
Dmitry Kalinkin
e1aaaa90fe
llvmPackages.libcxx: unset _LIBCPP_USE_AVAILABILITY_APPLE 2021-12-18 10:09:25 -05:00
Sergei Trofimovich
35223810a1 llvm_{5..12}: fix tests against upcoming gcc-12
In https://gcc.gnu.org/PR103598 we found out that gcc-12
changed __PRETTY_FUNCTION__ slightly and broke llvm-12 (and older)
tests that rely on exact type match. llvm-13 already removed the
qualified names from the expected output.

This change changes expected output to avoid llvm:: namespace prefix.
This is enough to get tests pass on x86_64 again.

Tested against this week's gcc-12 and against gcc-10.
2021-12-10 09:08:04 +00:00
Ryan Burns
544707d6a4 llvmPackages_*.llvm: fix llvm-config-native with static libs
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`
2021-12-02 19:21:21 -08:00
Sergei Trofimovich
e9dfe892ef llvm_{5..11}: pull upstream build fix for for gcc-12
Without the fix build fails on gcc-12 as:

    /build/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp:
      In member function 'std::string llvm::NVPTXAsmPrinter::getPTXFundamentalTypeStr(...':
    /build/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp:1319:10:
      error: use of deleted function 'std::__cxx11::basic_string<...>; std::nullptr_t = std::nullptr_t]'
     1319 |   return nullptr;
          |          ^~~~~~~

The patch is present in upstream releases since llvm-12.
2021-11-21 09:50:01 +00:00
Jonathan Ringer
fc25d94010
Merge remote-tracking branch 'origin/master' into staging-next
Conflicts:
	pkgs/development/python-modules/jupyter-client/default.nix
	pkgs/development/python-modules/jupyterlab-git/default.nix
2021-10-22 09:33:07 -07:00
Vladimír Čunát
68c40000a7
Merge #141397: llvmPackages_{5,6,7}.compiler-rt: fix patches 2021-10-21 20:26:37 +02:00
Sergei Trofimovich
a410420844 pkgsStatic.llvmPackages_{{5..13},git}.compiler-rt: drop unused musl patches
Commit 199b7c50 "compiler-rt: remove <cyclades.h> from libsanitizer"
broke conditional conditional musl patches.

The change has a few effects:
- pkgsStatic.llvmPackages_{5,6,7}.compiler-rt: fix build on musl after cyclades backport
- pkgsStatic.llvmPackages_{{5..13},git}.compiler-rt: drop incomplete musl patches as
  sanitizers are disabled anyway and require more upstream porting.
2021-10-21 18:42:31 +01:00
pennae
dc895fb281 lib: make extendDerivation lighter on eval
the fix to extendDerivation in #140051 unwittingly worsened eval performance by
quite a bit. set elements alone needed over 1GB extra after the change, which
seems disproportionate to how small it was. if we flip the logic used to
determine which outputs to install around and keep a "this one exactly" flag in
the specific outputs instead of a "all of them" in the root we can avoid most
of that cost.
2021-10-15 16:39:10 +02:00
Sergei Trofimovich
e9b26087ad llvm_8, llvm_9, llvm_10: apply upstream fix for gcc-11
On gcc-11 build fails due to missing <limits> include.
The fix pulls upstream change as is.
2021-09-22 22:34:01 +01:00