Commit Graph

34 Commits

Author SHA1 Message Date
Luna
43135fcdc6 llvmPackages.libcxx: clean up rebuild avoidance 2025-09-30 08:25:32 -07:00
Emily
2dac87bbde llvmPackages_17: drop 2025-09-14 19:03:24 +01:00
Emily
a892ce396d llvmPackages_16: drop 2025-09-14 19:03:24 +01:00
Emily
77acbe1f9c llvmPackages_15: drop 2025-09-14 19:03:24 +01:00
Emily
f470ea24b6 llvmPackages_14: drop 2025-09-14 19:03:24 +01:00
Emily
791fe23b63 llvmPackages_13: drop 2025-09-14 19:03:24 +01:00
Emily
9b8a66c3a4 llvmPackages_12: drop 2025-09-14 19:03:24 +01:00
Wolfgang Walther
5a0711127c treewide: run nixfmt 1.0.0 2025-07-24 13:55:40 +02:00
Tristan Ross
65cf1668e4 llvmPackages_{12,13,14,15,16,17,18,19,20,git}.libcxx: nixfmt 2025-04-02 17:12:39 +02:00
Tristan Ross
cb280a3a24 llvmPackages_{12,13,14,15,16,17,18,19,20,git}.libcxx: move src 2025-04-02 17:12:39 +02:00
Tristan Ross
e19361f8d3 llvmPackages_{12,13,14,15,16,17,18,19,20,git}.libcxx: move pname 2025-04-02 17:12:39 +02:00
Tristan Ross
71a22894ec llvmPackages_{12,13,14,15,16,17,18,19,20,git}.libcxx: drop basename 2025-04-02 17:12:39 +02:00
Tristan Ross
de5cd17158 llvmPackages_{12,13,14,15,16,17,18,19,20,git}.libcxx: use final attrs instead of rec 2025-04-02 17:12:39 +02:00
Tristan Ross
e7e65eb0ab llvmPackages_{12,13,14,15,16,17,18,19,20,git}.libcxx: use lib.cmake functions 2025-04-02 17:12:39 +02:00
Tristan Ross
394ef62fb0 llvmPackages_{12,13,14,15,16,17,18,19,20,git}.libcxx: move patches out of common 2025-03-07 14:18:04 +01:00
György Kurucz
304d149f24 llvmPackages.libcxx: use hasSharedLibraries instead of isStatic 2024-12-22 15:59:28 +01:00
Tristan Ross
ba1deff5ad llvmPackages.*: Expose git rev through pkg.src.rev (#354792) 2024-12-16 19:38:25 -08:00
sternenseemann
f0f66c41d4 llvmPackages_12: build from monorepo source
As mentioned in #305146, keeping LLVM 12 is a source of pain because it
is the only version to be built from individual release tarball instead
of the LLVM monorepo. This commit makes LLVM 12 start from the monorepo
as well, simplifying all common LLVM expressions in the process.

With #347887, some quirks in the expressions for LLVM <14 were ironed
out, so building LLVM through from the monorepo is quite simple now.

- Most expressions only required minor changes, mostly removing the
  special casing for `sourceRoot`.

- The patch lists from llvm/12/default.nix were ported to
  common/default.nix. This only required a few extra conditionals which
  could be reduced via a rebuild also involving other LLVM versions.
  Outstanding tasks of little urgency have been noted in TODO comments.
  I have verified that the patch lists stay the same for all packages
  except LLVM where merely the order changes. An extra set of eyes
  is appreciated, of course.

- clang: The expression was reworked to use the same symlink location
  for clang-tools-extra for all versions including LLVM 12. This
  required adjusting the ad hoc patching of the clangd cmake files
  slightly.

- libunwind: We no longer need to make the libcxx sources available
  manually. We can rely on the monorepo source instead.

- lld: We no longer need to make the libunwind sources available manually.

- llvm: We no longer need to make the polly sources available manually

- On Darwin, we need to bypass CMake's C++ compiler for libcxx and
  libunwind now. It isn't a 100% clear why, probably because we've
  started to use Darwin's bootstrapStdenv for libcxx in the common
  expression compared to LLVM 12 on master [1].
  The reordering of flags for wasm causes a rebuild for some packages
  like firefox, but this should be tolerable on staging.

[1]: 665ebfb253/pkgs/development/compilers/llvm/12/default.nix (L392-L430)

(cherry picked from commit ee9eacf23e)
(cherry picked from commit c4e9f17ef9)
2024-11-30 15:11:09 +01:00
Peter Waller
cdefc40e99 llvmPackages.*: Expose git rev through pkg.src.rev
Also exposes owner, repo, and other attributes available on the original
monorepoSrc. These attributes were previously hidden behind a
runCommand that consumes monorepoSrc and hides this information away.

```
$ nix eval --raw .#llvmPackages_18.llvm.src.rev
llvmorg-18.1.8

$ nix eval --raw .#llvmPackages_git.llvm.src.rev
0e8555d4dbfdfeddc01dc2ecf9a9b6e804f7b645
```

Signed-off-by: Peter Waller <p@pwaller.net>
2024-11-09 15:12:56 +00:00
Peter Waller
801a9a90db llvmPackages.libcxx: Include libc sources in input
Without this, after llvm 6c4267fb1779bc5550bb413f33250f9365acfbc6  you
get a build failure because libcxx can't find headers which now live in
the libc tree.

Ref: https://discourse.llvm.org/t/rfc-project-hand-in-hand-llvm-libc-libc-code-sharing/77701/18
Ref: 6c4267fb17
Signed-off-by: Peter Waller <p@pwaller.net>
2024-11-08 12:34:51 +00:00
seth
fb917de147 llvmPackages_18.libcxx: fix building on windows 2024-11-06 17:29:37 -05:00
Artturin
e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00
Peter Waller
290ec4e775 llvmPackages.*: Add devExtraCmakeFlags parameter
cmake flags have a 'last flag wins' logic, so by appending to the end of
the flags it is possible to override any cmake flag.

It also ignores (and warns) if a flag is unused, so passing flags across
all packages should be safe if you want to target one package.

In combination with #320261, this PR allows consistently overriding all
packages within LLVM with additional cmake arguments. Consistency here
means for example 'if you override LLVM, then all dependencies on it are
also see the overridden LLVM in their input'. Consistency is hard to
achieve with the other obvious way of implementing this as a user: if
you use overrideAttrs then you have to write a big mess of override code
in order to override all dependents, and this can be very difficult in a
cross-compilation scenario using crossSystem and useLLVM, for example.

With this PR it is possible to write an overlay which overlays
`llvmPackages` with `llvmPackage.override { devExtraCmakeFlags = [ ... ]; }`,
and then the toolchain used with useLLVM in effect should respect
these flags.

This is useful in development for experimenting with the effect of
various flags, hence the chosen name `devCmakeFlags`.

This won't work out of the box without #341855 applied, which fixes
override passthrough.

See-Also: #320261, #341855
Signed-off-by: Peter Waller <p@pwaller.net>
2024-09-15 11:50:52 +01:00
Sigmanificient
63d05d989e pkgs/development: remove unused arguments 2024-08-03 17:18:20 +02:00
github-actions[bot]
9cede82051 Merge master into staging-next 2024-07-04 12:01:10 +00:00
Artemis Tosini
f76271c4df llvm: Don't use libunwind on FreeBSD
Native builds on nixpkgs FreeBSD always use llvm's libc++ as the
C++ standard library, with libcxxrt and "libgcc" from the FreeBSD tree
providing lower level ABI functions.

However, the cross LLVM stdenv assumed that we wanted libunwind instead
of libgcc. As libgcc headers are already in FreeBSD's libc, some C++
functions failed with duplicate header errors.

Disable all references to libunwind in libcxx on FreeBSD and the LLVM
cross stdenvs for FreeBSD.
2024-06-17 00:35:55 -07:00
Audrey Dutcher
3a6141ac96 freebsdPackages.libcxx: switch back to libcxxrt on FreeBSD
also enable new delete definitions under libxxrt
2024-05-31 13:58:17 -07:00
Vladimír Čunát
5804775d03 Merge branch 'staging' into staging-next 2024-05-31 07:30:41 +02:00
Ali Abrar
d0b08ab5de llvmPackages: libcxx: link stdlib
See: https://github.com/NixOS/nixpkgs/pull/246577/files#r1600650238

This code was breaking some thing for me, and I believe it was a
mistake. I hink we *do* wanna link libc, since libc++ depends on it, but
*don't* want to link an already-existing C++ standard library
implementation. `-nostdlib++` without `-nostdlib` therefore seems
correct to me.

Without this change, we do indeed fail to link OpenBSD.
2024-05-26 10:55:15 -04:00
Audrey Dutcher
e49098e99d llvmPackages: add support for native FreeBSD
* asan doesn't work quite right, disable it
* support for 32-bit FreeBSD uses by default logic tuned for a very old
  FreeBSD; fix that
* Some llvm tests fail for the same reason as MacOS; disable them
* libcxx no longer needs a FreeBSD special case
* Add an option to conditionally disable terminfo. terminfo doesn't seem
  to cross-compile static for FreeBSD, which means that it needs to be
  disabled when building the very early FreeBSD bootstrap tools.

Co-authored-by: John Ericson <git@JohnEricson.me>
2024-05-17 14:19:37 -07:00
Peter Waller
3c03811683 llvmPackages_*.libcxx: include libcxxabi within libcxx
Key test case: nixpkgs#pkgsStatic.pkgsLLVM.ncurses

Prior to this patch, this fails with errors such as:

```
error: undefined symbol: __cxa_throw
```

I think this is a reasonable solution because in #292043, libcxxabi was
'merged into libcxx', however, the commit message suggests that only
dynamic linking was accounted for, because it says:

```
* linux/freebsd `libc++.so` is a linker script `LINK(libc++.so.1, -lc++abi)` making `-lc++` sufficient.
```

Whereas, I found that if I tried linking a "hello world" C++ program
with a static hostPlatform, it failed unless -lc++abi was passed.

Signed-off-by: Peter Waller <p@pwaller.net>
2024-05-10 17:22:20 +02:00
John Ericson
ab097e08b7 llvmPackages.libcxx: Fix FreeBSD build
ce789e7e35 wasn't quite right, because multiple outputs.
2024-04-19 18:35:56 -04:00
Tristan Ross
782fc2ebac llvmPackages_{12,13,14,15,16,17,18,git}: use common libcxx 2024-04-12 15:50:13 -07:00
Weijia Wang
bd1607202d llvmPackages: move patches to proper folders (#287092)
* llvmPackages: move clang-*-LLVMgold-path.patch to common/clang

* llvmPackages: move exegesis-force-bdver2.patch to 9/llvm

* llvmPackages: move llvm-config-link-static.patch to common/llvm

* llvmPackages: move TLI-musl.patch to common/llvm

* llvmPackages: move libcxx-0001-musl-hacks.patch to common/llvm
2024-02-23 05:14:36 +01:00