Closed Bug 899948 Opened 11 years ago Closed 11 years ago

Build bustage on Windows when --disable-optimize is specified but not --enable-debug

Categories

(Core :: JavaScript Engine, defect)

x86_64
All
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: Gijs, Assigned: m_kato)

References

Details

Building with a mozconfig file that has --disable-optimize but not --enable-debug fails with this error:

11:20.38 msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: static double __cdecl std::numeric_limits<double>::max(void)" (?max@?$numeric_limits@N@std@@SANXZ) already defined in icuin.lib(digitlst.obj)
11:20.38
11:20.40    Creating library mozjs.lib and object mozjs.exp
11:20.40
11:20.40 mozjs.dll : fatal error LNK1169: one or more multiply defined symbols found

Removing --disable-optimize fixes it, and reports from IRC from markh indicate that builds with --enable-debug do also work.

(I also see:

11:20.40 LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
11:20.40

but I think I see that normally and it's unrelated)
Hmm.  We're just building ICU the "normal" way, not doing anything special here.  There's probably some sort of Windows-specific oddness to do that will fix this.  Ted, maybe you know something about Windows and can help, or at least can suggest someone better-suited to helping?
Waldo and I looked at this in the office on Friday, it boils down to:
http://mxr.mozilla.org/mozilla-central/source/js/src/configure.in#4320

Passing --disable-release (but not --enable-debug) to ICU's runConfigureICU script, which means it won't wind up using either of {RELEASE,DEBUG}_{CFLAGS,CXXFLAGS}:
http://mxr.mozilla.org/mozilla-central/source/intl/icu/source/runConfigureICU#244
http://mxr.mozilla.org/mozilla-central/source/intl/icu/source/runConfigureICU#345

...which means that it doesn't wind up passing any CRT options to the compiler, so it winds up with the default (static) CRT, which conflicts with our selection of the CRT DLL.

This is arguably a bug in upstream ICU, but we could work around it by only passing --disable-release when MOZ_DEBUG is true. I suggested removing lines 4323 and 4324 in js/src/configure.in to collapse those two conditionals, which should work around this issue.
BTW: I think this bug got a bit worse now that Bug 853301 is also enabled for normal desktop builds. This also breaks MSVC 2012/Windows 8 with a MT_StaticRelease vs. MD_DynamicRelease mismatch error when trying to link mozjs.dll. Unfortunately I do not have the exact error message handy anymore, but I can provide it if needed (it was certainly related to ICU). Maybe Bug 926083 is related, I'll try to find out (libxul fails to link for me with a very similiar error message even with normal optimize flags), but see that bug for more information.
OS: Windows 7 → All
Summary: Bug 853301 broke building with --disable-optimize on VS2010/Win7/SDK7 → Bug 853301 broke building with --disable-optimize on Windows
For reference: I think you can ignore the "is related" part in Comment 4, that bug was actually uncovered by another bug (even though it has a very similar error message).
Note Bug 915735, this might fix this bug here as I understand it. ICU might get a seperate shared library to fix another bug.
ping

Ted - are we still considering the option presented in comment 3?

Frank - Will the bug mentioned in comment 6 actually fix this issue?

Can I work around this issue by doing something sneaky like:
  ac_add_options --enable-optimize="-Od"
The above should disable optimization [1] but would trick configure into thinking we're still performing optimizations (maybe?). I started a build with this but I'll be asleep by the time it finishes so I'll let you know tomorrow whether it's a functioning workaround.

[1] http://msdn.microsoft.com/en-us/library/vstudio/aafb762y%28v=vs.100%29.aspx
I'm still awake! Also my build seems to have successfully completed!

Yay workarounds!
Tim: I think so, but to be sure we could ask in the mentioned bug ;)
Tim: feel free to implement my suggestion there. It seems like the most reasonable way to work around this. Also note bug 926760 which wants to get rid of runConfigureICU entirely (and may get fixed by way of bug 912371).
I've got my workaround, so I'm happy. I'll just mark this bug as depending on bug 926760. If others want this issue fixed before bug 926760 lands, we can revisit the suggestion in comment 3.
Depends on: 926760
Well, my workaround no longer works.

 0:14.47 msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: static double __cdecl std::numeric_limits<double>::infinity(void)" (?infinity@?$numeric_limits@N@std@@SANXZ) already defined in js_static.lib(digitlst.obj)
 0:14.47
 0:14.48    Creating library jsapi-tests.lib and object jsapi-tests.exp
 0:14.49
 0:14.50 LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
 0:14.50
 0:14.51 jsapi-tests.exe : fatal error LNK1169: one or more multiply defined symbols found
 0:14.52
 0:14.53 c:/src/mc2/js/src/config/rules.mk:768: recipe for target 'jsapi-tests.exe' failed
 0:14.53 mozmake.EXE[4]: *** [jsapi-tests.exe] Error 1169
 0:14.53 c:/src/mc2/js/src/config/recurse.mk:99: recipe for target 'jsapi-tests/binaries' failed
 0:14.54 mozmake.EXE[3]: *** [jsapi-tests/binaries] Error 2

I guess it's time to actually try to fix this
Summary: Bug 853301 broke building with --disable-optimize on Windows → Build bustage on Windows when --disable-optimize is specified but not --enable-debug
I think that this is fixed by bug 912371.  Does this issue still occur?
I was able to compile fine with --disable-optimize on latest fx-team.
(In reply to Rodrigo Silveira [:rsilveira] from comment #14)
> I was able to compile fine with --disable-optimize on latest fx-team.

Thank you for verified.
Assignee: general → m_kato
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.