diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2023-12-05 14:16:36 +0100 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2023-12-21 12:23:24 +0100 |
commit | 8b7f05db0453d0a8af6bd89631be977d4fe8cf16 (patch) | |
tree | e9cd12829092089d46a914b3420da81a37c556c1 | |
parent | 1fd409d8acc795a80ef4f8ec8edbda694707ef41 (diff) | |
download | bootstrappable-toolchain-8b7f05db0453d0a8af6bd89631be977d4fe8cf16.tar.gz |
gcc-musl-static: Support cross-compiler build
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | src/compilers/gcc-13-musl-static.TARGETS | 6 |
2 files changed, 7 insertions, 4 deletions
@@ -47,16 +47,17 @@ Details about toolchain variants: the target system*) - **supports fully static linking (unlike *glibc* toolchains)** - **supports cross-compilation for project's `TARGET_ARCH`** -- `<compiler>-musl-static`: statically linked compiler with musl support +- `<compiler>-musl-static`: statically linked *cross* compiler with musl support - runs on systems without any existing C library - **links against bundled *musl libc*** (*note that dynamically linked binaries require a working musl ld+libc on the target system*) - **supports fully static linking (unlike *glibc* toolchains)** + - **supports cross-compilation for project's `TARGET_ARCH`** - `<toolchain>+tools` (e.g., `gcc-13.2.0-native+tools`) - `<toolchain>` bundled with all latest tools (see `tools-all` above) -Non-static `musl` variants support cross-compilation. In your project, make sure +All `musl` variants support cross-compilation. In your project, make sure that the variables `ARCH` and `TARGET_ARCH` are set to one of the following values: `x86`, `x86_64`, `arm`, or `arm64`. diff --git a/src/compilers/gcc-13-musl-static.TARGETS b/src/compilers/gcc-13-musl-static.TARGETS index 6f7ee9c..58f29b2 100644 --- a/src/compilers/gcc-13-musl-static.TARGETS +++ b/src/compilers/gcc-13-musl-static.TARGETS @@ -77,11 +77,13 @@ , "printf '#!/bin/sh\\nexec \"%s\" -static \"$@\"' \"${CC}\" >${TMPDIR}/cc" , "printf '#!/bin/sh\\nexec \"%s\" -static \"$@\"' \"${CXX}\" >${TMPDIR}/c++" , "chmod +x ${TMPDIR}/cc ${TMPDIR}/c++" + , "export CC=\"${TMPDIR}/cc\"" + , "export CXX=\"${TMPDIR}/c++\"" , "mv musl-latest.orig musl.readonly" , "cp -r musl.readonly musl-latest.orig && chmod -R +w musl-latest.orig" , "export check_msgfmt=no # do not use system's msgfmt, if available" - , "${MAKE} -j${NJOBS} TARGET=${TARGET} CC=${TMPDIR}/cc CXX=${TMPDIR}/c++ LDFLAGS='-static' LDFLAGS_FOR_TARGET='-static' >build.log 2>&1 || (cat build.log && exit 1)" - , "${MAKE} -j${NJOBS} TARGET=${TARGET} CC=${TMPDIR}/cc CXX=${TMPDIR}/c++ LDFLAGS='-static' LDFLAGS_FOR_TARGET='-static' OUTPUT= DESTDIR=${DESTDIR} install >>build.log 2>&1 || (cat build.log && exit 1)" + , "${MAKE} -j${NJOBS} TARGET=${TARGET} LDFLAGS='-static' LDFLAGS_FOR_TARGET='-static' >build.log 2>&1 || (cat build.log && exit 1)" + , "${MAKE} -j${NJOBS} TARGET=${TARGET} LDFLAGS='-static' LDFLAGS_FOR_TARGET='-static' OUTPUT= DESTDIR=${DESTDIR} install >>build.log 2>&1 || (cat build.log && exit 1)" , "cd ${DESTDIR}" , "STRIP=${LOCALBASE}/bin/strip" , "find ./bin/ ./${TARGET}/bin/ ./libexec/gcc/ -type f -exec sh -c \"${STRIP} {} 2>/dev/null\" \\;" |