mingw-w64 compilation (64 bit) breaks with: multiple definition of `std::__throw_bad_exception()'

RESOLVED FIXED

Status

defect
RESOLVED FIXED
2 years ago
Last year

People

(Reporter: gk, Unassigned)

Tracking

(Blocks 1 bug)

52 Branch
x86_64
Windows
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Back then in bug 1269251 I tested whether the proposed fix breaks our mingw-w64 builds and it turned out it does not. But that was only half of the truth as comment 13 in that bug shows. It turns out that this does not hold for 64 bit builds. The error message we get is:

Executing: /var/tmp/dist/mingw-w64/helpers/x86_64-w64-mingw32-g++ -std=gnu++11 -mwindows -shared -Wl,--out-implib -Wl,libmozglue.a -o mozglue.dll /var/tmp/build/firefox-
af0ca6a886c7/obj-mingw/mozglue/build/tmp8l87fh.list module.res -specs=/var/tmp/dist/mingw-w64/msvcr100.spec -static mozglue.def -DELAYLOAD:user32.dll -luuid -lgdi32 -lwi
nmm -lwsock32 -luserenv -lsecur32 -ldbghelp -lversion -ldelayimp
/var/tmp/build/firefox-af0ca6a886c7/obj-mingw/mozglue/build/tmp8l87fh.list:
    INPUT("SSE.o")
    INPUT("WindowsDllBlocklist.o")
    INPUT("dummy.o")
    INPUT("../../memory/mozalloc/winheap.o")
    INPUT("../../memory/mozalloc/Unified_cpp_memory_mozalloc0.o")
    INPUT("../misc/StackWalk.o")
    INPUT("../misc/TimeStamp.o")
    INPUT("../misc/TimeStamp_windows.o")
    INPUT("../../mfbt/Compression.o")
    INPUT("../../mfbt/Decimal.o")
    INPUT("../../mfbt/Unified_cpp_mfbt0.o")
    INPUT("../../mfbt/Unified_cpp_mfbt1.o")

/var/tmp/dist/mingw-w64/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/libstdc++.a(functexcept.o):/var/tmp/build/gcc/x86_64-w64-mingw32/libstdc++-v3
/src/c++11/../../../../gcc-5.4.0/libstdc++-v3/src/c++11/functexcept.cc:58: multiple definition of `std::__throw_bad_exception()'
../misc/TimeStamp.o:/var/tmp/build/firefox-af0ca6a886c7/obj-mingw/dist/include/mozilla/throw_gcc.h:43: first defined here
/var/tmp/dist/mingw-w64/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/libstdc++.a(functexcept.o):/var/tmp/build/gcc/x86_64-w64-mingw32/libstdc++-v3
/src/c++11/../../../../gcc-5.4.0/libstdc++-v3/src/c++11/functexcept.cc:62: multiple definition of `std::__throw_bad_alloc()'
../misc/TimeStamp.o:/var/tmp/build/firefox-af0ca6a886c7/obj-mingw/dist/include/mozilla/throw_gcc.h:49: first defined here
/var/tmp/dist/mingw-w64/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/libstdc++.a(functexcept.o):/var/tmp/build/gcc/x86_64-w64-mingw32/libstdc++-v3
/src/c++11/../../../../gcc-5.4.0/libstdc++-v3/src/c++11/functexcept.cc:66: multiple definition of `std::__throw_bad_cast()'
../misc/TimeStamp.o:/var/tmp/build/firefox-af0ca6a886c7/obj-mingw/dist/include/mozilla/throw_gcc.h:55: first defined here
/var/tmp/dist/mingw-w64/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/libstdc++.a(functexcept.o):/var/tmp/build/gcc/x86_64-w64-mingw32/libstdc++-v3
/src/c++11/../../../../gcc-5.4.0/libstdc++-v3/src/c++11/functexcept.cc:70: multiple definition of `std::__throw_bad_typeid()'
../misc/TimeStamp.o:/var/tmp/build/firefox-af0ca6a886c7/obj-mingw/dist/include/mozilla/throw_gcc.h:61: first defined here
/var/tmp/dist/mingw-w64/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/libstdc++.a(functexcept.o):/var/tmp/build/gcc/x86_64-w64-mingw32/libstdc++-v3
/src/c++11/../../../../gcc-5.4.0/libstdc++-v3/src/c++11/functexcept.cc:74: multiple definition of `std::__throw_logic_error(char const*)'
../misc/TimeStamp.o:/var/tmp/build/firefox-af0ca6a886c7/obj-mingw/dist/include/mozilla/throw_gcc.h:74: first defined here
/var/tmp/dist/mingw-w64/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/libstdc++.a(functexcept.o):/var/tmp/build/gcc/x86_64-w64-mingw32/libstdc++-v3
/src/c++11/../../../../gcc-5.4.0/libstdc++-v3/src/c++11/functexcept.cc:78: multiple definition of `std::__throw_domain_error(char const*)'
../misc/TimeStamp.o:/var/tmp/build/firefox-af0ca6a886c7/obj-mingw/dist/include/mozilla/throw_gcc.h:80: first defined here
/var/tmp/dist/mingw-w64/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/libstdc++.a(functexcept.o):/var/tmp/build/gcc/x86_64-w64-mingw32/libstdc++-v3/src/c++11/../../../../gcc-5.4.0/libstdc++-v3/src/c++11/functexcept.cc:82: multiple definition of `std::__throw_invalid_argument(char const*)'
../misc/TimeStamp.o:/var/tmp/build/firefox-af0ca6a886c7/obj-mingw/dist/include/mozilla/throw_gcc.h:86: first defined here
/var/tmp/dist/mingw-w64/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/libstdc++.a(functexcept.o):/var/tmp/build/gcc/x86_64-w64-mingw32/libstdc++-v3/src/c++11/../../../../gcc-5.4.0/libstdc++-v3/src/c++11/functexcept.cc:86: multiple definition of `std::__throw_length_error(char const*)'
../misc/TimeStamp.o:/var/tmp/build/firefox-af0ca6a886c7/obj-mingw/dist/include/mozilla/throw_gcc.h:92: first defined here
/var/tmp/dist/mingw-w64/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/libstdc++.a(functexcept.o):/var/tmp/build/gcc/x86_64-w64-mingw32/libstdc++-v3/src/c++11/../../../../gcc-5.4.0/libstdc++-v3/src/c++11/functexcept.cc:90: multiple definition of `std::__throw_out_of_range(char const*)'
../misc/TimeStamp.o:/var/tmp/build/firefox-af0ca6a886c7/obj-mingw/dist/include/mozilla/throw_gcc.h:98: first defined here
/var/tmp/dist/mingw-w64/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/libstdc++.a(functexcept.o):/var/tmp/build/gcc/x86_64-w64-mingw32/libstdc++-v3/src/c++11/../../../../gcc-5.4.0/libstdc++-v3/src/c++11/functexcept.cc:110: multiple definition of `std::__throw_runtime_error(char const*)'
../misc/TimeStamp.o:/var/tmp/build/firefox-af0ca6a886c7/obj-mingw/dist/include/mozilla/throw_gcc.h:104: first defined here
/var/tmp/dist/mingw-w64/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/libstdc++.a(functexcept.o):/var/tmp/build/gcc/x86_64-w64-mingw32/libstdc++-v3/src/c++11/../../../../gcc-5.4.0/libstdc++-v3/src/c++11/functexcept.cc:114: multiple definition of `std::__throw_range_error(char const*)'
../misc/TimeStamp.o:/var/tmp/build/firefox-af0ca6a886c7/obj-mingw/dist/include/mozilla/throw_gcc.h:110: first defined here
/var/tmp/dist/mingw-w64/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/libstdc++.a(functexcept.o):/var/tmp/build/gcc/x86_64-w64-mingw32/libstdc++-v3/src/c++11/../../../../gcc-5.4.0/libstdc++-v3/src/c++11/functexcept.cc:118: multiple definition of `std::__throw_overflow_error(char const*)'
../misc/TimeStamp.o:/var/tmp/build/firefox-af0ca6a886c7/obj-mingw/dist/include/mozilla/throw_gcc.h:116: first defined here
/var/tmp/dist/mingw-w64/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/libstdc++.a(functexcept.o):/var/tmp/build/gcc/x86_64-w64-mingw32/libstdc++-v3/src/c++11/../../../../gcc-5.4.0/libstdc++-v3/src/c++11/functexcept.cc:122: multiple definition of `std::__throw_underflow_error(char const*)'
../misc/TimeStamp.o:/var/tmp/build/firefox-af0ca6a886c7/obj-mingw/dist/include/mozilla/throw_gcc.h:122: first defined here
/var/tmp/dist/mingw-w64/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/libstdc++.a(functexcept.o):/var/tmp/build/gcc/x86_64-w64-mingw32/libstdc++-v3/src/c++11/../../../../gcc-5.4.0/libstdc++-v3/src/c++11/functexcept.cc:126: multiple definition of `std::__throw_ios_failure(char const*)'
../misc/TimeStamp.o:/var/tmp/build/firefox-af0ca6a886c7/obj-mingw/dist/include/mozilla/throw_gcc.h:128: first defined here
/var/tmp/dist/mingw-w64/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/libstdc++.a(functexcept.o):/var/tmp/build/gcc/x86_64-w64-mingw32/libstdc++-v3/src/c++11/../../../../gcc-5.4.0/libstdc++-v3/src/c++11/functexcept.cc:130: multiple definition of `std::__throw_system_error(int)'
../misc/TimeStamp.o:/var/tmp/build/firefox-af0ca6a886c7/obj-mingw/dist/include/mozilla/throw_gcc.h:134: first defined here
/var/tmp/dist/mingw-w64/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/libstdc++.a(functexcept.o):/var/tmp/build/gcc/x86_64-w64-mingw32/libstdc++-v3/src/c++11/../../../../gcc-5.4.0/libstdc++-v3/src/c++11/functexcept.cc:139: multiple definition of `std::__throw_bad_function_call()'
../misc/TimeStamp.o:/var/tmp/build/firefox-af0ca6a886c7/obj-mingw/dist/include/mozilla/throw_gcc.h:68: first defined here
collect2: error: ld returned 1 exit status
make[5]: *** [mozglue.dll] Error 1
I got reminded at bug 1332747. Not sure if there is a similar trick for this case. glandium: Or could you think of a different workaround we could test? Backing out the fix for bug 1269251 "solves" this problem but I suppose we should try to find a better solution.
Flags: needinfo?(mh+mozilla)
Hm. I assume MOZ_ALWAYS_INLINE_EVEN_DEBUG is not affecting non-debug builds, right? Otherwise we could try whether the fix for bug 1332747 solves this problem as well (which is happening in non-debug builds).
It seems like extending that ifdef __MINGW32__ to include mingw-w64 is fair game.
Flags: needinfo?(mh+mozilla)
It seems __MINGW32__ is defined on both x86 and x86_64 builds, so the ifdef __MINGW32__ should include mingw-w64.

However using the patch from bug 1332747 does not fix the problem.
Product: Core → Firefox Build System
This got actually fixed by bug 1443823 (see: https://bugzilla.mozilla.org/show_bug.cgi?id=1443823#c8), closing.
Status: NEW → RESOLVED
Closed: Last year
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.