I want to package the tool chain for RTEMS 4.9. The sources are at
ftp://www.rtems.org/pub/rtems/SOURCES/4.9. The gcc version is 4.3.2 plus a
few RTEMS specific patches. I successfully packaged the corresponding
binutils. I can also build and install the cross gcc. However, when using
the resulting gcc as a "driver" e.g. to compile a single .c file to an
executable, I get errors that suggest that it tries to call the 'as'
(assembler, part of binutils) for the host system, not the cross version.
Specifically,
franksen@tiber: ~/tmp > powerpc-rtems4.9-gcc -mcpu=603e -Dmpc603e -Dppc603e
-O2 -g -mmultiple -mstring -mstrict-align conftest.c
as: unrecognized option '-mppc'
I have been banging my head against this problem with no success, so now I
am asking for help here, hoping that you guys have more experience with
building gcc with nix and can give me a hint how to get this to work.
I attached my default.nix, on the top-level I have this definition of
config.nix:
{
packageOverrides = pkgs: with pkgs; rec {
binutils_powerpc_rtems49 = callPackage rtems/4.9/binutils {
targetArch = "powerpc";
};
gcc_powerpc_rtems49 = callPackage rtems/4.9/gcc {
targetArch = "powerpc";
targetArchBinutils = binutils_powerpc_rtems49;
};
};
}
Cheers
Ben
--
"Make it so they have to reboot after every typo." ? Scott Adams
{stdenv,fetchurl,zlib,texinfo,gmp,mpfr,targetArch,targetArchBinutils}:
let targetOs = "rtems4.9";
in stdenv.mkDerivation {
name = "gcc-${targetArch}-rtems4.9";
sourceRoot = "gcc-4.3.2";
srcs = [
(fetchurl {
url =
"http://www.rtems.org/ftp/pub/rtems/SOURCES/4.9/gcc-core-4.3.2.tar.bz2";
sha256 = "0np7cbqdaajarwwlkvq7d2ifkld1lsh0cfsaqcx9dsvqklkyg1q6";
})
(fetchurl {
url =
"http://www.rtems.org/ftp/pub/rtems/SOURCES/4.9/gcc-g++-4.3.2.tar.bz2";
sha256 = "105vhmq111l5zyzxdanhhv5lgvl4pr6pq9xj6jb5g5x3bk4jnki5";
})
(fetchurl {
url =
"http://www.rtems.org/ftp/pub/rtems/SOURCES/4.9/newlib-1.16.0.tar.gz";
sha256 = "01rxk9js833mwadq92jx0flvk9jyjrnwrq93j39c2j2wjsa66hnv";
})
];
patches = [
(fetchurl {
url =
"http://www.rtems.org/ftp/pub/rtems/SOURCES/4.9/gcc-core-4.3.2-${targetOs}-20090825.diff";
sha256 = "1lf1zcv4j99vsvzqmy4scdk583jqvzwf4yw9x9jrv3q0wswsix64";
})
(fetchurl {
url =
"http://www.rtems.org/ftp/pub/rtems/SOURCES/4.9/newlib-1.16.0-${targetOs}-20090324.diff";
sha256 = "0c9p4k7krd77ncr7wqar9py8ib64r25j7ysbc32jm231dj2qymka";
})
];
prePatch = ''
ln -s ../newlib-1.16.0/newlib newlib
'';
# Needed for the cross compilation to work
AR = "ar";
LD = "ld";
CC = "gcc";
CPP = "gcc -E";
preConfigure = ''
# Perform the build in a different directory.
install -d ../build;
cd ../build
configureScript=../$sourceRoot/configure
'';
configureFlags = "
--target=${targetArch}-${targetOs}
--disable-libstdcxx-pch
--with-gnu-as
--with-gnu-ld
--with-newlib
--with-system-zlib
--disable-nls
--disable-libssp
--without-included-gettext
--disable-win32-registry
--enable-version-specific-runtime-libs
--enable-threads=rtems
--enable-newlib-io-c99-formats
--enable-languages=c,c++
";
buildInputs = [ texinfo gmp mpfr zlib targetArchBinutils ];
enableParallelBuilding = true;
dontStrip = true;
}
_______________________________________________
nix-dev mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-dev