Skip to content

Commit 682ef37

Browse files
alfgclaude
andcommitted
fix: pre-link libgcc_eh.a explicitly so its _Unwind_Resume wins over libgcc_s stubs
GCC 15 MinGW spec adds -lgcc_s alongside -lgcc_eh even when -static-libgcc is set. With -Wl,-Bstatic active, -lgcc_s resolves to libgcc_s.a (MSYS2 ships a static archive of DLL import stubs) which also contains _Unwind_Resume, causing a duplicate definition error. Fix: explicitly link -lgcc_eh and -lgcc in Bstatic mode at the very start of extra-ldflags, before codec libs and before GCC's spec-added libs. The static EH implementation lands first in the symbol table; --allow-multiple-definition then silently ignores the duplicate stubs from libgcc_s.a that arrive later. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent eba7c97 commit 682ef37

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

scripts/build-ffmpeg-windows.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ cd "$SRC/ffmpeg"
6161
--pkg-config=pkg-config \
6262
--pkg-config-flags="--static" \
6363
--extra-cflags="-I$PREFIX/include" \
64-
--extra-ldflags="-L$PREFIX/lib -static-libgcc -static-libstdc++ -Wl,-Bstatic -Wl,--start-group" \
64+
--extra-ldflags="-L$PREFIX/lib -Wl,-Bstatic,-lgcc_eh,-lgcc -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++ -Wl,--start-group" \
6565
--extra-ldexeflags="-Wl,--end-group -Wl,-Bdynamic" \
6666
--extra-libs="-lm" \
6767
--target-os=mingw32 \

0 commit comments

Comments
 (0)