Closed Bug 1346602 Opened 4 years ago Closed 4 years ago

GYP: NSS no longer builds on BSDs

Categories

(NSS :: Build, defect)

3.29
Unspecified
FreeBSD
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jbeich, Assigned: jbeich)

References

Details

(Keywords: regression)

Attachments

(1 file)

$ ./build.sh
NSPR [1/3] configure ...
NSPR [2/3] make ...
NSPR [3/3] install ...
ninja: Entering directory `out/Debug'
[407/899] SOLINK ../dist/Debug/lib/libfreebl3.so
FAILED: ../dist/Debug/lib/libfreebl3.so ../dist/Debug/lib/libfreebl3.so.TOC
if [ ! -e ../dist/Debug/lib/libfreebl3.so -o ! -e ../dist/Debug/lib/libfreebl3.so.TOC ]; then cc-shared -Wl,-Bsymbolic -Wl,--version-script,obj/lib/freebl/freebl3.gen/out.freebl.def -Wl,--gc-sections -Wl,--warn-unresolved-symbols -Wl,-z,defs -m64 -o ../dist/Debug/lib/libfreebl3.so -Wl,-soname=libfreebl3.so @../dist/Debug/lib/libfreebl3.so.rsp && { readelf -d ../dist/Debug/lib/libfreebl3.so| grep SONAME ; nm -gD -f p ../dist/Debug/lib/libfreebl3.so | cut -f1-2 -d' '; } > ../dist/Debug/lib/libfreebl3.so.TOC; else cc -shared -Wl,-Bsymbolic -Wl,--version-script,obj/lib/freebl/freebl3.gen/out.freebl.def -Wl,--gc-sections -Wl,--warn-unresolved-symbols -Wl,-z,defs -m64 -o ../dist/Debug/lib/libfreebl3.so -Wl,-soname=libfreebl3.so @../dist/Debug/lib/libfreebl3.so.rsp && { readelf -d ../dist/Debug/lib/libfreebl3.so | grep SONAME ; nm -gD -f p ../dist/Debug/lib/libfreebl3.so | cut -f1-2 -d' '; } > ../dist/Debug/lib/libfreebl3.so.tmp && if ! cmp -s ../dist/Debug/lib/libfreebl3.so.tmp ../dist/Debug/lib/libfreebl3.so.TOC; then mv ../dist/Debug/lib/libfreebl3.so.tmp ../dist/Debug/lib/libfreebl3.so.TOC ; fi; fi
obj/lib/freebl/freebl3.sysrand.o: In function `RNG_SystemInfoForRNG':
out/Debug/../../lib/freebl/unix_rand.c:872: undefined reference to `environ'
out/Debug/../../lib/freebl/unix_rand.c:880: undefined reference to `environ'
out/Debug/../../lib/freebl/unix_rand.c:882: undefined reference to `environ'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
[416/899] CC obj/lib/sqlite/sqlite.sqlite3.o
ninja: build stopped: subcommand failed.
Summary: GYP: no longer builds on BSDs → GYP: NSS no longer builds on BSDs
Keywords: regression
Isnt it the same thing as #1321317 ?
Attached patch v0Splinter Review
Doh, I didn't notice the order of flags changed.

https://treeherder.mozilla.org/#/jobs?repo=nss-try&revision=d0ae97e800a0
Attachment #8846588 - Flags: review?(ttaubert)
Comment on attachment 8846588 [details] [diff] [review]
v0

Review of attachment 8846588 [details] [diff] [review]:
-----------------------------------------------------------------

::: coreconf/config.gypi
@@ +223,5 @@
>                    '-Wl,-z,defs',
>                  ],
> +               'conditions': [
> +                 ['OS=="dragonfly" or OS=="freebsd" or OS=="netbsd" or OS=="openbsd"', {
> +                   # Bug 1321317 - unix_rand.c:880: undefined reference to `environ'

So... previously the condition here was:

if (cc_use_gnu_ld==1) {
  if (OS==dragonfly|*bsd) {
    ...
  }
  if (no_zdefs==0) {
    ...
  }
}

Now we have:

if (cc_use_gnu_ld==1) {
  if (no_zdefs==0) {
    if (OS==dragonfly|*bsd) {
      ...
    }
  }
}

Is that how you want it to be? I don't know which flags you exactly build with. It just seems weird that you now also need -Dno_zdefs=0 instead of previously only -Dcc_use_gnu_ld=1?
Here's an example that works on Linux or GNU/kFreeBSD but not on FreeBSD. Try adding -Wl,--warn-unresolved-symbols at various argument positions.

$ cat a.c
extern char **environ;
int puts(const char *);
void foo() {
  puts(*environ);
}

$ cc -fPIC -shared -Wl,-z,defs a.c -o a.so
/tmp/a-6e65a2.o: In function `foo':
a.c:(.text+0xb): undefined reference to `environ'
cc: error: linker command failed with exit code 1 (use -v to see invocation)

(In reply to Tim Taubert [:ttaubert] from comment #4)
> So... previously the condition here was:
>
> if (cc_use_gnu_ld==1) {
>   if (OS==dragonfly|*bsd) {
>     ...
>   }
>   if (no_zdefs==0) {
>     ...
>   }
> }

-Wl,--warn-unresolved-symbols is only required if -Wl,-z,defs And no_zdefs==0 check didn't exist before bug 1330655. Going with pseudo-code it'd be

if (cc_use_gnu_ld==1) {
  ... -Wl,-z,defs ...
  if (OS==dragonfly|*bsd) {
    ...
  }
}

>
> Now we have:
>
> if (cc_use_gnu_ld==1) {
>   if (no_zdefs==0) {
      ... -Wl,-z,defs ...
>     if (OS==dragonfly|*bsd) {
>       ...
>     }
>   }
> }
>
> Is that how you want it to be? I

Correct.

> also need -Dno_zdefs=0 instead of previously only -Dcc_use_gnu_ld=1?

Because -Wl,-z,defs was previously under -Dcc_use_gnu_ld=1.
Comment on attachment 8846588 [details] [diff] [review]
v0

Review of attachment 8846588 [details] [diff] [review]:
-----------------------------------------------------------------

Makes sense. Thanks for explaining.
Attachment #8846588 - Flags: review?(ttaubert) → review+
Do you want me to land this for you?
Flags: needinfo?(jbeich)
Yes, if possible also backport to 3.29 to help testing GYP build downstream.
Flags: needinfo?(jbeich)
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Assignee: nobody → jbeich
You need to log in before you can comment on or make changes to this bug.