Commit Graph

344 Commits

Author SHA1 Message Date
Matthew Bauer
f42aa7e1d7 cc-wrapper: set FC when langFortran is on
We need to set FC so that CMake and other tools can find the fortran
compiler. Also we need to limit the hardening flags since fortify and
format don’t work with fortran.

Fixes #88449
2020-07-06 00:22:19 -04:00
John Ericson
704daf7a6e {bintools,cc}-wrapper: Ensure nix-support/*-flags files exist
This will unbreak firefox and a few other packages which try to grab
some of the libcxx flags.
2020-06-30 18:26:37 +00:00
John Ericson
1085403acd {cc,bintools}-wrapper: Comments no longer spliced
This means we can freely keep the comments up to date without the
penalty of a mass rebuild.
2020-06-30 15:04:10 +00:00
John Ericson
f3f7612a40 C++ Compilers: Systematize handling of standard libraries 2020-06-22 04:24:44 +00:00
Lars Jellema
7ea5b08cfc gnat: fix build 2020-09-19 20:54:27 -07:00
Vladimír Čunát
e88e14ec8d
Merge branch 'master' into staging-next
A few thousand rebuilds per platform have arrived in the meantime.
2020-09-11 14:24:13 +02:00
John Ericson
5fd27509cf
Merge pull request #97387 from Ericson2314/fix-android-prebuilt
cc-wrapper: Fix for prebuilt android
2020-09-08 20:24:50 -04:00
John Ericson
204dc3a88b cc-wrapper: Fix for prebuilt android
We don't want to use Nix-built GCC's libs with prebuilt clang in this
case.
2020-09-07 15:08:11 -04:00
Frederik Rietdijk
5ceea5705a Revert "utils.bash: also "fix" cc-wrapper and pkg-config-wrapper"
Follow up to the revert in e560459c5b.

This reverts commit 1936b11f63.
2020-09-07 16:31:59 +02:00
Frederik Rietdijk
1936b11f63 utils.bash: also "fix" cc-wrapper and pkg-config-wrapper 2020-09-07 07:19:26 +02:00
John Ericson
1965a241fc
Merge pull request #61019 from volth/gcc.arch-amd
platform.gcc.arch: support for AMD CPUs
2020-09-01 22:31:16 -04:00
volth
cf7b63df5b gcc.arch: refactor, move tables under lib/ 2020-08-05 11:18:26 +00:00
volth
463db72e63 platform.gcc.arch: support for AMD CPUs 2020-08-05 02:32:48 +00:00
Frederik Rietdijk
d578248611 Merge staging-next into staging 2020-05-24 10:10:06 +02:00
Stefan Frijters
fc9b93d2fc gdc: init at 9.3.0 2020-05-19 23:06:52 +02:00
John Ericson
1ac5398589 *-wrapper; Switch from infixSalt to suffixSalt
I hate the thing too even though I made it, and rather just get rid of
it. But we can't do that yet. In the meantime, this brings us more
inline with autoconf and will make it slightly easier for me to write a
pkg-config wrapper, which we need.
2020-05-12 00:44:44 -04:00
Lars Jellema
8e79583510 gnat: init at 9.3.0 2020-04-20 14:41:22 +02:00
John Ericson
204d710405 treewide: Get rid of -dumpmachine in favor of static info 2020-04-13 19:26:19 -04:00
John Ericson
19a0b38cbe
Merge pull request #82882 from obsidiansystems/armv6-embedded
Misc fixes for armv6 bare metal cross
2020-03-19 10:38:22 -04:00
John Ericson
bc054004ac cc-wrapper, clang: libstdcxxHook should a propagated build input
Lumping it in with the target platform libraries was incorrect, and
caused eval failures when gcc couldn't be built for the target platform.
2020-03-18 11:28:52 -04:00
Vladimír Čunát
1d9c10c8de
stdenv cc-wrapper: deal with edge-case regressions
Regression introduced in PR #81191 80729b6787.  The file does not exist
somewhere during bootstrap of pkgsStatic.busybox which is used in nix
(by default).

I tested the builds.
2020-03-10 11:09:26 +01:00
John Ericson
5c4dd08a03
Merge pull request #81191 from clkamp/stdenv-multi-line-libc-cflags
stdenv: Fix gcc multi line libc-cflags
2020-03-07 21:28:33 -05:00
Christian Lütke-Stetzkamp
80729b6787 stdenv: Fix gcc multi line libc-cflags
which broke at least libstdc++5.

Closes #79761
2020-03-06 10:34:57 +01:00
Ben Wolsieffer
e1831ebea3 gcc: move target-specific runtime libraries to separate output 2020-03-04 16:12:36 -05:00
John Ericson
cfd013813e
Merge pull request #74090 from obsidiansystems/ghcjs-cross-without-cc
stdenv, haskell: bonafied GHCJS cross compilation without stdenv.cc
2019-12-30 16:40:43 -08:00
Matthew Bauer
162a935d3c
Merge pull request #74226 from bhpdt/fix/idirafter-stdenv
stdenv: Fix gcc -idirafter shell glob in cc-wrapper
2019-12-02 13:41:28 -05:00
David Wood
4d26c18306 cc-wrapper: expose wrapper script as overridable attribute (#65813) 2019-11-27 14:15:56 -05:00
Ben Hipple
5f589d8d5d stdenv: Fix gcc -idirafter shell glob in cc-wrapper
If an empty string is passed to `-idirafter`, it breaks gcc. This commit makes
the stdenv less fragile by expanding out the shell glob and ensuring no empty
arguments get passed.
2019-11-26 00:55:16 +00:00
John Ericson
6bc456c91c Merge remote-tracking branch 'upstream/master' into ghcjs-cross-without-cc 2019-11-25 00:23:07 +00:00
John Ericson
63bd851e95 stdenv: Introduce hasCC attribute
Before, we'd always use `cc = null`, and check for that. The problem is
this breaks for cross compilation to platforms that don't support a C
compiler.

It's a very subtle issue. One might think there is no problem because we
have `stdenvNoCC`, and presumably one would only build derivations that
use that. The problem is that one still wants to use tools at build-time
that are themselves built with a C compiler, and those are gotten via
"splicing". The runtime version of those deps will explode, but the
build time / `buildPackages` versions of those deps will be fine, and
splicing attempts to work this by using `builtins.tryEval` to filter out
any broken "higher priority" packages (runtime is the default and
highest priority) so that both `foo` and `foo.nativeDrv` works.

However, `tryEval` only catches certain evaluation failures (e.g.
exceptions), and not arbitrary failures (such as `cc.attr` when `cc` is
null). This means `tryEval` fails to let us use our build time deps, and
everything comes apart.

The right solution is, as usually, to get rid of splicing. Or, baring
that, to make it so `foo` never works and one has to explicitly do
`foo.*`. But that is a much larger change, and certaily one unsuitable
to be backported to stable.

Given that, we instead make an exception-throwing `cc` attribute, and
create a `hasCC` attribute for those derivations which wish to
condtionally use a C compiler: instead of doing `stdenv.cc or null ==
null` or something similar, one does `stdenv.hasCC`. This allows quering
without "tripping" the exception, while also allowing `tryEval` to work.

No platform without a C compiler is yet wired up by default. That will
be done in a following commit.
2019-11-25 00:12:38 +00:00
John Ericson
6d3b7458cc
Merge pull request #74065 from Ericson2314/cc-versions
compilers, binutils: Add version and pname
2019-11-24 18:35:13 -05:00
Craig Hall
da3c053482 {cc,bintools}-wrapper: Inherit compiler version 2019-11-24 18:32:26 +00:00
John Ericson
d0d5136cce Merge remote-tracking branch 'upstream/master' into wrapper-pname-support 2019-11-24 17:25:07 +00:00
Craig Hall
99537e994f {cc,bintools}-wrapper: use cc pname/version if set 2019-11-24 16:33:21 +00:00
John Ericson
fae8d2627d cc-wrapper, bintools-wrapper: Remove now unneeded set {+,-}u 2019-11-04 19:57:14 -05:00
Craig Hall
0b7494ed2b cc-wrapper: add (partial) support for clang -cc1
We need this for intel-compute-runtime, see #63705
2019-09-01 16:53:06 +01:00
Matthew Bauer
f496357585 cc-wrapper: use -iframework instead of -F
This avoids dumping -Wall warnings when they appear in framework
headers. As a result, we are closer to how regular headers are
included (via -isystem).

Also remove ccIncludeFlag lookup, this was unused & not very useful.
2019-06-28 16:27:27 -04:00
Matthew Bauer
23c520d95e cc-wrapper: only set -march when platform.gcc.arch is specified
We want to make sure this value is explicitly set. Infering it for
every arch leads to annoying failures like:

https://hydra.nixos.org/build/92583832/

Perhaps we can enable it in the future with some smarter handling of
cc-wrapper.sh.
2019-04-26 22:30:45 -04:00
volth
dba65df034 kernel: fix cross-build
Fix for #59225 regression proposed by @matthewbauer
https://github.com/NixOS/nixpkgs/pull/59225#issuecomment-486398003

(cherry picked from commit a6ea72a77d1f8e794244b063a7e9780c1b47486d)
2019-04-25 14:14:48 -04:00
Matthew Bauer
7488a367af
Merge pull request #56555 from matthewbauer/wasm
Initial WebAssembly/WASI cross-compilation support
2019-04-23 22:44:33 -04:00
Matthew Bauer
6948ffd398 wasilibc: use .imports file for lld
instead of passing in the --allow-undefined-file, we can just let lld
find the file.
2019-04-23 21:48:58 -04:00
Matthew Bauer
9abff4af4f wasm: init cross target
Adds pkgsCross.wasm32 and pkgsCross.wasm64. Use it to build Nixpkgs
with a WebAssembly toolchain.

stdenv/cross: use static overlay on isWasm

isWasm doesn’t make sense dynamically linked.
2019-04-23 21:48:57 -04:00
volth
5d87bc2650 fix bootstrap when platform.gcc.arch=="skylake" 2019-04-21 16:37:49 +00:00
Matthew Bauer
d180cb9850 cc-wrapper: make machine configuration configurable
It is useful to make these dynamic and not bake them into gcc. This
means we don’t have to rebuild gcc to change these values. Instead, we
will pass cflags to gcc based on platform values. This was already
done hackily for android gcc (which is multi-target), but not for our
own gccs which are single target.

To accomplish this, we need to add a few things:

- add ‘arch’ to cpu
- add NIX_CFLAGS_COMPILE_BEFORE flag (goes before args)
- set -march everywhere
- set mcpu, mfpu, mmode, and mtune based on targetPlatform.gcc flags

cc-wrapper: only set -march when it is in the cpu type

Some architectures don’t have a good mapping of -march. For instance
POWER architecture doesn’t support the -march flag at all!

https://gcc.gnu.org/onlinedocs/gcc/RS_002f6000-and-PowerPC-Options.html#RS_002f6000-and-PowerPC-Options
2019-04-20 20:05:51 -04:00
Matthew Bauer
d453273fbf llvm8: support c++ in cross case
this adds libc++ to the LLVM cross, giving us access to the full
Nixpkgs set. This requires 4 stages of wrapped compilers:

- Clang with no libraries
- Clang with just compiler-rt
- Clang with Libc, and compiler-rt
- Clang with Libc++, Libc, and compiler-rt
2019-04-11 21:28:51 -04:00
Matthew Bauer
aab8c7ba43 netbsd: add cross target 2019-02-26 15:55:47 -05:00
Vladimír Čunát
8ba516664b
Merge branch 'staging-next' into staging 2019-02-01 09:42:53 +01:00
Matthew Bauer
830879d4c4
cc-wrapper: set priority to 10 2019-01-31 20:07:55 -05:00
Matthew Bauer
77550df8e6 cc-wrapper: add libcxx for libcxxClang
clang needs to find headers + libraries for compiling with libc++. We
need to add a libcxx argument to cc-wrapper. This means you do not
have to pass in c++ headers directly.

This resolves the last case remaining of #30670. Darwin clang++ now
works properly.

Fixes #30670
2019-01-26 22:45:15 -05:00
Michael Raskin
ad1abb2824
Merge pull request #46115 from oxij/stdenv/bintools-cc-symlink
cc-wrapper, bintools-wrapper: simply symlink man and info outputs
2018-11-22 08:58:28 +00:00
Jan Malakhovski
d32f51c618 cc-wrapper, bintools-wrapper: simply symlink man and info outputs
With the previous commit `propagateDoc` is now always given the correct value
(i.e. it is never set to `true` when there are no `man` and `info` outputs).
Hence, we can simply symlink the original outputs to the wrapper outputs.

Pros:

- simpler, less indirection compared to `propagated-user-env-packages`,
- uses less inodes (1 symlink, which nix then simply automatically resolves
  and removes, vs. two directories and a file),
- makes direct references like "export MANPATH=${stdenv.cc.man}/share/man"
  simply work.

Cons:

- I'm not aware of any.

This and the previous commit together almost completely revert commits
fde7296a47,
fa41297209, and
c981787db9.
2018-11-07 08:37:51 +00:00
Matthew Bauer
412093994b gcc: support avr
- respect libc’s incdir and libdir
- make non-unix systems single threaded
- set LIMITS_H_TEST to false for avr
- misc updates to support new libc’s
- use multilib with avr

For threads we want to use:
- posix on unix systems
- win32 on windows
- single on everything else

For avr:
- add library directories for avrlibc
- to disable relro and bind
- avr5 should have precedence over avr3 - otherwise gcc uses the wrong one
2018-10-29 14:34:09 -05:00
Jan Malakhovski
b2c7a5a271 bintools-wrapper, cc-wrapper, stdenv: infer propagateDoc automatically
02c09e0171 (NixOS/nixpkgs#44558) was reverted in
c981787db9 but, as it turns out, it fixed an issue
I didn't know about at the time: the values of `propagateDoc` options were
(and now again are) inconsistent with the underlying things those wrappers wrap
(see NixOS/nixpkgs#46119), which was (and now is) likely to produce more instances
of NixOS/nixpkgs#43547, if not now, then eventually as stdenv changes.

This patch (which is a simplified version of the original reverted patch) is the
simplest solution to this whole thing: it forces wrappers to directly inspect the
outputs of the things they are wrapping instead of making stdenv guess the correct
values.
2018-09-23 17:29:56 +00:00
Jan Malakhovski
4092708261 treewide: cleanup some references to bash 2018-09-04 22:05:02 +00:00
Matthew Bauer
13c8acc3db Revert "Merge pull request #44767 from obsidiansystems/wrapper-env-var-path"
This reverts commit 89efc27f57, reversing
changes made to d0f11020ca.
2018-08-22 01:14:53 +02:00
John Ericson
89efc27f57
Merge pull request #44767 from obsidiansystems/wrapper-env-var-path
{cc,bintools}-wrapper, ghc, libgcc: Define wrapper env vars as full paths
2018-08-17 16:12:26 -04:00
Eelco Dolstra
fa41297209
Revert "cc-wrapper: propagate man and info to propagated-build-inputs"
This reverts commit 28ad0703f3.
2018-08-09 12:58:16 +02:00
Eelco Dolstra
c981787db9
Revert "cc-wrapper, bintools-wrapper: simply symlink man and info outputs"
This reverts commit 02c09e0171.
2018-08-09 12:57:38 +02:00
John Ericson
1dc0404d6e cc-wrapper: Define env vars with full path 2018-08-06 20:38:13 -04:00
Jan Malakhovski
02c09e0171 cc-wrapper, bintools-wrapper: simply symlink man and info outputs
See discussion in #44516.
2018-08-06 20:50:16 +00:00
Jan Malakhovski
28ad0703f3 cc-wrapper: propagate man and info to propagated-build-inputs 2018-08-05 19:20:02 +00:00
Vladimír Čunát
73959b68c2
Re-Revert "Merge #44221: default for NIX_CXXSTDLIB_COMPILE"
This reverts commit fd81a2ecb6.
Moved from master to staging.
2018-07-31 09:48:16 +02:00
Vladimír Čunát
fd81a2ecb6
Revert "Merge #44221: default for NIX_CXXSTDLIB_COMPILE"
This reverts commit 034c9816d5, reversing
changes made to 5afe87ed7a.
Huge rebuild, moving to staging.
2018-07-31 09:43:52 +02:00
Eduard-Mihai Burtescu
35e0ca9b24
Use the default for NIX_CXXSTDLIB_COMPILE even if defined (but empty). 2018-07-30 10:50:55 +03:00
Matthew Bauer
96ce1e03a4 {cc,bintools}-wrapper: also replace . in config
Some configs will have dots for version numbers. To normalize we can
just use _ again.
2018-07-28 19:54:09 -04:00
Matthew Bauer
4f6d61e5cf cc-wrapper: disable stackprotector for mingw
It seems to break things.
2018-06-23 22:05:26 -04:00
Vladimír Čunát
31530c185e
Merge a subset of staging (security)
In particular, this contains Firefox-related and libgcrypt updates.
Other larger rebuilds would apparently need lots of time to catch up
on Hydra, due to nontrivial rebuilds in other branches than staging.
2018-06-15 08:48:02 +02:00
Matthew Bauer
ad55409266 cc-wrapper: fix eval error on mac
When doing cross to linux, we will not have a GCC compiler (yet). We
can hopefully skip the cxx stdlib stuff for now.
2018-06-14 19:29:30 -04:00
Ben Wolsieffer
645f03b949 cc-wrapper, bintools-wrapper: use getHostRoleEnvHook instead of getTargetRoleEnvHook
Fixes include and link paths when cross compiling.
2018-06-03 10:54:32 -04:00
Benjamin Saunders
b0d0b1adfe clang_6: fix sanitizers under libstdc++ 2018-05-24 15:04:30 -07:00
John Ericson
205fc55ea2 Merge remote-tracking branch 'upstream/staging' into compiler-rt 2018-05-24 02:58:00 -04:00
Benjamin Saunders
46eeef1898 tests.cc-wrapper: verify building with sanitizers 2018-05-24 02:57:44 -04:00
John Ericson
5e17335bd7 Merge remote-tracking branch 'upstream/staging' into strictDeps 2018-05-14 23:33:03 -04:00
John Ericson
330ca731e8 treewide: Get rid of all uses of crossConfig
The hack of using `crossConfig` to enforce stricter handling of
dependencies is replaced with a dedicated `strictDeps` for that purpose.
(Experience has shown that my punning was a terrible idea that made more
difficult and embarrising to teach teach.)

Now that is is clear, a few packages now use `strictDeps`, to fix
various bugs:

 - bintools-wrapper and cc-wrapper
2018-05-14 23:30:37 -04:00
John Ericson
4f7cdd35d5
Merge pull request #40139 from obsidiansystems/modular-setup-hooks
treewide: Modular setup hooks
2018-05-07 15:32:10 -04:00
John Ericson
8b0fce8cb1 {bintools,cc}-wrapper: Factor out role accumulation logic 2018-05-07 15:10:45 -04:00
John Ericson
2110c0bd30 treewide: Use pkgs/build-support/roles.bash to remove copy pasta
Also fix some setup hooks that unnecessarily used environment hooks,
which revolted in the same variable being modified too many times.
2018-05-07 15:10:37 -04:00
Jan Malakhovski
82dd4501f4 bintools-wrapper, cc-wrapper: don't add targetPrefix the second time
... binutils and gcc add it already anyway.

Without this it's easy to get cross-toolchain paths longer than 256
chars and nix-daemon will then fail to commit them to /nix/store on XFS.
2018-04-26 15:06:52 +00:00
Piotr Bogdan
4707dc6454 {cc,bintools}-wrapper: fix removal of unsupported hardening flags 2018-04-14 15:16:34 +01:00
John Ericson
0884027ef5 Revert "Revert "Merge pull request #28029 from cstrahan/hardening-fix""
This reverts commit 6c064e6b1f, reapplying
PR #28029 which was supposed to have gone to staging all along.
2018-04-11 14:00:13 -04:00
Matthew Bauer
6c064e6b1f Revert "Merge pull request #28029 from cstrahan/hardening-fix"
This reverts commit 0dbc006760, reversing
changes made to cb7f774265.

Should go into staging.
2018-04-10 19:07:27 -05:00
John Ericson
0dbc006760
Merge pull request #28029 from cstrahan/hardening-fix
hardening: fix #18995
2018-04-10 19:48:02 -04:00
John Ericson
ac4d74b6d9 hardening: Reindent 2018-04-10 16:33:47 -04:00
John Ericson
21818ae592 hardening: Tiny reindent 2018-04-10 16:33:47 -04:00
John Ericson
2364c22ec9 hardening: line order, spacing, and pointless quoting for consistency 2018-04-10 16:33:47 -04:00
John Ericson
4c76d87871 hardenning: Rejigger ifs and explicit declare and unset -v 2018-04-10 16:33:47 -04:00
Charles Strahan
386e77dae9
hardening: simplify reporting of disabled flags 2018-04-10 15:27:13 -04:00
Charles Strahan
273ce83f29
hardening: make requested fixes 2018-04-10 13:04:46 -04:00
Shea Levy
c69d8bf5e6
treewide: Remove gnat support.
See discussion in 6ac7b19c97.
2018-03-08 13:56:36 -05:00
Charles Strahan
806edaa0a2
hardening: ld wrapper changes, setup-hook, etc 2018-03-06 19:21:10 -05:00
Charles Strahan
634c748050
hardening: initial cross support 2018-03-06 18:03:13 -05:00
Charles Strahan
fc46895e86
hardening: allow user supplied flags to override
Put hardening flags before user supplied flags.
2018-03-06 00:30:09 -05:00
Charles Strahan
cc7ce57f86
hardening: clarify the whitelist logic
Per @Ericson2314's suggestion [1], make it more clear that the active
hardenings are decided via whitelist; the blacklist is merely for the
debug messages.

1: 36d5ce41d4 (r133279731)
2018-03-06 00:30:09 -05:00
Charles Strahan
9920923cde
hardening: fix careless bugs
I got a substitution backwards (used '+' instead of '-').

Also, this now works under `set -u` (had to fix a couple unbound
variable references).
2018-03-06 00:30:08 -05:00
Charles Strahan
0937df463f
hardening: fix bug/typo 2018-03-06 00:30:08 -05:00
Charles Strahan
9fe17b2153
hardening: fix #18995 2018-03-06 00:30:00 -05:00
John Ericson
4a29081a94
Merge pull request #35071 from oxij/stdenv/infopages
stdenv, bash: fixing info pages and stuff
2018-02-26 18:06:11 -05:00
Jan Malakhovski
f1074211ce cc-wrapper: allow building without documentation, propagate info pages 2018-02-26 22:42:33 +00:00
Vladimír Čunát
f5ce8f86df
Revert "Merge staging at '8d490ca9934d0' into master"
This reverts commit fc23242220, reversing
changes made to 754816b84b.
We don't have many binaries yet.  Comment on the original merge commit.
2018-02-26 22:53:18 +01:00
Nikolay Amiantov
9a9c2e6579 cc-wrapper: fix bool handling for empty and zero values
Before the code would fail silently for zero values and with some output for
empties. We now currently handle both via defaulting value to zero and making
`let` return success error code when there's no syntax error.
2018-02-21 23:54:31 +03:00