Closed Bug 1243349 Opened 9 years ago Closed 9 years ago

Firefox fails to link against nspr libraries

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(firefox47 fixed)

RESOLVED FIXED
mozilla47
Tracking Status
firefox47 --- fixed

People

(Reporter: nbp, Assigned: ted)

References

Details

Attachments

(1 file)

After running "mach build --verbose", and pretty printing the command line (/…/ represent the build directory of an debug x64 build), I noticed that we are trying to link against nspr libraries, while not providing the correct directory path. I guess this implies that if the build is successful, we might be linking against system libraries, which is not possible while building on NixOS, as /lib does not exists. I think the problem might be that we give twice -L/…/dist/lib instead of giving -L/…/dist/bin, where libnspr4.so is located (even on Linux systems). gcc -shared -m64 -Wl,--gc-sections -Wl,-z,defs -Wl,-soname -Wl,libnssutil3.so -Wl,--version-script,/…/security/nss/lib/util/nssutil.def -o /…/security/nss/lib/util/libnssutil3.so /…/security/nss/lib/util/quickder.o […] /…/security/nss/lib/util/utilpars.o -L/…/dist/lib -L/…/dist/lib -lplc4 -lplds4 -lnspr4 -lpthread -ldl -lc 0:06.11 /nix/store/v7h3j43vx0dz5ahhkxg5z50by2iqc6k1-binutils-2.23.1/bin/ld: cannot find -lplc4 0:06.11 /nix/store/v7h3j43vx0dz5ahhkxg5z50by2iqc6k1-binutils-2.23.1/bin/ld: cannot find -lplds4 0:06.12 /nix/store/v7h3j43vx0dz5ahhkxg5z50by2iqc6k1-binutils-2.23.1/bin/ld: cannot find -lnspr4 0:06.12 collect2: error: ld returned 1 exit status $ find /…/dist -name lib\*.\* […] /…/dist/bin/libplds4.so […] /…/dist/bin/libnspr4.so […] /…/dist/bin/libplc4.so […]
Oops, I broke this in bug 1230117. Apparently this is working by accident on my machine and in automation by linking against the system NSPR libs (although we're packaging our NSPR libs, so we're using those). I have a patch that seems to work.
Assignee: nobody → ted
Blocks: 1230117
ted was able to find the cause where the library path is incorrectly set to dist/lib following a series of patches to remove the configure step from NSS. In the meantime the workaround is to set LD_LIBRARY_PATH to dist/bin. As I understand it, the reason it compiles successfully on CI is because the build machines have libnspr4-dev installed.
Summary: Firefox failed to link against nspr libraries. → Firefox fails to link against nspr libraries
Attachment #8712667 - Flags: review?(mh+mozilla) → review+
Comment on attachment 8712667 [details] MozReview Request: bug 1243349 - fix NSPR link paths for NSS. r?gps https://reviewboard.mozilla.org/r/32605/#review29331
That try push looks good, aside from some unrelated bustage I apparently picked up from inbound.
Flags: needinfo?(ted)
Comment on attachment 8712667 [details] MozReview Request: bug 1243349 - fix NSPR link paths for NSS. r?gps Review request updated; see interdiff: https://reviewboard.mozilla.org/r/32605/diff/1-2/
Attachment #8712667 - Attachment description: MozReview Request: bug 1243349 - fix NSPR link paths for NSS. r?glandium → MozReview Request: bug 1243349 - fix NSPR link paths for NSS. r?gps
Attachment #8712667 - Flags: review?(mshal)
Comment on attachment 8712667 [details] MozReview Request: bug 1243349 - fix NSPR link paths for NSS. r?gps https://reviewboard.mozilla.org/r/32605/#review29429 I don't see any issues here, though it's really hard to understand the impact on all the various configurations. Obviously that's not something we can easily fix first :)
Attachment #8712667 - Flags: review?(mshal) → review+
Status: NEW → ASSIGNED
Would bug 1183027 be a consequence of this ? I remember the link failure was explicitely during some nspr link.
Flags: needinfo?(ted)
It's related to the same code I just touched. Assuming B2G doesn't build --with-system-nspr that issue should no longer occur. The Makefile we use to build NSS does some fiddly text substitution with -L to find the directory containing NSPR libs: https://hg.mozilla.org/integration/mozilla-inbound/file/94a70f108d11/config/external/nss/Makefile.in#l100
Flags: needinfo?(ted)
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: