Closed Bug 1551129 Opened 2 years ago Closed 2 years ago

Build with static linking on windows

Categories

(NSS :: Build, defect)

x86
Windows 10
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mt, Unassigned)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached file static-win.patch (obsolete) —

The --static flag to build.sh fails on windows for a few minor reasons. Nothing serious, but enough to derail our use of it in neqo.

Attachment #9064373 - Attachment is obsolete: true
Attachment #9064373 - Attachment is patch: false

I spent a little time trying to get builds running for neqo on windows and this
was a bit of a showstopper. A few build tweaks and it seems to be working fine.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 3.45

This change

     [ 'OS=="win"', {
       'libraries': [
-        'advapi32.lib',
+        '-ladvapi32',
       ],

causes Firefox builds to emit: lld-link: warning: ignoring unknown argument '-ladvapi32'

Should the change have been limited to cc_use_gnu_ld? Happy to file you a new bug but wanted to confirm the issue first.

Flags: needinfo?(mt)

And yet the builds work... Strange. I think that this is right. I'll fix it. Why gyp can't learn to be consistent, add its own -l or .lib as needed, is something that continues to disappoint me in this.

Flags: needinfo?(mt)

OK, I have looked into this.

NSS builds depend on this being there. It won't build without it. gyp correctly turns this into the right ninja instructions:

libs = /LIBPATH:"c:\code\dist\Debug\lib" advapi32.lib libnspr4.lib $
    libplc4.lib libplds4.lib

However, gecko builds don't rely on this because they already include advapi32.lib on the command line for other reasons. So the error, which appears in the Makefile backend for gyp is hidden. This is what is added to backend.mk:

OS_LIBS += -ladvapi32

Now to look at gyp code to work out what is going on.

OK, the specific gyp code is here: https://searchfox.org/mozilla-central/rev/9bb55ae4d808fc48afcf93f99da6a685265b86c6/python/mozbuild/mozbuild/frontend/gyp_reader.py#227

And now I need to pause for a bit. I'll open a bug on the gecko build system about this.

You need to log in before you can comment on or make changes to this bug.