What is the preferred way of building a cross compiler?
Henri Tuhola
henri.tuhola@gmail.com
Fri Oct 9 01:23:00 GMT 2015
Hi GCC maintainers
I've spent few days trying to figure out how to build a cross compiler
for my linux distribution. I've found plenty of instructions but only
the unsatisfying instructions have been worked.
The particular instructions that work are located at the "cross linux
from scratch" -tutorial:
http://www.clfs.org/view/CLFS-3.0.0-SYSTEMD/x86_64-64/cross-tools/chapter.html
The problem with these tutorials are that they propose to patch the
gcc/config -directory and build files to get the library compile
correct. I wrote my current build scripts based on them and got it to
work. The problem is that I cannot trust that they keep working on.
I thought for a moment that I had found good instructions at
http://preshing.com/20141119/how-to-build-a-gcc-cross-compiler/ but
neither these worked out.
So consider that you're starting out a distribution. What is the
preferred way of compiling a cross-compiler and then the compiler for
your platform? The biggest concern seems to be that the paths
Here's a sample of what kind of crazy the clfs scripts consist of,
after they've patched the gcc/config and replaced every /lib(64)?
-pattern with /tools/lib
AR=ar LDFLAGS="-Wl,-rpath,/cross-tools/lib" \
$GCC_SOURCES/configure --prefix=/cross-tools \
--build=${LELUX_HOST} --host=${LELUX_HOST} --target=${LELUX_TARGET} \
--with-sysroot=${LELUX} --with-local-prefix=/tools \
--with-native-system-header-dir=/tools/include \
--disable-nls --disable-shared \
--with-mpfr=/cross-tools \
--with-gmp=/cross-tools \
--with-mpc=/cross-tools \
--without-headers --with-newlib --disable-decimal-float
--disable-libgomp \
--disable-libmudflap --disable-libssp --disable-libatomic
--disable-libitm \
--disable-libsanitizer --disable-libquadmath --disable-threads \
--disable-multilib --disable-target-zlib --with-system-zlib \
--enable-languages=c --enable-checking=release
make -j4 all-gcc all-target-libgcc
make install-gcc install-target-libgcc
I feel this is important, as there's many other people constructing
cross compiler tools. Actually I just looked in how gcw0 toolchain has
been configured:
Configured with: ./configure --prefix=/opt/gcw0-toolchain/usr
--sysconfdir=/opt/gcw0-toolchain/etc --enable-shared --enable-static
--target=mipsel-gcw0-linux-uclibc
--with-sysroot=/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot
--disable-__cxa_atexit --with-gnu-ld --disable-libssp
--disable-multilib --with-gmp=/opt/gcw0-toolchain/usr
--with-mpfr=/opt/gcw0-toolchain/usr --enable-target-optspace
--disable-libsanitizer --enable-tls --disable-libmudflap
--enable-threads --with-mpc=/opt/gcw0-toolchain/usr
--disable-decimal-float --with-arch=mips32r2 --with-tune=mips32r2
--with-abi=32 --with-pkgversion='Buildroot 2014.05-gbb847d4'
--with-bugurl=http://bugs.buildroot.net/ --enable-languages=c,c++
--with-build-time-tools=/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/bin
--disable-libgomp --enable-lto
Doesn't seem that different.
More information about the Gcc-help
mailing list