MINGW-packages: Relocation errors with -lstdc++ starting with GCC6
Both FFmpeg and mpv when linking with -lstdc++ fail with these exact errors when compiling with x86_64-w64-mingw32 GCC 6.1:
C:/builds/ab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.1.0\libstdc++.a(cow-stdexcept.o):(.text$_Z35_txnal_cow_string_C1_for_exceptionsPvPKcS_+0x2c): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `_ITM_RU1'
C:/builds/ab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.1.0\libstdc++.a(cow-stdexcept.o):(.text$_Z35_txnal_cow_string_C1_for_exceptionsPvPKcS_+0x39): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `transaction clone for operator new[](unsigned long long)'
C:/builds/ab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.1.0\libstdc++.a(cow-stdexcept.o):(.text$_Z35_txnal_cow_string_C1_for_exceptionsPvPKcS_+0x5d): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `_ITM_memcpyRtWn'
C:/builds/ab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.1.0\libstdc++.a(cow-stdexcept.o):(.text$_Z23_txnal_cow_string_c_strPKv+0x1): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `_ITM_RU8'
C:/builds/ab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.1.0\libstdc++.a(cow-stdexcept.o):(.text$_Z23_txnal_sso_string_c_strPKv+0x1): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `_ITM_RU8'
C:/builds/ab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.1.0\libstdc++.a(cow-stdexcept.o):(.text$_Z20_txnal_cow_string_D1Pv+0x5): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `_ITM_RU8'
C:/builds/ab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.1.0\libstdc++.a(cow-stdexcept.o):(.text$_Z20_txnal_cow_string_D1Pv+0x1e): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `_ITM_addUserCommitAction'
C:/builds/ab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.1.0\libstdc++.a(cow-stdexcept.o):(.text$_ZGTtNSt11logic_errorC1EPKc+0x2e): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `_ITM_memcpyRnWt'
C:/builds/ab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.1.0\libstdc++.a(cow-stdexcept.o):(.text$_ZGTtNSt11logic_errorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x2e): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `_ITM_memcpyRnWt'
C:/builds/ab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.1.0\libstdc++.a(cow-stdexcept.o):(.text$_ZGTtNSt11logic_errorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x36): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `_ITM_RU8'
C:/builds/ab/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.1.0\libstdc++.a(cow-stdexcept.o):(.text$_ZGTtNSt11logic_errorD0Ev+0x1a): additional relocation overflows omitted from the output
collect2.exe: error: ld returned 1 exit status
There errors are only missing if libs that depend on stdc++ are avoided.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 60 (33 by maintainers)
Commits related to this issue
- git{,-git}: Re-add patch dissabling weak refs for Transactional Memory in libsdtc++ Return to wiiaboo patch because it's the best solution we got https://github.com/Alexpux/MINGW-packages/issues/1580 — committed to mati865/MINGW-packages by mati865 8 years ago
- git{,-git}: Re-add patch dissabling weak refs for Transactional Memory in libsdtc++ Return to wiiaboo patch because it's the best solution we got https://github.com/Alexpux/MINGW-packages/issues/1580 — committed to mati865/MINGW-packages by mati865 8 years ago
- patch to disable weakrefs in libstdc++ from msys2 Building ffmpeg with -static-libstdc++ fails, see: https://github.com/Alexpux/MINGW-packages/issues/1580 Built package on koji and tested that the ... — committed to rkitover/fedora-mingw-gcc by rkitover 6 years ago
- patch to disable weakrefs in libstdc++ from msys2 Building ffmpeg with -static-libstdc++ fails, see: https://github.com/Alexpux/MINGW-packages/issues/1580 Built package on koji and tested that the ... — committed to rkitover/fedora-mingw-gcc by rkitover 6 years ago
- patch to disable weakrefs in libstdc++ from msys2 Building ffmpeg with -static-libstdc++ fails, see: https://github.com/Alexpux/MINGW-packages/issues/1580 Built package on koji and tested that the ... — committed to rkitover/fedora-mingw-gcc by rkitover 6 years ago
- patch to disable weakrefs in libstdc++ from msys2 Building ffmpeg with -static-libstdc++ fails, see: https://github.com/Alexpux/MINGW-packages/issues/1580 Built package on koji and tested that the ... — committed to rkitover/fedora-mingw-gcc by rkitover 6 years ago
It’s not an issue, it’s normal behavior of ld with cygwin/mingw. It looks for libxxx.dll.a, xxx.dll.a and then libxxx.a. Ways to force it include passing the full path to libxxx.a, passing
-Wl,-Bstatic
or just-static
, and renaming the import library to something else. I use the last one: