nixpkgs/pkgs/development/compilers
Sergei Trofimovich 34636efced gcc: pass --with-build-sysroot=/ for gcc builds
Without this change cross-built gcc fails to detect stack protector style:

    $ nix log -f pkgs/stdenv/linux/make-bootstrap-tools-cross.nix powerpc64le.bootGCC | fgrep __stack_chk_fail
    checking __stack_chk_fail in target C library... no
    checking __stack_chk_fail in target C library... no

It happens because gcc treats search paths differently:

    https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/configure.ac;h=446747311a6aec3c810ad6aa4190f7bd383b94f7;hb=HEAD#l2458

     if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x ||
        test x$build != x$host || test "x$with_build_sysroot" != x; then
       ...
       if test "x$with_build_sysroot" != "x"; then
         target_header_dir="${with_build_sysroot}${native_system_header_dir}"
       elif test "x$with_sysroot" = x; then
         target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-include"
       elif test "x$with_sysroot" = xyes; then
         target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-root${native_system_header_dir}"
       else
         target_header_dir="${with_sysroot}${native_system_header_dir}"
       fi
     else
       target_header_dir=${native_system_header_dir}
     fi

By passing --with-build-sysroot=/ we trick cross-case to use
`target_header_dir="${with_sysroot}${native_system_header_dir}"`
which makes it equivalent to non-cross
`target_header_dir="${with_build_sysroot}${native_system_header_dir}"`

Tested the following setups:
- cross-compiler without libc headers (powerpc64le-static)
- cross-compiler with libc headers (powerpc64le-debug)
- cross-build compiler with libc headers (powerpc64le bootstrapTools)

Before the change only 2 of 3 compilers detected libc headers.
After the change all 3 compilers detected libc headers.

For darwin we silently ignore '-syslibroot //' argument as it does not
introduce impurities.

While at it dropped mingw special case for no-libc build. Before the change
we passed both '--without-headers --with-native-system-headers-dir' for
no-libc gcc-static builds. This tricked darwin builds to find sys/sdt.h
and fail inhibid_libc builds. Now all targets avoid passing native headers
for gcc-static builds.

While at it fixed correct headers passing to
--with-native-system-headers-dir= in host != target case: we were passing
host's headers where intention was to pass target's headers.
Noticed the mismatch as a build failure on pkgsCross.powernv.stdenv.cc
on darwin where `sys/sdt.h` is present in host's headers (libSystem)
but not target's headers (`glibc`).

Co-authored-by: Adam Joseph <54836058+amjoseph-nixpkgs@users.noreply.github.com>
2022-07-23 18:40:07 +01:00
..
4th 4th: 3.62.5 -> 3.64.0 2022-03-15 17:01:21 -03:00
abcl abcl: 1.8.0 -> 1.9.0 2022-05-25 05:16:18 +00:00
acme acme: unstable-2021-02-14 -> unstable-2021-11-05 2022-05-12 17:35:04 +02:00
adoptopenjdk-bin adoptopenjdk-bin: mark meta.sourceProvenance 2022-06-13 18:55:15 +08:00
adoptopenjdk-icedtea-web adoptopenjdk-icedtea-web: 1.8.7 -> 1.8.8 2022-01-02 16:48:11 +01:00
alan alan_2: add -fcommon workaround for gcc-10 2022-05-12 08:22:23 +01:00
algol68g treewide: add meta.mainProgram to many packages 2022-04-14 10:24:01 -07:00
apache-flex-sdk treewide: use mirror URLs where available 2021-11-06 01:56:39 +00:00
arachne-pnr
armips armips: init at 0.11.0 2021-06-13 11:31:44 +02:00
as31 as31: init at 2.3.1 2021-09-05 23:22:37 -03:00
asl asl: fix the expression 2021-11-03 13:33:56 -03:00
aspectj treewide: set sourceProvenance for packages containing downloaded jars 2022-06-04 19:47:57 +01:00
atasm atasm: init at 1.09 2021-09-09 17:48:34 -03:00
ats
ats2 ats2: 0.4.1 -> 0.4.2 2022-04-26 15:04:13 -05:00
avra avra: 1.3.0 -> 1.4.2 2022-01-20 19:25:45 +01:00
bigloo bigloo: mark broken on x86_64 Darwin 2022-05-29 10:56:03 +02:00
binaryen binaryen: backport patch for wasm2js 2022-06-24 15:02:39 -04:00
blueprint blueprint-compiler: 2022-05-27 -> 0.2.0 2022-07-01 23:51:58 +08:00
bluespec bluespec: 2021.07 -> 2022.01 2022-04-09 11:29:27 -07:00
bs-platform bs-platform: workaround -fno-common build failure on aarch64 2022-06-26 22:29:26 +01:00
bupc treewide: remove nativeBuildInputs that are in stdenv 2022-04-16 21:46:46 +03:00
c3c c3c: init at unstable-2021-07-30 2021-07-31 13:14:50 +02:00
cakelisp
carp carp: 0.5.4 -> 0.5.5 2022-07-08 04:57:18 +00:00
cc65 cc65: enable parallel building 2021-06-07 21:13:21 +07:00
ccl maintainers: remove muflax 2022-06-29 00:52:12 +02:00
chez Merge branch 'master' into staging-next-2022-04-23 2022-05-01 14:26:52 +02:00
chez-racket chez-racket: Fix signing on Darwin (Thanks @Steven0351!) 2021-12-23 21:14:28 +00:00
chicken chickenPackages: recurse into attrs 2022-05-04 12:02:09 +02:00
ciao ciao: 1.20.0 -> 1.21.0-m1 2022-03-08 03:00:31 +00:00
clasp clasp: use python3 2021-07-27 20:37:04 +02:00
clean
closure Merge pull request #174450 from r-ryantm/auto-update/closure-compiler 2022-06-11 01:24:34 +03:00
cmdstan treewide: pkgs/development: mark broken for aarch64-linux 2022-05-30 13:42:59 +02:00
cmucl
colm
computecpp
cone cone: init at unstable-2021-07-25 2021-07-30 13:35:43 +02:00
copper copper: 4.4 -> 4.6 2021-12-12 14:13:58 +01:00
crystal treewide: mark broken for darwin 2022-05-30 13:42:58 +02:00
crystal2nix crystal2nix: 0.1.1 -> 0.3.0 2022-07-12 21:00:11 +08:00
cudatoolkit cudaPackages_11_6: better message on why gcc10 2022-04-21 01:25:33 +03:00
dale
dasm
dev86 dev86: explicitly disable build parallelism due to missing depends 2021-11-13 21:41:51 +00:00
dictu dictu: 0.23.0 -> 0.24.0 2022-03-07 04:08:14 +00:00
dmd dmd: Fix grep in test after gdb bump 2022-06-18 12:03:55 +02:00
dotnet dotnet: fix compilation on darwin 2022-07-17 13:35:26 -07:00
dtc dtc: fix static building 2022-06-30 07:39:30 +00:00
ecl treewide: move autoconf, automake to nativeBuildInputs 2022-03-30 20:17:24 -05:00
edk2 edk2: fix cross compilation 2022-05-14 12:00:00 +00:00
eli eli: add -fcommon workaround 2022-06-04 06:51:58 +01:00
elm elmPackages: semi-automatic update of nodejs packages 2022-07-10 11:33:02 +02:00
emscripten emscripten: 3.1.14 -> 3.1.15 2022-07-13 09:09:26 -04:00
eql treewide: replace '-git' packages with 'unstable-' in version (#145396) 2021-11-10 16:21:47 -05:00
factor-lang factor98: add longDescription 2021-11-26 10:22:03 -03:00
fasm fasm: 1.73.29 -> 1.73.30 2022-03-08 10:31:59 +00:00
fasmg
fennel fennel: 1.0.0 -> 1.1.0 2022-04-11 08:23:49 +00:00
firrtl firrtl: init at 1.5.3 (#171065) 2022-05-29 12:19:51 -05:00
flasm flasm: pull patch pending upstream inclusion for -fno-common toolchains 2022-05-15 10:18:31 +01:00
flutter flutter.dart: 2.16.1 -> 2.16.2 2022-05-13 17:02:03 +02:00
flux
fpc Merge pull request #178134 from qsimpleq/lazarus_2.2.2-0 2022-06-18 12:40:54 +00:00
fsharp treewide: move autoconf, automake to nativeBuildInputs 2022-03-30 20:17:24 -05:00
fstar ocamlPackages: rename sedlex_2 into sedlex 2022-05-29 08:48:00 +02:00
gambit treewide: use lib.getLib for OpenSSL libraries 2022-03-30 15:10:00 +00:00
gavrasm gavrasm: 4.5 -> 5.1 2022-01-20 19:24:13 +01:00
gcc gcc: pass --with-build-sysroot=/ for gcc builds 2022-07-23 18:40:07 +01:00
gcc-arm-embedded gcc-arm-embedded-{6,7,8}: enable on aarch64-darwin 2021-12-05 23:35:52 +01:00
gcl gcl: add -fcommon workaround 2022-06-08 08:38:15 +01:00
gerbil gerbil: disable stackprotector on aarch64-darwin for now 2021-12-22 11:10:08 -05:00
gforth gforth: unmark broken on darwin 2022-06-11 19:13:40 +01:00
ghc Merge branch 'master' into staging-next 2022-07-07 18:50:02 +02:00
ghcjs haskell.packages.ghcjs.ghcjs-base: 0.2.0.3 → 0.2.1.0 2022-06-13 10:34:00 +02:00
ghdl gnat: 9 -> 11 2021-11-15 22:41:56 +01:00
gleam gleam: 0.20.1 -> 0.21.0 2022-05-26 08:26:30 -04:00
glslang Vulkan: 1.2.198.0 -> 1.3.211.0 2022-04-26 21:38:50 -04:00
gmqcc gmqcc: init at unstable-2021-07-09 2022-06-08 15:51:58 +02:00
gnatboot gnatboot: 4.1 -> 11.2.0-4 (#177579) 2022-07-14 14:14:58 +02:00
gnu-cobol
gnu-smalltalk
go Merge pull request #181284 from qowoz/go117 2022-07-16 02:44:02 +02:00
go-jsonnet treewide: testVersion -> testers.testVersion 2022-04-22 16:24:27 +03:00
gprolog Drop myself from meta.maintainers for most packages. 2021-10-14 11:01:27 +02:00
graalvm/community-edition maintainers: remove volth 2022-06-29 00:52:12 +02:00
gwt pkgs/development: rename name to pname&version 2021-11-30 21:32:28 +01:00
halide
hare hare: set HARECACHE in setupHook 2022-06-23 14:37:11 +00:00
haxe ocamlPackages: rename sedlex_2 into sedlex 2022-05-29 08:48:00 +02:00
hip hip: 5.0.2 -> 5.1.1 2022-05-05 18:36:00 +02:00
hop hop: 3.3.0 -> 3.4.4 2021-08-14 03:34:53 +03:00
idris2 Idris2: Refactor default.nix 2022-01-10 22:01:42 +01:00
inform6
inform7 treewide: pkgs/development: mark broken for aarch64-linux 2022-05-30 13:42:59 +02:00
inklecate inklecate: update dependencies 2022-06-17 10:12:43 +02:00
intel-graphics-compiler intel-graphics-compiler: move substitutes to postPatch 2022-05-05 15:27:48 -07:00
intercal intercal: fix build on -fno-common toolchains 2022-05-21 10:59:28 +01:00
ios-cross-compile treewide: move autoconf, automake to nativeBuildInputs 2022-03-30 20:17:24 -05:00
ispc ispc: unstable-2021-04-02 -> 1.18.0, (co-)maintain 2022-06-02 15:01:26 +02:00
jasmin
jasmin-compiler jasmin-compiler: 21.0 → 2022.04.0 2022-05-13 14:08:29 +02:00
javacard-devkit treewide: set sourceProvenance for packages containing downloaded jars 2022-06-04 19:47:57 +01:00
jetbrains-jdk maintainers: remove petabyteboy 2022-06-29 00:52:12 +02:00
jrsonnet jrsonnet: mark as broken on darwin 2022-01-21 07:08:20 -05:00
jsonnet jsonnet: 0.17.0 -> 0.18.0 2022-01-06 17:02:01 +01:00
julia julia_17-bin: 1.7.2 -> 1.7.3 2022-05-26 12:38:26 +02:00
juniper Remove wunderbrick from juniper maintainers 2022-06-18 12:54:08 -04:00
jwasm treewide: pkgs/development/compilers: mark broken for darwin 2022-05-30 13:41:09 +02:00
kaitai-struct-compiler katai-struct-compiler: init at 0.9 2021-12-07 16:31:22 +01:00
koka koka: 2.3.8 -> 2.4.0 2022-06-01 10:24:15 +02:00
kotlin kotlin-native: 1.7.0 → 1.7.10 2022-07-08 16:29:10 -05:00
ldc treewide: autoPatchelfHook only on Linux 2022-03-23 21:37:39 +01:00
ligo Add Jane Street ocaml packages version 0.15 2022-07-07 00:32:11 -04:00
lingua-franca treewide: set sourceProvenance for packages containing downloaded jars 2022-06-04 19:47:57 +01:00
llvm clang_14: drop out-of-date armv7l patch 2022-06-20 15:37:47 +03:00
lobster treewide: pkgs/development/compilers: mark broken for darwin 2022-05-30 13:41:09 +02:00
manticore
marst marst: init at 2.7 2021-07-29 05:17:12 -03:00
matter-compiler
mcpp
mercury mercury: 20.06.1 -> 22.01.1 2022-05-13 08:48:16 +10:00
meta-environment/meta-build-env development/{arduino/compilers/interpreters}: replace name with pname&version 2021-08-21 23:02:55 +02:00
mezzo ocamlPackages.pprint: 20171003 → 20220103 2022-02-15 07:25:24 +01:00
microscheme microscheme: fix meta.homepage 2021-12-31 11:17:07 -08:00
mint mint: 0.14.0 -> 0.15.1 2021-12-25 17:58:07 +00:00
miranda miranda: add -fcommon workaround 2022-05-22 11:21:35 +01:00
mit-scheme treewide: rename name to pname&version 2022-03-08 13:24:25 +01:00
mkcl treewide: pkgs/development: mark broken for aarch64-linux 2022-05-30 13:42:59 +02:00
mlkit mlkit: 4.5.9 -> 4.6.1 2022-07-09 04:20:00 +00:00
mlton mlton: 20180207 → 20210107 2022-06-07 13:34:26 +07:00
mono mono: 6.12.0.122 -> 6.12.0.182 2022-07-11 14:12:10 +08:00
mosml mosml: switch to fetchFromGitHub 2022-01-08 15:38:10 +01:00
mozart mozart2: fix build. 2022-06-08 09:32:08 -03:00
mruby mruby: 3.0.0 -> 3.1.0 2022-05-14 01:01:08 +01:00
mrustc mrustc: fixup build 2022-04-17 10:14:55 +02:00
muonlang move muon to muonlang 2022-04-12 22:38:36 -03:00
myrddin treewide: pkgs/development: mark broken for aarch64-linux 2022-05-30 13:42:59 +02:00
nasm
neko
nextpnr nextpnr: 2022.01.03 -> 0.3 2022-04-14 13:08:25 +02:00
nim nim: 1.6.4 -> 1.6.6 2022-05-09 13:34:07 -05:00
nvidia-cg-toolkit treewide: change some glibc to stdenv.cc.libc 2022-05-27 05:57:43 +03:00
obliv-c obliv-c: 0.0pre20180624 → 0.0pre20210621 2022-04-02 07:59:52 +02:00
ocaml ocaml-ng.ocamlPackages_4_00_1.ocaml, ocaml-ng.ocamlPackages_4_08.ocaml: add -fcommon workaround 2022-05-28 13:37:55 +01:00
odin odin: init at 0.13.0 2021-07-05 22:52:59 +02:00
opa maintainers: remove kkallio 2022-06-29 00:55:00 +02:00
open-watcom open-watcom-v2-unwrapped: unstable-2022-05-03 -> unstable-2022-05-04 2022-05-06 08:55:39 +00:00
opendylan treewide: remove nativeBuildInputs that are in stdenv 2022-04-16 21:46:46 +03:00
openjdk openjfx11, openjfx15: add -fcommon workaround 2022-06-03 13:48:50 +01:00
openspin
ophis
oraclejdk oraclejdk*: remove appendToName to have a consistent package name for repology 2022-02-28 15:24:31 +01:00
orc orc: disable a benchmark test on x86_64-darwin 2022-01-22 08:26:56 +01:00
osl treewide: pkgs/development: mark broken for aarch64-linux 2022-05-30 13:42:59 +02:00
owl-lisp
paco
pakcs maintainers: remove kkallio 2022-06-29 00:55:00 +02:00
passerine passerine: 0.9.2 → 0.9.3 2022-02-20 00:50:50 +01:00
pforth
picat
polyml polyml: remove already applied patch 2022-03-25 19:31:57 -06:00
ponyc pony-corral: 0.5.7 -> 0.6.0 2022-06-25 14:53:56 +00:00
purescript Merge pull request #181915 from r-ryantm/auto-update/purescript 2022-07-18 17:15:06 +09:00
qbe qbe: unstable-2022-04-11 -> 1.0 2022-06-25 15:55:45 +02:00
rasm rasm: Fix the source URL 2021-07-21 10:23:35 +02:00
reason reason: 3.7.0 → 3.8.0 2022-03-11 16:11:08 +01:00
rgbds rgbds: 0.5.1 -> 0.5.2 2022-01-03 11:28:52 +01:00
roslyn roslyn: rename name to pname 2022-03-01 12:24:28 +01:00
rust rustc: mark broken for dynamic Musl target 2022-07-02 09:04:37 +00:00
sagittarius-scheme treewide: pkgs/development/compilers: mark broken for darwin 2022-05-30 13:41:09 +02:00
sbcl sbcl: pull darwin fix pending upstream inclusion for -fno-common toolchains 2022-07-02 18:53:43 +01:00
scala dotty: rename to scala_3 2022-05-05 11:32:30 +02:00
scala-runners treewide: fix /bin/coursier references 2021-10-28 19:48:29 -05:00
scryer-prolog treewide: pkgs/development/compilers: mark broken for darwin 2022-05-30 13:41:09 +02:00
sdcc sdcc: 4.1.0 -> 4.2.0 2022-03-15 12:27:21 +01:00
seexpr seexpr: fmt 2021-11-16 23:39:27 +01:00
serpent remove chris-martin from maintainer list on various crypto packages 2021-06-06 02:38:34 -06:00
shaderc libtool: add meta.platforms and make cctools Darwin only 2021-11-22 09:42:23 -08:00
sjasmplus sjasmplus: 1.18.2 -> 1.18.3 2021-09-14 23:10:43 +00:00
smlnj smlnj,smlnjBootstrap: set meta.mainProgram 2022-05-28 14:48:53 +03:00
solc solc: add darwin binary for now 2022-05-03 07:58:58 -04:00
souffle treewide: pkgs/development/compilers: mark broken for darwin 2022-05-30 13:41:09 +02:00
spasm-ng
spirv-llvm-translator spirv-llvm-translator: fix duplicate makeFlags merge 2022-05-06 10:30:03 +02:00
squeak squeak: add -fcommon workaround 2022-06-09 21:38:39 -05:00
stalin development/{arduino/compilers/interpreters}: replace name with pname&version 2021-08-21 23:02:55 +02:00
swi-prolog swi-prolog: 8.3.9 -> 8.3.29 2021-09-07 23:09:12 -05:00
swift swift: mark broken 2022-05-30 13:42:59 +02:00
terra terra: 1.0.0-beta5 -> 1.0.4 2022-07-08 16:25:48 -07:00
teyjus teyjus: switch to fetchFromGitHub 2022-01-08 15:38:10 +01:00
tinycc treewide: pkgs/development/compilers: mark broken for darwin 2022-05-30 13:41:09 +02:00
tinygo tinygo: 0.16.0 -> 0.23.0 2022-05-20 00:37:01 +03:00
tvm tvm: 0.7.0 -> 0.8.0 2022-02-13 11:13:22 +00:00
uasm treewide: testVersion -> testers.testVersion 2022-04-22 16:24:27 +03:00
unison unison: M2l -> M3 2022-06-27 22:39:48 +03:00
urn treewide: rename name to pname&version 2022-03-08 13:24:25 +01:00
urweb treewide: use lib.getLib for OpenSSL libraries 2022-03-30 15:10:00 +00:00
vala vala: fix cross 2022-06-13 04:45:43 +03:00
vlang vlang: 2022.19 -> 2022.20 2022-05-17 06:23:29 -05:00
vyper python310Packages.vyper: mark insecure 2022-06-21 22:21:50 +00:00
wcc
wla-dx
x11basic treewide: move autoconf, automake to nativeBuildInputs 2022-03-30 20:17:24 -05:00
xa xa: 2.3.11 -> 2.3.12 2022-01-04 01:57:33 -03:00
yap treewide: pkgs/development: mark broken for aarch64-linux 2022-05-30 13:42:59 +02:00
yasm yasm: fix cross build 2021-12-05 10:47:44 +01:00
yosys yosys: 0.17 -> 0.18 2022-06-20 10:40:20 +02:00
z88dk
zasm treewide: extraPostFetch -> postFetch 2022-05-23 17:18:50 +03:00
zig maintainers: add aiotter 2022-07-16 14:57:54 +09:00
zulu zulu: build for aarch64-darwin 2022-07-01 21:30:08 +02:00
zz zz: unstable-2021-03-07 -> unstable-2021-05-04 2021-10-12 12:58:26 +02:00