Commit Graph

149 Commits

Author SHA1 Message Date
a-n-n-a-l-e-e
ce789e7e35
llvmPackages_{12,13,14,15,16,17,git}.{libcxx,libcxxabi}: merge libcxxabi into libcxx (#292043)
- merge libcxxabi into libcxx for LLVM 12, 13, 14, 15, 16, 17, and git.
- remove the link time workaround `-lc++ -lc++abi` from 58 packages as it is no longer required.
- fixes https://github.com/NixOS/nixpkgs/issues/166205
- provides alternative fixes for. https://github.com/NixOS/nixpkgs/issues/269548 https://github.com/NixOS/nix/issues/9640
- pkgsCross.x86_64-freebsd builds work again

This change can be represented in 3 stages
1. merge libcxxabi into libcxx -- files: pkgs/development/compilers/llvm/[12, git]/{libcxx, libcxxabi}
2. update stdenv to account for merge -- files: stdenv.{adapters, cc.wrapper, darwin}
3. remove all references to libcxxabi outside of llvm (about 58 packages modified)

### merging libcxxabi into libcxx
- take the union of the libcxxabi and libcxx cmake flags
- eliminate the libcxx-headers-only package - it was only needed to break libcxx <-> libcxxabi circular dependency
- libcxx.cxxabi is removed. external cxxabi (freebsd) will symlink headers / libs into libcxx.
- darwin will re-export the libcxxabi symbols into libcxx so linking `-lc++` is sufficient.
- linux/freebsd `libc++.so` is a linker script `LINK(libc++.so.1, -lc++abi)` making `-lc++` sufficient.
- libcxx/default.nix [12, 17] are identical except for patches and `LIBCXX_ADDITIONAL_LIBRARIES` (only used in 16+)
- git/libcxx/defaul.nix  does not link with -nostdlib when useLLVM is true so flag is removed. this is not much different than before as libcxxabi used -nostdlib where libcxx did not, so libc was linked in anyway.

### stdenv changes
- darwin bootstrap, remove references to libcxxabi and cxxabi
- cc-wrapper: remove c++ link workaround when libcxx.cxxabi doesn't exist (still exists for LLVM pre 12)
- adapter: update overrideLibcxx to account for a pkgs.stdenv that only has libcxx

### 58 package updates
- remove `NIX_LDFLAGS = "-l${stdenv.cc.libcxx.cxxabi.libName}` as no longer needed
- swift, nodejs_v8 remove libcxxabi references in the clang override

https://github.com/NixOS/nixpkgs/pull/292043
2024-03-11 03:53:37 -07:00
Someone Serge
e6e279913c
stdenvAdapters.useLibsFrom: init 2024-01-12 17:38:00 +00:00
Weijia Wang
2f9e98ccf3 Merge branch 'master' into staging-next 2024-01-10 23:12:44 +01:00
Sergei Trofimovich
55249c817f stdenv.adapters: fixx overrideLibcxx to refer to existing compiler-rt
Before the change `pkgsLLVM` attributes were failing to pull in
`compiler-rt` on `x86_64-linux`:

    $ nix build --no-link -f. pkgsLLVM.asciidoc-full
    error:
       error: attribute 'llvmPackages_13' missing

       at pkgs/stdenv/adapters.nix:86:32:

           85|       inherit libcxx;
           86|       extraPackages = [ cxxabi pkgs.pkgsTargetTarget."llvmPackages_${lib.versions.major llvmLibcxxVersion}".compiler-rt ];
             |                                ^
           87|     });

It happens because `pkgs.pkgsTargetTarget` are always empty for
cross-packages like `pkgsLLVM.`, `pkgsCross.*.` or
`--arg crossSystem '...'`.
2024-01-07 22:11:49 +00:00
Robert Scott
dc2247a3b5 stdenvAdapters: add withDefaultHardeningFlags 2023-12-09 16:32:15 +00:00
Weijia Wang
023d20ae64
Merge pull request #265307 from reckenrode/clang16-fixes-batch2
rubyPackages.iconv, v8: fix build with clang 16
2023-11-04 17:14:36 +01:00
Randy Eckenrode
98b8d3474b
stdenvAdapters.overrideSDK: special case the 10.12 Libsystem
The 10.12 Libsystem is not located as a sub-attribute of
`darwin.apple_sdk_10_12`. This will be fixed as part of the SDK changes
planned for post-23.11. In the meantime, special case it so the adapter
can be used to change the deployment target.
2023-11-04 01:47:58 -04:00
Randy Eckenrode
cc4fcc147b
stdenvAdapters: add overrideLibcxx
This was taken from #264091 to use in the interim before that PR lands
(sometime after the release of 23.11). It allows different versions of
clang to link the same libc++, allowing dependencies to be linked when
they are built with a different version of clang than the stdenv.
2023-11-03 23:11:32 -04:00
Randy Eckenrode
08e1c95e9c
stdenvAdapters.overrideSDK: handle non-drv nativeBuildInputs 2023-11-01 12:30:26 -04:00
Randy Eckenrode
b6a14a3a84
stdenvAdapters.overrideSDK: also remap propagatedBuildInputs 2023-11-01 09:06:44 -04:00
Randy Eckenrode
50d046c32a
stdenvAdapters.overrideSDK: update the SDK version recursively
Update all propagated build inputs recursively, so that propagated
inputs with propagated inputs use the correct SDK.
2023-11-01 09:06:44 -04:00
Randy Eckenrode
3440df992e
stdenvAdapters.overrideSDK: override xcodebuild to use the requested SDK 2023-10-31 00:18:54 -04:00
Randy Eckenrode
c2a623b52a
stdenvAdapters: add overrideSDK
This is a replacement for using `darwin.apple_sdk_<ver>.callPackage`.
Instead of injecting the required packages, it provides a stdenv adapter
that modifies the derivation’s build inputs to use the requested SDK
versions. This modification extends to any build inputs propagated to it
as well. The `callPackage` approach is not deprecated yet, but it is
expected that it will be eventually.

Note that this is an MVP. It should work with most packages, but it only
handles build inputs and also only handles frameworks. Once more SDKs
are added (after #229210 is merged) and the SDK structure is normalized,
it can be extended to handle any package in the SDK namespace.

Cross-compilation may or may not work. Any cross-related issues can be
addressed after #256590 is merged.
2023-10-26 13:26:39 -04:00
github-actions[bot]
34db746ff9
Merge staging-next into staging 2023-10-20 06:35:22 +00:00
Pavel Sobolev
17acba4cd1
stdenvAdapters.useMoldLinker: set allowedRequisites to null 2023-10-19 15:48:42 +03:00
github-actions[bot]
c68d98e9d4
Merge staging-next into staging 2023-10-13 18:01:31 +00:00
Artturin
e64d24fff4
stdenvAdapters.useMoldLinker: automatically add allowedRequisites
Co-Authored-By: Pavel Sobolev <paveloom@riseup.net>
2023-10-13 10:14:40 +03:00
github-actions[bot]
49523dec15
Merge staging-next into staging 2023-10-13 06:01:45 +00:00
Artturin
77bf1395d6 mold: add tests for mold-wrapped and useMoldLinker adapter
Make both ready for cross with prefixes

Currently
`pkgsCross.aarch64-multiplatform.mold.passthru.tests.{wrapped,adapter}`
fail with

```
Testing running the 'hello' binary which should be linked with 'mold'
Hello, world!
Checking for mold in the '.comment' section
No mention of 'mold' detected in the '.comment' section
The command was:
aarch64-unknown-linux-gnu-readelf -p .comment ...bin/hello
The output was:
String dump of section '.comment':
  [     0]  GCC: (GNU) 12.3.0
```
2023-10-13 05:23:32 +03:00
Peter Waller
9fdf395cc7 makeStaticBinaries: Set -DCMAKE_SKIP_INSTALL_RPATH
Without this, you get error messages during the install phase along the
lines of: "file RPATH_CHANGE could not write new RPATH:".

This is unsurprising because the static binaries do not have any dynamic
linker and thus, no runpath to rewrite either.

Tell cmake it doesn't need to do RPATH manipulation by passing
cmakeFlags.

While we're here, I also renamed `finalAttrs` to `args` and fixed the
indentation; this improves consistency with the surrounding code and
eliminates a point of confusion: because it was named `finalAttrs` I
presumed I should be able to influence it with an overrideAttrs setting
dontAddStaticConfigureFlags, but this turns out not to be possible;
adding prevAttrs as well doesn't work because of a limitation of
overrideAttrs whereby it gives an infinite recursion if the set of
attribute keys being returned depends on finalAttrs.

Signed-off-by: Peter Waller <p@pwaller.net>
2023-09-03 18:30:59 +01:00
Artturin
29b4a92458 stdenvAdapters: Remove 6 year old comment
Comment was added in 3c36dcc and hasn't been needed because makeStaticBinaries already adds glibc.static
2023-07-21 00:49:44 +03:00
Artturin
cb29bc6ace stdenvAdapters: Fix condition
Fixes issue 244232
2023-07-21 00:49:40 +03:00
Randy Eckenrode
feb89eed00
darwin.stdenv: fix portable libsystem hook with sandboxing
When sandboxing is enabled, the hook tries to run `install_name_tool`
and fails because the system one is inaccessible. Having it use
`targetPrefix` allows it to find and use the cross-install_name_tool.
2023-07-08 20:49:49 -06:00
figsoda
34181be024 stdenvAdapters: don't use lib.optional with a list 2023-07-03 21:20:17 -04:00
Uri Baghin
fd8e2ca0df stdenv: fix makeStaticDarwin not composing with stdenvNoCC 2023-06-22 15:33:54 +10:00
Artturin
67a84d1428 stdenvAdapters: fix preservation of env.NIX_CFLAGS_COMPILE
we have managed to migrate to NIX_CFLAGS_COMPILE to the env attrset well
enough that we don't need to support having it toplevel. mkDerivation
will throw if there's a attr in both env and toplevel so no need to
worry about that
2023-04-12 21:27:34 +03:00
Artturin
9adf83737f stdenvAdapters: fix preservation of env 2023-04-11 21:25:52 +03:00
github-actions[bot]
3cdd771820
Merge staging-next into staging 2023-02-23 18:01:49 +00:00
Artturin
f9fdf2d402 treewide: move NIX_CFLAGS_COMPILE to the env attrset
with structuredAttrs lists will be bash arrays which cannot be exported
which will be a issue with some patches and some wrappers like cc-wrapper

this makes it clearer that NIX_CFLAGS_COMPILE must be a string as lists
in env cause a eval failure
2023-02-22 21:23:04 +02:00
Artturin
299a7bd35e stdenvAdapters: add useMoldLinker 2023-02-17 06:35:24 +02:00
Alyssa Ross
0ae87d514f treewide: add names to all setup hooks 2023-01-19 15:00:36 +00:00
pennae
abd2e87da1 stdenv: remove deprecated adapters 2022-08-26 16:25:44 +02:00
Robert Hensing
dd770cc211 stdenv/adapters.nix: Fix for overlay style arguments 2022-06-05 13:54:03 +02:00
Artturin
0c4d65b21e treewide: stdenv.glibc -> glibc 2022-05-25 15:51:20 +03:00
Artturin
2d019e0931 stdenv: deprecate unused adapters
stdenv: deprecate addCoverageInstrumentation adapter

this used to be used in nixos/tests but it hasn't been used in nixpkgs
for years

stdenv: deprecate replaceMaintainersField adapter

it was added in 2009 in 01e98e49b1
by nbp
there are no uses of it in nixpkgs now

stdenv: deprecate validateLicenses adapter

it was added in 2009 in b29073af25

unfreePredicate is now handled in ./pkgs/stdenv/generic/check-meta.nix
so this is unnecessary
2022-05-07 22:36:10 +03:00
matthewcroughan
b0c0e0d7eb stdenv: introduce withCFlags
Adds an easy method of appending compiler flags to your stdenv via a
list.

Co-authored-by: tomberek <tomberek@users.noreply.github.com>
Co-authored-by: Gytis Ivaskevicius <gytis02.21@gmail.com>
Co-authored-by: sternenseemann <sternenseemann@systemli.org>
2022-01-29 21:23:12 -05:00
John Ericson
3edba5edfc pkgsStatic: Finally obviate overlay! 2021-08-20 06:09:48 +00:00
John Ericson
904625852d pkgsStatic: Inline more of static overlay 2021-08-19 21:55:06 +00:00
John Ericson
f110a182a6 stdenv: Fix overriding + overrideAttrs
The old stdenv adapters were subtly wrong in two ways:

 - `overrideAttrs` leaked the original, unoverridden `mkDerivation`.

 - `stdenv.override` would throw away any manually-set `mkDerivation`
   from a stdenv reverting to the original.

Now, `mkDerivation` is controlled (nearly directly) via an argument, and
always correctly closes over the final ("self") stdenv. This means the
adapters can work entirely via `.override` without any manual `stdenv //
...`, and both those issues are fixed.

Note hashes are changed, because stdenvs no previously overridden like
`stdenvNoCC` and `crossLibcStdenv` now are. I had to add some
`dontDisableStatic = true` accordingly. The flip side however is that
since the overrides compose, we no longer need to override anything but
the default `stdenv` from which all the others are created.
2021-08-18 17:22:50 +00:00
Alyssa Ross
b0b5ef7286 stdenv: introduce dontAddStaticConfigureFlags
With removeUnknownConfigureFlags, it's impossible to express a package
that needs --enable-static, but will not accept --disable-shared,
without overriding the result of removeUnknownConfigureFlags _again_
in pkgs/top-level/static.nix.

It would be much better (and more in line with the rest of Nixpkgs) if
we encoded changes needed for static builds in package definitions
themselves, rather than in an ever-expanding list in static.nix.  This
is especially true when doing it in static.nix is going to require
multiple overrides to express what could be expressed with stdenv
options.

So as a step in that direction, and to fix the problem described
above, here I replace removeUnknownConfigureFlags with a new stdenv
option, dontAddStaticConfigureFlags.  With this mechanism, a package
that needs one but not both of the flags just needs to set
dontAddStaticConfigureFlags and then set up configureFlags manually
based on stdenv.hostPlatform.isStatic.
2021-06-11 14:16:05 -07:00
Ben Siraphob
36c91cea1d treewide: stdenv.lib -> lib 2021-01-27 13:08:40 +07:00
Jude Taylor
0de6275003 pkgsStatic: fix eval on Darwin 2020-04-28 08:41:48 -07:00
Dmitry Kalinkin
d05ee9c8ff
pkgsStatic: set BUILD_SHARED_LIBS=OFF for cmake 2020-01-03 11:31:17 -05:00
Matthew Bauer
07d78691da stdenv/adapters.nix: remove static from makeStaticLibraries
This logic should be in the pkgs/top-level/static.nix. We don’t want
to pollute Nixpkgs with =if stdenv.static=. Also, "static" is not
descriptive. We have two types of static stdenvs, ‘makeStaticLibaries’
and ‘makeStaticBinaries’. We shouldn’t rely on a static boolean like
this.
2019-09-19 12:52:28 -04:00
Tobias Mayer
bb71bb15ce pkgsStatic: propagate all buildInputs 2019-07-24 16:04:51 +02:00
Tobias Mayer
3c12ae1d35 Signal static build option in makeStaticLibraries
This flag can replace the extra static parameter to packages that
don't work automatically with this adapter.
2019-07-21 06:44:50 +02:00
Vladimír Čunát
b4ae841b23
Merge branch 'staging-next' into staging 2019-05-26 09:48:55 +02:00
Matthew Bauer
fea2422398 static: set default_library flag for meson in makeStaticLibrary
Adds support for building static libraries with meson.
2019-05-08 21:52:59 -04:00
Daniel Schaefer
786f02f7a4 treewide: Remove usage of isNull
isNull "is deprecated; just write e == null instead" says the Nix manual
2019-04-29 14:05:50 +02:00
James Kay
eb76dd37a7
makeStaticBinaries: add a static glibc when performing a mkDerivation 2018-12-14 11:02:18 +00:00