Fixed some details on cross compilation. Among others:
- Stating better the guile dependencies (native/host) for guile to build - Fixing cross-linking, through --rpath-link (ld(1) explains well about it - Made gcc call the linker and the assembler through the gcc wrapper instead of directly. I thought this was the source of missing -rpath's, but the source of the problem ended up being the lack of --rpath-link. But I think the native gcc calls the wrapped ld and as, so let's do the same cross compiling. - Removed the binutilsCross from the glibc expressions. Now they are built using the gcc-cross-wrapper, and they were built with the direct gcc and binutils before this change. - I think patchelf and strip don't break the cross-compiled binaries, so I reallow them on cross compilation. - I disable the checkPhase on cross compilation. This made gmp and libtool fail when cross compiled, iirc. svn path=/nixpkgs/branches/stdenv-updates/; revision=18498
This commit is contained in:
parent
a5fee3325a
commit
a263cb814e
@ -17,7 +17,7 @@ if test -n "$nativeTools"; then
|
|||||||
else
|
else
|
||||||
ldflags="$ldflags -L$gcc/lib"
|
ldflags="$ldflags -L$gcc/lib"
|
||||||
gccPath="$gcc/bin"
|
gccPath="$gcc/bin"
|
||||||
ldPath="$binutils/bin"
|
ldPath="$binutils/$crossConfig/bin"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -40,7 +40,8 @@ doSubstitute() {
|
|||||||
--subst-var "cflagsLink" \
|
--subst-var "cflagsLink" \
|
||||||
--subst-var "ldflags" \
|
--subst-var "ldflags" \
|
||||||
--subst-var "ldflagsBefore" \
|
--subst-var "ldflagsBefore" \
|
||||||
--subst-var-by "ld" "$ldPath/$crossConfig-ld"
|
--subst-var "ldPath" \
|
||||||
|
--subst-var-by "ld" "$ldPath/ld"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,13 +5,13 @@
|
|||||||
# stdenv.mkDerivation provides a wrapper that sets up the right environment
|
# stdenv.mkDerivation provides a wrapper that sets up the right environment
|
||||||
# variables so that the compiler and the linker just "work".
|
# variables so that the compiler and the linker just "work".
|
||||||
|
|
||||||
{ name ? "", stdenv, nativeTools, nativeLibc, nativePrefix ? ""
|
{ name ? "", stdenv, nativeTools, nativeLibc, noLibc ? false, nativePrefix ? ""
|
||||||
, gcc ? null, libc ? null, binutils ? null, shell ? "", cross ? ""
|
, gcc ? null, libc ? null, binutils ? null, shell ? "", cross ? ""
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert nativeTools -> nativePrefix != "";
|
assert nativeTools -> nativePrefix != "";
|
||||||
assert !nativeTools -> gcc != null && binutils != null;
|
assert !nativeTools -> gcc != null && binutils != null;
|
||||||
assert !nativeLibc -> libc != null;
|
assert !noLibc -> (!nativeLibc -> libc != null);
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
builder = ./builder.sh;
|
builder = ./builder.sh;
|
||||||
|
@ -112,6 +112,8 @@ if test -n "$NIX_GCC_WRAPPER_EXEC_HOOK"; then
|
|||||||
source "$NIX_GCC_WRAPPER_EXEC_HOOK"
|
source "$NIX_GCC_WRAPPER_EXEC_HOOK"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# We want gcc to call the wrapper linker, not that of binutils.
|
||||||
|
export PATH="@ldPath@:$PATH"
|
||||||
|
|
||||||
# Call the real `gcc'. Filter out warnings from stderr about unused
|
# Call the real `gcc'. Filter out warnings from stderr about unused
|
||||||
# `-B' flags, since they confuse some programs. Deep bash magic to
|
# `-B' flags, since they confuse some programs. Deep bash magic to
|
||||||
|
@ -121,7 +121,7 @@ if test "$NIX_DONT_SET_RPATH" != "1"; then
|
|||||||
|
|
||||||
# Finally, add `-rpath' switches.
|
# Finally, add `-rpath' switches.
|
||||||
for i in $rpath; do
|
for i in $rpath; do
|
||||||
extra=(${extra[@]} -rpath $i)
|
extra=(${extra[@]} -rpath $i -rpath-link $i)
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -26,5 +26,6 @@ if test -n "@libc@"; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
configureFlags="$configureFlags --build=$system --host=$crossConfig"
|
configureFlags="$configureFlags --build=$system --host=$crossConfig"
|
||||||
dontPatchELF=1
|
# Disabling the tests when cross compiling, as usually the tests are meant for
|
||||||
dontStrip=1
|
# native compilations.
|
||||||
|
doCheck=""
|
||||||
|
@ -124,11 +124,6 @@ postInstall() {
|
|||||||
ln -sfn g++ $i
|
ln -sfn g++ $i
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# gcc will look for the binutils there, called through collect2
|
|
||||||
if test -n "$crossConfig"; then
|
|
||||||
ln -s $binutilsCross/$crossConfig/bin $out/$crossConfig/bin
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,13 +9,15 @@ stdenv.mkDerivation rec {
|
|||||||
};
|
};
|
||||||
|
|
||||||
buildNativeInputs = [ makeWrapper ];
|
buildNativeInputs = [ makeWrapper ];
|
||||||
propagatedBuildInputs = [ libtool ];
|
propagatedBuildInputs = [ libtool gmp ];
|
||||||
propagatedBuildNativeInputs = [readline gmp gawk];
|
propagatedBuildNativeInputs = [readline gawk];
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
wrapProgram $out/bin/guile-snarf --prefix PATH : "${gawk}/bin"
|
wrapProgram $out/bin/guile-snarf --prefix PATH : "${gawk}/bin"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
NIX_DEBUG=1;
|
||||||
|
|
||||||
preBuild = ''
|
preBuild = ''
|
||||||
sed -e '/lt_dlinit/a lt_dladdsearchdir("'$out/lib'");' -i libguile/dynl.c
|
sed -e '/lt_dlinit/a lt_dladdsearchdir("'$out/lib'");' -i libguile/dynl.c
|
||||||
'';
|
'';
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
, installLocales ? true
|
, installLocales ? true
|
||||||
, profilingLibraries ? false
|
, profilingLibraries ? false
|
||||||
, cross ? null
|
, cross ? null
|
||||||
, binutilsCross ? null
|
|
||||||
, gccCross ? null
|
, gccCross ? null
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@ -78,7 +77,7 @@ stdenv.mkDerivation rec {
|
|||||||
"--without-fp"
|
"--without-fp"
|
||||||
] else []);
|
] else []);
|
||||||
|
|
||||||
buildInputs = stdenv.lib.optionals (cross != null) [ binutilsCross gccCross ];
|
buildInputs = stdenv.lib.optionals (cross != null) [ gccCross ];
|
||||||
|
|
||||||
preInstall = ''
|
preInstall = ''
|
||||||
ensureDir $out/lib
|
ensureDir $out/lib
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
, installLocales ? true
|
, installLocales ? true
|
||||||
, profilingLibraries ? false
|
, profilingLibraries ? false
|
||||||
, cross ? null
|
, cross ? null
|
||||||
, binutilsCross ? null
|
|
||||||
, gccCross ? null
|
, gccCross ? null
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@ -80,7 +79,7 @@ stdenv.mkDerivation rec {
|
|||||||
"--without-fp"
|
"--without-fp"
|
||||||
] else []);
|
] else []);
|
||||||
|
|
||||||
buildInputs = stdenv.lib.optionals (cross != null) [ binutilsCross gccCross ];
|
buildInputs = stdenv.lib.optionals (cross != null) [ gccCross ];
|
||||||
|
|
||||||
preInstall = ''
|
preInstall = ''
|
||||||
ensureDir $out/lib
|
ensureDir $out/lib
|
||||||
|
@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
|
|||||||
sha256 = "1j5pklq36ivg2cim5wfysns229a544lqkimp3mlzkwjl513ra0ma";
|
sha256 = "1j5pklq36ivg2cim5wfysns229a544lqkimp3mlzkwjl513ra0ma";
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = [m4];
|
buildNativeInputs = [m4];
|
||||||
|
|
||||||
preConfigure = "ln -sf configfsf.guess config.guess";
|
preConfigure = "ln -sf configfsf.guess config.guess";
|
||||||
|
|
||||||
|
@ -1785,11 +1785,16 @@ let
|
|||||||
crossStageStatic = false;
|
crossStageStatic = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
gccCrossStageStatic = cross: (gcc43_realCross cross).override {
|
gccCrossStageStatic = cross: wrapGCCCross {
|
||||||
|
gcc = (gcc43_realCross cross).override {
|
||||||
crossStageStatic = true;
|
crossStageStatic = true;
|
||||||
langCC = false;
|
langCC = false;
|
||||||
glibcCross = null;
|
glibcCross = null;
|
||||||
};
|
};
|
||||||
|
libc = null;
|
||||||
|
binutils = binutilsCross cross;
|
||||||
|
inherit cross;
|
||||||
|
};
|
||||||
|
|
||||||
gccCrossStageFinal = cross: wrapGCCCross {
|
gccCrossStageFinal = cross: wrapGCCCross {
|
||||||
gcc = gcc43_realCross cross;
|
gcc = gcc43_realCross cross;
|
||||||
@ -2218,6 +2223,7 @@ let
|
|||||||
import ../build-support/gcc-cross-wrapper {
|
import ../build-support/gcc-cross-wrapper {
|
||||||
nativeTools = false;
|
nativeTools = false;
|
||||||
nativeLibc = false;
|
nativeLibc = false;
|
||||||
|
noLibc = (libc == null);
|
||||||
inherit stdenv gcc binutils libc shell name cross;
|
inherit stdenv gcc binutils libc shell name cross;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -3415,7 +3421,6 @@ let
|
|||||||
|
|
||||||
glibc29Cross = cross : makeOverridable (import ../development/libraries/glibc-2.9) {
|
glibc29Cross = cross : makeOverridable (import ../development/libraries/glibc-2.9) {
|
||||||
inherit stdenv fetchurl cross;
|
inherit stdenv fetchurl cross;
|
||||||
binutilsCross = binutilsCross cross;
|
|
||||||
gccCross = gccCrossStageStatic cross;
|
gccCross = gccCrossStageStatic cross;
|
||||||
kernelHeaders = kernelHeadersCross cross;
|
kernelHeaders = kernelHeadersCross cross;
|
||||||
installLocales = getPkgConfig "glibc" "locales" false;
|
installLocales = getPkgConfig "glibc" "locales" false;
|
||||||
@ -3428,7 +3433,6 @@ let
|
|||||||
|
|
||||||
glibc211Cross = cross : makeOverridable (import ../development/libraries/glibc-2.11) {
|
glibc211Cross = cross : makeOverridable (import ../development/libraries/glibc-2.11) {
|
||||||
inherit stdenv fetchurl cross;
|
inherit stdenv fetchurl cross;
|
||||||
binutilsCross = binutilsCross cross;
|
|
||||||
gccCross = gccCrossStageStatic cross;
|
gccCross = gccCrossStageStatic cross;
|
||||||
kernelHeaders = kernelHeadersCross cross;
|
kernelHeaders = kernelHeadersCross cross;
|
||||||
installLocales = getPkgConfig "glibc" "locales" false;
|
installLocales = getPkgConfig "glibc" "locales" false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user