Closed Bug 728178 Opened 8 years ago Closed 8 years ago
.exe fails to link on on mingw (missing MOZ _Crash)
Landing of bug 717540 broke mingw compilation. I get errors like this during cross compiling on Linux: /usr/bin/python2.7 /home/jacek/mozilla-build/mozilla-central/js/src/config/pythonpath.py -I../config /home/jacek/mozilla-build/mozilla-central/js/src/config/expandlibs_exec.py --uselist -- i686-w64-mingw32-g++ -mwindows -o js.exe -fno-rtti -pedantic -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type -Wno-long-long -mms-bitfields -mstackrealign -fno-keep-inline-dllexport -pipe -DDEBUG -D_DEBUG -DTRACING -g -fno-omit-frame-pointer js.o jsworkers.o jsoptparse.o jsheaptools.o -static-libgcc -static-libstdc++ ../../../dist/lib/libmozglue.a -L../../../dist/bin -L../../../dist/lib -L/home/jacek/mozilla-build/mozilla-build/dist/lib -lnspr4 -lplc4 -lplds4 ../libjs_static.a -lgdi32 -lwinmm -lwsock32 ./libjs_static.a(OSAllocatorWin.o): In function `_ZN3WTF11OSAllocator18reserveUncommittedEjNS0_5UsageEbb': /home/jacek/mozilla-build/mozilla-central/js/src/yarr/OSAllocatorWin.cpp:52: undefined reference to `_MOZ_Crash' (followed by more such cases) I've checked and mozglue.dll properly exports MOZ_Crash, but for some reason linking fails. I've found that moving libmozglue.a inclusion after libjs_static.a helps here. It looks to me like ld bug, but maybe I'm missing something. I'd appreciate an opinion/suggestion on the attached patch/hack that fixes the problem for me.
Attachment #598199 - Flags: feedback?(mh+mozilla)
Attachment #598199 - Flags: feedback?(mh+mozilla) → feedback+
The attached version changes also order of arguments for DLLs building (which was required for 64-bit mingw builds). It builds on try: https://tbpl.mozilla.org/?tree=Try&rev=bdb093df4f37
Attachment #599071 - Flags: review?(mh+mozilla)
Attachment #599071 - Flags: review?(mh+mozilla) → review+
Thanks for the super-fast review! Pushed to m-i: https://hg.mozilla.org/integration/mozilla-inbound/rev/6b60e78b6f66
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla13
Compilation for similar reason still fails for some tests on 64-bit mingw. I've found that the reason linking is behaving so strange in this case is that ld doesn't consider libmozglue.dll.a to be import library unless it's linked by -l.. argument instead of directly by file name. The attached patch fixes it. I also had to change mfbt/Types.h, since it assumed that mingw GCC doesn't support dllimports (which it does).
Attachment #601936 - Flags: review?(mh+mozilla)
Attachment #601936 - Flags: review?(mh+mozilla) → review+
Thanks for the review, pushed to m-i: https://hg.mozilla.org/integration/mozilla-inbound/rev/1a6d1d4e8bfc (I forgot to mention earlier, here is try run: https://tbpl.mozilla.org/?tree=Try&rev=24b63ad50c3f)
Status: REOPENED → RESOLVED
Closed: 8 years ago → 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.