Closed Bug 1165442 Opened 5 years ago Closed 5 years ago

VS2015 LINK : fatal error LNK1104: cannot open file 'mozglue.lib'

Categories

(Firefox Build System :: General, defect)

defect
Not set

Tracking

(firefox39 fixed, firefox40 fixed, firefox41 fixed)

RESOLVED FIXED
mozilla41
Tracking Status
firefox39 --- fixed
firefox40 --- fixed
firefox41 --- fixed

People

(Reporter: dmajor, Assigned: dmajor)

References

Details

Attachments

(1 file)

0:29.30 link -nologo -DLL -SUBSYSTEM:WINDOWS -DYNAMICBASE -LIBPATH:C:/build2/msys/s/vs2015/obj/vs2015/dist/lib -DEFAULTLIB:mozglue -OUT:libs -DEBUG -OPT:REF -OUT:C:/build2/msys/s/vs2015/obj/vs2015/security/nss/lib/ckfw/builtins/nssckbi.dll -DEBUG -OPT:REF -DEF:C:/build2/msys/s/vs2015/obj/vs2015/security/nss/lib/ckfw/builtins/nssckbi.def  -MAP  C:\\build2\\msys\\s\\vs2015\\obj\\vs2015\\security\\nss\\lib\\ckfw\\builtins\\anchor.obj C:\\build2\\msys\\s\\vs2015\\obj\\vs2015\\security\\nss\\lib\\ckfw\\builtins\\constants.obj C:\\build2\\msys\\s\\vs2015\\obj\\vs2015\\security\\nss\\lib\\ckfw\\builtins\\bfind.obj C:\\build2\\msys\\s\\vs2015\\obj\\vs2015\\security\\nss\\lib\\ckfw\\builtins\\binst.obj C:\\build2\\msys\\s\\vs2015\\obj\\vs2015\\security\\nss\\lib\\ckfw\\builtins\\bobject.obj C:\\build2\\msys\\s\\vs2015\\obj\\vs2015\\security\\nss\\lib\\ckfw\\builtins\\bsession.obj C:\\build2\\msys\\s\\vs2015\\obj\\vs2015\\security\\nss\\lib\\ckfw\\builtins\\bslot.obj C:\\build2\\msys\\s\\vs2015\\obj\\vs2015\\security\\nss\\lib\\ckfw\\builtins\\btoken.obj C:\\build2\\msys\\s\\vs2015\\obj\\vs2015\\security\\nss\\lib\\ckfw\\builtins\\certdata.obj C:\\build2\\msys\\s\\vs2015\\obj\\vs2015\\security\\nss\\lib\\ckfw\\builtins\\ckbiver.obj  C:\\build2\\msys\\s\\vs2015\\obj\\vs2015\\dist\\lib\\nssckfw.lib C:\\build2\\msys\\s\\vs2015\\obj\\vs2015\\dist\\lib\\nssb.lib  C:\\build2\\msys\\s\\vs2015\\obj\\vs2015\\dist\\lib\\plc4.lib C:\\build2\\msys\\s\\vs2015\\obj\\vs2015\\dist\\lib\\plds4.lib C:\\build2\\msys\\s\\vs2015\\obj\\vs2015\\dist\\lib\\nspr4.lib    C:\\build2\\msys\\s\\vs2015\\obj\\vs2015\\security\\nss\\lib\\ckfw\\builtins\\nssckbi.res
 0:29.32 C:/build2/msys/s/vs2015/obj/vs2015/_virtualenv/Scripts/python.exe C:/build2/msys/s/vs2015/config/nsinstall.py -t -m 644 C:/build2/msys/s/vs2015/obj/vs2015/security/nss/cmd/certutil/certutil.pdb C:/build2/msys/s/vs2015/obj/vs2015/dist/bin
 0:29.37 LINK : fatal error LNK1104: cannot open file 'mozglue.lib'

My mozglue.lib is under dist/sdk/lib, but this link is looking for it in dist/lib.

From irc:
<glandium> dmajor: there are two problems. One is that bug 1138824 didn't make the necessary change to config/external/nss/Makefile.in, which, in practice means building with mingw is likely broken
<glandium> the other, and it's more important, is that you don't have MOZ_CRT defined
What are the necessary changes to config/external/nss/Makefile.in? I'd like to remove that problem before diving into the MOZ_CRT stuff.
Flags: needinfo?(mh+mozilla)
Replace the LIBPATH with $(ABS_DIST)/../mozglue/build
Flags: needinfo?(mh+mozilla)
This works! The build finishes, and Firefox launches successfully. I observed calls to mozglue!je_malloc from both xul.dll and nss3.dll.

Given what you told me about MOZ_CRT, I don't understand why this works.
Attachment #8607175 - Flags: review?(mh+mozilla)
Attachment #8607175 - Flags: review?(mh+mozilla) → review+
Blocks: 1138824
We may want this uplifted to the branches where bug 1138824 is. That can land with a=npotb, that codepath is not used for firefox builds as we do them.
(In reply to David Major [:dmajor] from comment #3)
> Created attachment 8607175 [details] [diff] [review]
> Fix LIBPATH for NSS
> 
> This works! The build finishes, and Firefox launches successfully. I
> observed calls to mozglue!je_malloc from both xul.dll and nss3.dll.

I'd expect things to work, mostly, without MOZ_CRT, because most malloc/free will properly go through jemalloc. The problem we had is rooted to how the CRT itself is using malloc and free. Please read the comment in mozglue/crt/Makefile.in. This might not apply to the new CRT in 2015, but we have to make sure of it.
Aha, so here's why MOZ_CRT is not defined:
> C:\Program Files (x86)\Microsoft Visual Studio 14.0>dir /s /b crtdll.*
> File Not Found

Looks like there has been some refactoring for 2015. For example, the code that calls static initializers and DllMain is now in VC\crt\src\vcruntime\dll_dllmain.cpp.

Also, VS2015 opt builds define _malloc_crt/_free_crt to _malloc_base/_free_base. Those are actual functions exported from ucrtbase.dll. Does that mean the end of the yucky library hack?
(In reply to David Major [:dmajor] from comment #7)
> Does that mean the end of the yucky library hack?

Maybe it does. Or maybe it means worse problems. We'll see, I guess.
https://hg.mozilla.org/mozilla-central/rev/dffde8b2633a
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
(In reply to Mike Hommey [:glandium] from comment #4)
> We may want this uplifted to the branches where bug 1138824 is. That can
> land with a=npotb, that codepath is not used for firefox builds as we do
> them.

Ryan could I ask you to land this for me? My m-a and m-b trees aren't handy at the moment.
Flags: needinfo?(ryanvm)
Assignee: nobody → dmajor
Flags: needinfo?(ryanvm)
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.