Noen targets krever "--disable-multilib" til gcc. Eksempler er s390x-linux-gnu, x86_64-*-linux-gnu, aarch64-linux-gnu. Flere metoder, denne er uten sysroot. hvis du bruker sysroot så kan ikke sysroot være ${PREFIX}/${TARGET} - bruk heller ${PREFIX}/${TARGET}/sysroot eller tilsvarende (gcc feiler - ld finner ikke bibliotekene sine selv om de ligger der den leter) export TARGET=arm-linux-gnueabihf export KERNEL_ARCH=arm export TARGET=s390x-linux-gnu export KERNEL_ARCH=s390 export PATH=/opt/cross/bin:$PATH mkdir /tmp/binutils-obj.${TARGET} cd /tmp/binutils-obj.${TARGET} ${HOME}/binutils-*/configure --prefix=/opt/cross --target=${TARGET} && \ make -j$(nproc) && make install-strip -j4 mkdir /tmp/gcc-obj.${TARGET} cd /tmp/gcc-obj.${TARGET} ${HOME}/gcc-*/configure --prefix=/opt/cross --libexecdir=/opt/cross/lib --target=${TARGET} --enable-languages=c,c++ --disable-multilib && \ make all-gcc -j$(nproc) && make install-strip-gcc -j4 cd ~/linux*/ && \ make ARCH=${KERNEL_ARCH} O=/tmp/kernel.build INSTALL_HDR_PATH=/opt/cross/${TARGET} headers_install && \ find /opt/cross/${TARGET}/include \( -name '.install' -o -name '..install.cmd' \) -delete mkdir /tmp/glibc.${TARGET} cd /tmp/glibc.${TARGET} echo "build-programs=no" >> configparms && \ ~/glibc*/configure --prefix=/opt/cross/${TARGET} --host=${TARGET} CFLAGS="-O2 -pipe" && \ make install-headers && \ touch /opt/cross/${TARGET}/include/gnu/stubs.h && \ make csu/subdir_lib -j$(nproc) && \ cp csu/crt1.o csu/crti.o csu/crtn.o /opt/cross/${TARGET}/lib && \ ${TARGET}-gcc -nostdlib -nostartfiles -shared -x c /dev/null -o /opt/cross/${TARGET}/lib/libc.so cd /tmp/gcc-obj.${TARGET} make all-target-libgcc -j$(nproc) && make install-strip-target-libgcc -j4 cd /tmp/glibc.${TARGET} && \ make -j$(nproc) && make install DESTDIR=$(pwd)/dest -j4 && \ cp -a dest/opt/cross/${TARGET}/{lib,include} /opt/cross/${TARGET} cd /tmp/gcc-obj.${TARGET} rm -rf ${TARGET} #vi vil kjøre libgcc sitt configure script på nytt make -j$(nproc) && make install-strip #cleanup rm -rf /opt/cross/lib/libcc* /opt/cross/{include,share} find /opt/cross \( -name '*.la' -o -name '*.py' -o -name '*.spec' \) -delete find /opt/cross/${TARGET}/lib* | xargs file | grep 'shared\ object\|executable' | cut -f 1 -d : | xargs ${TARGET}-strip --strip-all find /opt/cross/${TARGET} \( -name '*.a' -o -name '*.o' \) | xargs ${TARGET}-strip --strip-unneeded find /opt/cross/lib/gcc/${TARGET} \( -name '*.a' -o -name '*.o' \) | xargs ${TARGET}-strip --strip-unneeded mkdir /tmp/glibc.${TARGET}.final cd /tmp/glibc.${TARGET}.final echo "build-programs=no" > configparms && \ ~/glibc*/configure --prefix=/opt/cross/${TARGET} --host=${TARGET} CFLAGS="-O3 -pipe" && \ make -j$(nproc) -l$(nproc) && make install DESTDIR=$(pwd)/dest -j4 && \ cp -a dest/opt/cross/${TARGET}/{lib,include} /opt/cross/${TARGET} mkdir /tmp/gcc-obj.${TARGET}.final cd /tmp/gcc-obj.${TARGET}.final ${HOME}/gcc-*/configure --prefix=/opt/cross --libexecdir=/opt/cross/lib --target=${TARGET} --enable-languages=c,c++ --disable-multilib && \ make -j$(nproc) && make install-strip #Canadian export HOST=s390x-linux-gnu export TARGET=arm-linux-gnueabihf export KERNEL_ARCH=arm mkdir /tmp/binutils-obj.canadian.${HOST}.to.${TARGET} cd /tmp/binutils-obj.canadian.${HOST}.to.${TARGET} ${HOME}/binutils-*/configure --prefix=/opt/cross-tools --host=${HOST} --target=${TARGET} make -j$(nproc) && make install-strip DESTDIR=/tmp/canadian -j4 mkdir /tmp/gcc-obj.canadian.${HOST}.to.${TARGET} cd /tmp/gcc-obj.canadian.${HOST}.to.${TARGET} ${HOME}/gcc-*/configure --prefix=/opt/cross-tools --host=${HOST} --target=${TARGET} --libexecdir=/opt/cross-tools/lib --enable-languages=c,c++ make -j$(nproc) && make install-strip DESTDIR=/tmp/canadian -j4 cd ~/linux*/ && \ make ARCH=${KERNEL_ARCH} O=/tmp/kernel.build INSTALL_HDR_PATH=/tmp/canadian/opt/cross-tools/${TARGET} headers_install && \ find /tmp/canadian/opt/cross-tools/${TARGET} \( -name '.install' -o -name '..install.cmd' \) -delete mkdir /tmp/glibc.canadian.${TARGET} cd /tmp/glibc.canadian.${TARGET} echo "build-programs=no" > configparms && \ ~/glibc*/configure --prefix=/opt/cross-tools/${TARGET} --host=${TARGET} CFLAGS="-O3 -pipe" && \ make -j$(nproc) -l$(nproc) && make install DESTDIR=$(pwd)/dest -j4 && \ cp -a dest/opt/cross-tools/${TARGET}/{lib,include} /tmp/canadian/opt/cross-tools/${TARGET} ## END CANADIAN mkdir /tmp/binutils-obj.crossed.${TARGET} cd /tmp/binutils-obj.crossed.${TARGET} ${HOME}/binutils-*/configure --prefix=/tmp/crossed/local --host=${TARGET} --target=${TARGET} make -j$(nproc) tooldir=/tmp/crossed/local && make install-strip tooldir=/tmp/crossed/local -j4 mkdir /tmp/gcc-obj.crossed.${TARGET} cd /tmp/gcc-obj.crossed.${TARGET} ${HOME}/gcc-*/configure --prefix=/opt/local --libexecdir=/opt/local/lib --host=${TARGET} --target=${TARGET} --enable-languages=c,c++ && \ make -j$(nproc) && make install-strip DESTDIR=/tmp/crossed -j4