nixpkgs/pkgs/development
sternenseemann ca9be0511b binutils-unwrapped: force targetPrefix if cross compiling
The binutils build system checks by itself if it is building a cross
toolchain or not and prepends or omits a targetPrefix accordingly. This
means that we can always pass target via configureTargets.

However the binutils build system and our bintools wrapper disagree over
whether we are building a cross toolchain or not sometimes since cross
compilation can be relatively subtle in nixpkgs. For example every use
of crossOverlays will make nixpkgs build a cross toolchain even though
localSystem == crossSystem. The cross infrastructure is also used to
build native binaries with a different stdenv (musl instead of glibc,
clang instead of gcc). In all of these cases stdenv.hostPlatform.config
== stdenv.targetPlatform.config, causing binutils to not prepend a
target prefix. At the same time stdenv.hostPlatform !=
stdenv.targetPlatform causing the bintools wrapper to expect a target
prefix, thus building an incomplete set of bintools. This is why
currently pkgsCross.gnu64 and pkgsCross.musl64 aren't working.

The solution is quite simple however: If we detect that we are building
a cross toolchain in the binutils-unwrapped expression, we force the
targetPrefix with --programprefix and fulfill the expectations of the
bintools wrapper at the same time.

Tested (on x86_64-linux):

* pkgsCross.musl64.hello
* pkgsCross.aarch64-multiplatform.hello
* pkgs.hello

Still not working is pkgsCross.gnu64, since
x86_64-unknown-linux-gnu-stage-final-gcc gets confused about targets
now, so bootstrapping the stdenv fails. Since this wasn't working
previously anyways, it's proably fine to fix this separately.
2021-04-16 17:12:45 +02:00
..
androidndk-pkgs
arduino
beam-modules
bower-modules/generic
chez-modules chez-matchable: typo fix in the description value 2021-04-12 01:30:02 +02:00
compilers Merge branch 'master' into staging-next 2021-04-15 01:01:26 +02:00
coq-modules coqPackages.ITree: changed pname to InteractionTrees 2021-04-14 14:42:01 +02:00
dhall-modules
dotnet-modules
em-modules/generic
gnuradio-modules
go-modules
go-packages
guile-modules
haskell-modules
idris-modules
interpreters Merge #119255: staging-next + conflict resolution -> staging 2021-04-13 09:35:49 +02:00
java-modules
libraries protobuf: 3.15.7 -> 3.15.8 (#119574) 2021-04-15 19:36:01 -05:00
lisp-modules
lua-modules
misc
mobile
node-packages aws-azure-login: init at 3.3.0 (#110634) 2021-04-14 23:08:31 +02:00
ocaml-modules ocamlPackages.postgresql: 4.6.3 → 5.0.0 2021-04-14 22:39:03 +02:00
octave-modules
perl-modules
pharo
php-packages
pure-modules
python-modules Merge remote-tracking branch 'upstream/master' into staging 2021-04-15 03:16:06 +00:00
r-modules
ruby-modules Merge branch 'staging' into staging-next 2021-04-14 10:08:25 +02:00
tools binutils-unwrapped: force targetPrefix if cross compiling 2021-04-16 17:12:45 +02:00
web Merge branch 'staging' into staging-next 2021-04-14 10:08:25 +02:00