installing info files in parallel is dangerous, because
`install-info` will write to a `dir-file` as a side-effect,
and it has no protection against multiple `install-info`
processes running in parallel and overwriting each others'
changes.
Local fix until we can fix the `Makefile.in` generation
upstream
Fixes#229470
This commit adds `gcc/common/checksum.nix`, which contains code
common to both gcc11 and gcc12, implementing the `enableChecksum`
feature.
When gcc's built-in bootstrap (`--enable-bootstrap`) is used, gcc
compiles itself three times and compares a hash of the unlinked `.o`
files from the second and third compilation. The
`enableChecksum=true` parameter performs the same comparison as part
of the `postInstall` phase.
Notably, `enableChecksum=true` can be used with `enableBootstrap=false`.
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
This commit has no effect on eval. It simply reorganizes the
`gcc11` and `gcc12` expressions so they apply a list of
`overrideAttrs`. The list is currently empty.
This commit updates the `buildFlags`, which is a single string with
one of four possibilities:
- ""
- "profiled"
- "bootstrap"
- "profiledbootstrap"
Previously only the last two were possible. Since
2ea3482502 all four are possible.
This commit adds an option `disableGdbPlugin` which controls whether
or not the plugin *for* GDB will be built. This plugin contains a
copy of `gcc`.
The configure flag that this option controls is called
`--disable-libcc1`. This flag name is slightly confusing: it is
used only by GDB (and apparently unmaintained), yet the flag name
does not mention GDB. This is why the option name is different from
the configure flag name.
The primary motivation for this commit is to allow the following PR
(which is not yet merged) to pass `--disable-libcc1` when building
the final native (build=host=target) compiler as part of the stdenv
bootstrap:
https://github.com/NixOS/nixpkgs/pull/209870
We need to `--disable-libcc1` in this scenario because gcc's build
machinery links `libcc1` against the `libstdc++` that is part of the
*compiler used to compile gcc*, rather than against the `libstdc++`
that is built *by* gcc. In an FHS distribution this distinction is
not terribly important because dynamically linked libraries are
late-bound (ld.so resolution). However in nixpkgs this causes a
reference back to the bootstrapFiles to leak all the way through to
the final stdenv.
More details can be found in the comment in
`pkgs/stdenv/linux/default.nix` of the PR linked above.
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Our openjdk derivations fail to build with `-march=opteron` (via
either `NIX_CFLAGS_COMPILE` or `hostPlatform.gcc.arch`). This was
fixed upstream in gcc12 but not carried back to gcc11:
https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=d243f4009d8071b734df16cd70f4c5d09a373769https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103910
Since gcc11 is still nixpkgs' primary compiler, this PR cherry-picks
the fix out of gcc12.
Unfortunately since `-march=` can be added after the `gcc11`
derivation is built we can't apply this patch conditionally (which
we don't usually do anyways).
This reverts commit 2c931bd5f4.
The https://github.com/NixOS/nixpkgs/pull/209153 reverted --sysroot=/
change as it broke other astects of library search paths.
While it might still be useful to pull in gcc libraries when
non-standard --sysroot= is passed there are no meaningful use cases of
it in `nixpkgs` yet. Let's revert it for now.
With all libcs I'm aware of, libdl is now either empty (Glibc, musl,
uclibc, illumos), a symlink to libc or equivalent (Apple), or does not
exist (FreeBSD, NetBSD). So explicitly linking libdl now does nothing
for the former platforms, and breaks the build for the latter
platforms.
With this patch I've removed -ldl from all overridden linker flags for
all free packages in Nixpkgs. Everything still seems to build.
LLVM does not provide a drop-in replacement for as(1).
This makes it possible to build a GNU Fortran cross compiler from GNU
to LLVM — e.g. buildPackages.gfortran for
{ system = "aarch64-linux"; useLLVM = true; }
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80431
This bug annoys me because I hit it when working on Nix. It causes
miscompilations in such a way that I am hard-pressed to think how a
program could inadvertainly rely on the bug (such that it would be
broken by the fix).
The bug is longstanding, and the (quite small) applies without
modification to many older GCCs. I have confirmed by running the test in
that commit that does indeed fix the bug with the backports too.
I would like to use --sysroot=/nix/store/does/not/exist hack
for both `gcc` and `clang` drivers to remove default include
(and library) search paths when we override them with libc.
For `gcc` it works as is. But for `clang` it also drops some of
`gcc` search paths`. Let'sconsider 2 lookups.
Successful lookup (no `--sysroot`):
$ printf "int main(){}" | clang++ -x c++ - -Wl,--verbose |& grep -F stdc++
attempt to open /nix/store/...-gcc-11.3.0/lib/gcc/x86_64-unknown-linux-gnu/11.3.0/libstdc++.so failed
attempt to open /nix/store/...-gcc-11.3.0-lib/x86_64-unknown-linux-gnu/lib/libstdc++.so failed
attempt to open /nix/store/...-clang-11.1.0-lib/lib/libstdc++.so failed
attempt to open /nix/store/...-gcc-11.3.0/lib64/gcc/x86_64-unknown-linux-gnu/11.3.0/libstdc++.so failed
attempt to open /nix/store/...-gcc-11.3.0/lib64/gcc/x86_64-unknown-linux-gnu/11.3.0/../../../../lib64/libstdc++.so failed
/nix/store/...-gcc-11.3.0/lib64/gcc/x86_64-unknown-linux-gnu/11.3.0/../../../../lib64/libstdc++.a
Failed lookup (has `--sysroot`):
$ printf "int main(){}" | clang++ --sysroot=/does/not/exist -x c++ - -Wl,--verbose |& grep -F stdc++
attempt to open /nix/store/...-gcc-11.3.0/lib/gcc/x86_64-unknown-linux-gnu/11.3.0/libstdc++.so failed
attempt to open /nix/store/...-gcc-11.3.0-lib/x86_64-unknown-linux-gnu/lib/libstdc++.so failed
attempt to open /nix/store/...-clang-11.1.0-lib/lib/libstdc++.so failed
attempt to open /nix/store/...-gcc-11.3.0/lib64/gcc/x86_64-unknown-linux-gnu/11.3.0/libstdc++.so failed
/nix/store/...-binutils-2.39/bin/ld: cannot find -lstdc++: No such file or directory
Note how `clang` starts the search roughly from
`gcc-11.3.0-lib/x86_64-unknown-linux-gnu/lib` in both cases. I think
it's our preferred location for both native and cross cases.
The change adds such a symlink:
`gcc-11.3.0-lib` -> `gcc-11.3.0-lib/x86_64-unknown-linux-gnu`
Fixes build failure on `staging-next` introduced by commit c817efe6
("gcc: extend stripping of .a libraries and .o objects"):
...-bootstrap-stage3-stdenv-linux/setup: line 106: pushd: no other directory
Build failure happens because `libgccjit` has different `outputs` layout
compared to the rest of `gcc` derivations:
outputs = [ "out" "man" "info" ] ++ lib.optional (!langJit) "lib";
The change carves out `$lib` lib handling part to avoid `gcc` rebuild
in `staging-next`.
This commit factors out the conditional which creates the `lib64->lib`
symlink in the `preInstall` phase, and calculates its value in nix
code rather than bash code so touching it doesn't cause a global
rebuild on every platform.