Closed Bug 728178 Opened 8 years ago Closed 8 years ago

js.exe fails to link on on mingw (missing MOZ_Crash)

Categories

(Firefox Build System :: General, defect)

x86
Windows 7
defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED
mozilla13

People

(Reporter: jacek, Assigned: jacek)

References

Details

(Whiteboard: [inbound])

Attachments

(3 files)

Attached patch fix v1.0Splinter Review
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+
Assignee: nobody → jacek
Attached patch fix v1.1Splinter Review
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
Whiteboard: [inbound]
https://hg.mozilla.org/mozilla-central/rev/6b60e78b6f66
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla13
Attached patch fix v2.0Splinter Review
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)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
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)
https://hg.mozilla.org/mozilla-central/rev/1a6d1d4e8bfc
Status: REOPENED → RESOLVED
Closed: 8 years ago8 years ago
Resolution: --- → FIXED
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.