Last active
October 28, 2022 22:36
-
-
Save theoparis/e21615b3b9c840e45a69716abd6693eb to your computer and use it in GitHub Desktop.
build statically linked cross gcc compiler (assumes you have downloaded the sources and prequsities for gcc)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
TARGET=${TARGET:-"x86_64-linux-musl"} | |
PREFIX=${PREFIX:-"/usr/local/dev/gcc"} | |
CC=${CC:-"gcc"} | |
CXX=${CXX-"g++"} | |
LANGUAGES=${LANGUAGES:-"c,c++,go"} | |
./configure \ | |
--enable-languages="$LANGUAGES" \ | |
--disable-nls \ | |
--disable-shared \ | |
--disable-host-shared \ | |
--with-boot-ldflags=-static \ | |
--with-stage1-ldflags=-static \ | |
--disable-multilib \ | |
--prefix="$PREFIX" \ | |
--host="$TARGET" \ | |
CC="$CC" CXX="$CXX" | |
make -j$(nproc) | |
make -j$(nproc) install | |
echo "DONE" | |
echo "You can find your compiled gcc executable at $PREFIX/bin/gcc". | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment