fix(gcc/v8): stop cc1 SIGSEGV on every compile (mirror main gcc PIE/no-LTO flags)#13770
Merged
Merged
Conversation
…lags The merged gnu.org/gcc/v8 bottle was unusable: its cc1/cc1plus SIGSEGV in the dynamic loader (dl_main) before the compiler runs, so EVERY compile fails with `gcc: internal compiler error: Segmentation fault ... cc1`. Reproduced on a real x86-64 box (Debian bullseye). Consumers like mysql.com/v5_7 die at cmake's testCCompiler step because of it. Root cause: the recipe only set `-fPIC` and none of the linkage flags the main gnu.org/gcc recipe applies for old (>=6, <10) gcc, so the compiler executables built by the modern pkgx toolchain come out linked such that an older glibc loader can't start them. The version-only test (`gcc --version`) never caught it because that runs the driver, not cc1. Fix mirrors the main recipe's linux handling: - --enable-default-pie (gcc 6+) - --disable-lto --disable-plugin (gcc <10: the LTO plugin dlopens objects that mix the host ld-linux libc with the bottle's libc at link time) - CFLAGS/CXXFLAGS: -fPIC -fPIE - bake gmp/mpfr/mpc/zlib RUNPATHs so cc1/cc1plus are self-contained And harden the test to actually compile+link+RUN both C and C++, so this class of breakage can't regress unnoticed. Verified end-to-end on x86-64: full build+install, then gcc/g++ compile, link and run C and C++ programs (exit 0), including in a clean `env -i`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Refactor package.yml to simplify platform and build steps.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The merged
gnu.org/gcc/v8bottle is unusable: itscc1/cc1plusSIGSEGV in the dynamic loader (dl_main) before the compiler even runs, so every compile fails:Reproduced on a real x86-64 box (Debian bullseye, glibc 2.31); gdb shows the crash is in
dl_main(rtld.c) while startingcc1, not in cc1's own code. Downstream consumers (e.g.mysql.com/v5_7#13062) die at cmake'stestCCompilerstep because of this.The recipe's test (
gcc --version) never caught it — that only runs the driver, notcc1.Root cause
The recipe set only
-fPICand none of the linkage flags the maingnu.org/gccrecipe applies for old (>=6, <10) gcc. Built by the modern pkgx toolchain (gcc 16 + binutils 2.46), the compiler executables come out linked such that an older glibc loader can't start them.Fix — mirror the main
gnu.org/gccrecipe's linux handling--enable-default-pie(gcc 6+)--disable-lto --disable-plugin(gcc <10 — the LTO plugin dlopens objects that mix the host ld-linux libc with the bottle's libc at link time)CFLAGS/CXXFLAGS:-fPIC -fPIEgmp/mpfr/mpc/zlibRUNPATHs socc1/cc1plusare self-contained…and harden the test to actually compile + link + run both a C and a C++ program, so this class of breakage can't regress unnoticed.
Verification
Verified end-to-end on x86-64: full build + install, then
gcc/g++compile, link and run C and C++ programs (exit 0), including in a cleanenv -i(confirming the RUNPATHs make the compiler self-contained).cc1 -Sno longer crashes.Unblocks #13062 (MySQL 5.7).
🤖 Generated with Claude Code