Commit Graph

40 Commits

Author SHA1 Message Date
Sergei Trofimovich
ea8e124000 gcc: always enable inhibit_libc=true for --without-headers builds
It's a follow-up to the breakage caused by 21966e13d2
("gcc: pass --with-build-sysroot=/"). It caused `pkgsLLVM`
cross-toolchain bootstrap breakage:

    $ nix build --no-link -f. pkgsLLVM.hello
    ...
    failed: /nix/store/...-x86_64-unknown-linux-gnu-stage-static-gcc-13.0.0.drv:
    ...
    configure flags: ... --enable-languages=c --disable-multilib \
      --disable-shared --enable-plugin ... --disable-libssp --disable-nls \
      --without-headers --disable-threads --disable-libgomp --disable-libquadmath \
      --disable-shared --disable-libatomic --disable-decimal-float --disable-libmpx \
      --disable-bootstrap \
      \
      --build=x86_64-unknown-linux-gnu \
      --host=x86_64-unknown-linux-gnu \
      --target=x86_64-unknown-linux-gnu
    ...
    The directory that should contain system headers does not exist:
      /usr/include
    make[2]: *** [Makefile:3279: stmp-fixinc] Error 1 shuffle=1658621302
    rm gfdl.pod gcc.pod gcov-dump.pod gcov-tool.pod fsf-funding.pod gpl.pod cpp.pod gcov.pod lto-dump.pod
    make[2]: Leaving directory '/build/build/gcc'

Note: it's a no-libc build. It's not expected to use any libc headers.
But in this case fixincludes tries to run and uses default /usr/include
location.

Fixinsludes is not normally expected to run during cross-compilation
on --without-headers. gcc/configure.ac:

    : ${inhibit_libc=false}
    if { { test x$host != x$target && test "x$with_sysroot" = x ; } ||
           test x$with_newlib = xyes ; } &&
         { test "x$with_headers" = xno || test ! -f "$target_header_dir/stdio.h"; } ; then
           inhibit_libc=true
    fi

The change explicitly passes inhibit_libc=true to configure to disable
include fixing on such cases.

Fixed `nix build --no-link -f. pkgsLLVM.hello` toolchain bootstrap.
2022-07-24 09:54:49 +01:00
Vladimír Čunát
3f88d51e02
gcc10: 10.3.0 -> 10.4.0
Patches: the two seemed included in the release;
I also checked that the conditional patches still all apply.
2022-06-29 10:07:32 +02:00
Francesco Gazzetta
6436bdeb7f gcc: add langD support to gcc 10 2022-05-23 16:09:25 +02:00
Malo Bourgon
0d0feaa4fc gcc{4..10}: add aarch64-darwin to badPlatforms 2022-04-14 10:02:19 -07:00
Simon Chatterjee
9b310e61b4 gcc10: fix cross-compilation from aarch64-darwin host
Without this patch, linking when cross-compiling fails:

    Undefined symbols for architecture arm64:
      "_host_hooks", referenced from:
          gt_pch_save(__sFILE*) in libbackend.a(ggc-common.o)
          gt_pch_restore(__sFILE*) in libbackend.a(ggc-common.o)
          toplev::main(int, char**) in libbackend.a(toplev.o)
    ld: symbol(s) not found for architecture arm64
2022-04-06 21:55:56 +01:00
John Ericson
ed07c3b1a2
Merge pull request #163489 from alyssais/gcc-static-lib
pkgsStatic.stdenv.cc.cc: put static libs in $lib
2022-03-22 22:07:50 -04:00
Alyssa Ross
12c37aec37
pkgsStatic.stdenv.cc.cc: put static libs in $lib
libtool requires the library files its .la files describe to be in the
same directory as those files.  We only do this for compilers without
shared libraries, so that the libraries in $lib are always the
libraries the package set is supposed to use.

Fixes: https://github.com/NixOS/nixpkgs/issues/76873
Fixes: https://github.com/NixOS/nixpkgs/issues/108534
2022-03-22 17:56:11 +00:00
Alyssa Ross
c6dd11ca39
Revert "gcc: Always pass --enable-shared by default"
This reverts commit 8e48232180.

Since pkgsStatic.stdenv.cc can only produce static binaries, there's
no reason to include that compilers e.g. libstdc++.so.
2022-03-22 17:56:08 +00:00
github-actions[bot]
e452d308f5
Merge staging-next into staging 2022-03-22 12:02:02 +00:00
Alyssa Ross
cb040db7ab pkgsStatic.gcc: fix build
LTO requires building a compiler plugin, which is a shared object.

The closure is a bit wild but it builds and can compile programs.
2022-03-22 10:52:36 +00:00
Maximilian Bosch
e10ea9608a
gcc{7,9,10}: apply patches for asan w/glibc-2.34
This should fix a few broken cc-wrapper tests that also check for
libasan[1][2][3]:

    [...]
    checking whether sanitizers are fully functional... ==243==ERROR: AddressSanitizer failed to allocate 0x0 (0) bytes of SetAlternateSignalStack (error code: 22)
    [...]

The underlying issue is that `SIGSTKSZ` isn't a compile-time constant
anymore, but in this case the uninitialized `kAltStackSize` was
initialized early enough to evalute to `0`[4].

The issue is already fixed in gcc11 and there's  GCC 8.5 which also
contains the patch, however the backports to v9 and v10 aren't released
yet, so we have to apply patches on our own here.

For GCC 7.5 I applied the patch from gcc8 as it doesn't seem as if
there's an official upstream backport.

[1] https://hydra.nixos.org/build/163102264
[2] https://hydra.nixos.org/build/163624687
[3] https://hydra.nixos.org/build/163619227
[4] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100114
2022-02-27 10:26:58 +01:00
oxalica
0d1750e9c0
gcc{10,11}: add no-sys-dir patch for RiscV
RiscV has an individual STARTFILE_PREFIX_SPEC macro which also need to
be patched.
2021-11-30 16:58:45 +08:00
Sergei Trofimovich
974e68a7ad gcc: remove <cyclades.h> from libsanitizer
linux-headers-5.13 removed <cyclades.h> along with device support.
Backport a single https://gcc.gnu.org/PR100379  upstream change to
fix gcc build.

Use local (unmodified) upstream patches to avoid fetchpatch dependency.
2021-09-20 19:37:19 +01:00
sternenseemann
d01533ceab pkgsCross.avr.buildPackages.gcc{10,11}: avoid log limit on hydra
When upgrading from gcc 9 to 10, avr-gcc started to hit the hydra log
limit, preventing the binary cache from being populated.

This commit tries to workaround this issue by passing `-s` to make for
avr-gcc 10 and 11 which seem to exhibit this problem.

Reference #135605.
2021-08-26 00:36:58 +02:00
sternenseemann
d3e05d191f gnat{6,9,10,11}: move gnatboot into nativeBuildInputs 2021-07-28 12:44:49 +02:00
Alyssa Ross
77f3a9a3aa gcc: broaden platforms
Okay, GCC might not technically support _every_ platform in
platforms.unix, but I think it would be easier to subtract those as
they're discovered, if that even matters, rather than trying to
exhaustively list every Unix it does support.

(I ran into this because I wanted to build GCC for NetBSD, which it
definitely supports.)
2021-06-09 10:28:01 +00:00
Patrick Hilhorst
c913e53bdb
gcc*: use maintainer team 2021-05-24 15:01:05 +02:00
Jonathan Ringer
f7a112f6c4
Merge remote-tracking branch 'origin/master' into staging-next
Conflicts:
  pkgs/applications/graphics/emulsion/default.nix
  pkgs/development/tools/misc/texlab/default.nix
  pkgs/development/tools/rust/bindgen/default.nix
  pkgs/development/tools/rust/cargo-udeps/default.nix
  pkgs/misc/emulators/ruffle/default.nix
  pkgs/tools/misc/code-minimap/default.nix
2021-05-18 08:57:16 -07:00
sternenseemann
2d176b593b gcc*: force building a cross compiler if host and target platform differ
gcc's configure system has the nasty habit (for us) of judging for
itself if it is building a cross compiler (or cross compiling), but on
the limited information of the build, host and target platforms' config
which only contains a subset of the information we encode in
`stdenv.*Platform`. The practical consequence was that prior to this
change building `pkgsLLVM.buildPackages.gcc` actually fails because it
refuses to use `--with-headers` with something it believes to not be a
cross compiler.

As a workaround we force the appropriate variable in the configure
script to always be `yes` regardless of its own conditional check.

At some point we probably should report this issue in some capacity, so
future gcc versions don't force us into workarounds like this and
acdc783418.
2021-05-18 00:16:54 +02:00
Ivan Babrou
99d0c004d1 gcc6, gcc7, gcc8, gcc9, gcc10, gcc11: do not modify code in prePatch
Doing any modifications before patching risks invalidating patch base.
2021-05-04 22:53:21 -07:00
Vladimír Čunát
537d9687d1
Merge #119219: gcc10: 10.2 -> 10.3 (into staging) 2021-04-29 10:38:18 +02:00
Arnout Engelen
48c952c039
Merge pull request #112928 from baloo/baloo/gcc/reproducible
stdenv: provide a deterministically built gcc
2021-04-26 11:07:34 +02:00
sternenseemann
acdc783418 gcc*: always force --program-prefix and pass --target
Don't rely on gcc detecting from the passed platforms which prefix to
use, but always specify the prefix nixpkgs expects (or doesn't). This
allows us to work around problems where the configure script would add
prefix where nixpkgs doesn't expect one (if `--target` was specified,
but the same as `--host`) or doesn't add one if nixpkgs expects one (if
`--target` and `--host` are the same, but we are actually cross
compiling, but the relevant parts of the platform are not encoded into
the platform config.

See also ca9be0511b.
2021-04-16 22:54:05 +02:00
Tobias Mayer
d09936ea84
gcc10: 10.2 -> 10.3 2021-04-12 12:22:31 +02:00
Arthur Gautier
a961aeadae stdenv: provide a deterministically built gcc
Signed-off-by: Arthur Gautier <baloo@superbaloo.net>
2021-03-01 05:06:39 +00:00
adisbladis
a439e0ef6e
gcc10: Pass langJit to preConfigure
This should fix libgccjit on darwin.
2021-02-26 12:10:44 +02:00
github-actions[bot]
2137c13b40
Merge master into staging-next 2021-01-27 12:24:05 +00:00
Ben Siraphob
3bbad8b041 treewide: remove inherited stdenv.lib 2021-01-27 12:44:43 +07:00
github-actions[bot]
58752914f4
Merge master into staging-next 2021-01-23 12:40:13 +00:00
Ben Siraphob
acc5f7b18a pkgs/development/compilers: stdenv.lib -> lib 2021-01-23 08:57:37 +07:00
Matthew Bauer
4bdcddf9aa gcc: allow stripping gcc libraries
When cross compiling to the same kernel / arch combination, it is safe
to use strip of libraries. This happens when cross-compiling musl
programs. dontStrip is now set in each gcc compiler instead of in
gcc/builder.sh.

Fixes #75476
2021-01-21 16:25:48 -06:00
Kira Bruneau
f0c6e40948 gcc10: fix MinGW build & use local copy of mcfgthread patches 2021-01-03 23:04:37 -05:00
John Ericson
8e48232180 gcc: Always pass --enable-shared by default
I am actually a bit skeptical about this, but @matthewbauer makes the
case for this in
https://github.com/NixOS/nixpkgs/pull/107238#discussion_r546454453 and
I'm happy to go with it not being as in the loop on static linking stuff
as he is.
2021-01-03 19:19:09 +00:00
John Ericson
f52263ced0 treewide: Start to break up static overlay
We can use use `stdenv.hostPlatform.isStatic` instead, and move the
logic per package. The least opionated benefit of this is that it makes
it much easier to replace packages with modified ones, as there is no
longer any issue of overlay order.

CC @FRidh @matthewbauer
2021-01-03 19:18:16 +00:00
John Ericson
0df75bc04e gcc 8, 10: tabs -> spaces 2021-01-03 19:14:56 +00:00
Vladimír Čunát
51ccf2d4ba
gcc10: 10.1.0 -> 10.2.0
It's supposed to be just bugfixes.  I tested building some projects with
gcc10.  Also gfortran10 still builds.  I don't expect issues.
This causes basically no rebuilds, as we use 9 by default.
2020-09-12 11:54:39 +02:00
Matthew Bauer
0b8312660a gcc10: fix building darwin->linux cross compiler
same as 459c60dda2 but for gcc10
2020-08-26 16:15:05 -05: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
Cole Helbling
f7a93031a2
gcc10: fix eval due to missing langJit
The libgccjit PR was merged after the one introducing gcc10, thus
staging fails to eval because of the missing `langJit` argument.
2020-05-11 16:49:19 -07:00
Vladimír Čunát
da59984d36
gcc10, gfortran10, gnat10: init at 10.1.0
Everything is copied as-is from 9 (except version and hash).
Some platform-specific patches might not apply anymore;
I'm lazily leaving that for the community to fix.
2020-05-08 07:49:35 +02:00