Closed Bug 1243349 Opened 4 years ago Closed 4 years ago
Firefox fails to link against nspr libraries
58 bytes, text/x-review-board-request
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
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
Review commit: https://reviewboard.mozilla.org/r/32605/diff/#index_header See other reviews: https://reviewboard.mozilla.org/r/32605/
Attachment #8712667 - Flags: review?(mh+mozilla)
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
https://hg.mozilla.org/integration/mozilla-inbound/rev/b538734b6a1794e791c376196cd9212ba9835353 bug 1243349 - fix NSPR link paths for NSS. r=glandium
backed out for bustage like https://treeherder.mozilla.org/logviewer.html#?job_id=20574193&repo=mozilla-inbound
That try push looks good, aside from some unrelated bustage I apparently picked up from inbound.
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/
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+
https://hg.mozilla.org/integration/mozilla-inbound/rev/94a70f108d118a9a22ea6719e1c37867fedf49c7 bug 1243349 - fix NSPR link paths for NSS. r=mshal
Would bug 1183027 be a consequence of this ? I remember the link failure was explicitely during some nspr link.
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
You need to log in before you can comment on or make changes to this bug.