Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 927138

Summary: dev-libs/nss-3.91 fails to build with musl: undefined reference to `PR_SetError'
Product: Gentoo Linux Reporter: jonys <vidra.jonas>
Component: Current packagesAssignee: Mozilla Gentoo Team <mozilla>
Status: UNCONFIRMED ---    
Severity: normal CC: vidra.jonas
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: emerge --info
build.log

Description jonys 2024-03-16 11:32:07 UTC
When compiling dev-libs/nss-3.91 for powerpc-gentoo-linux-musl, the build fails with
```
powerpc-gentoo-linux-musl-gcc  -shared  -Wl,--gc-sections -Wl,-z,defs -Wl,-soname -Wl,libfreebl3.so  -Wl,--version-script,Linux6.6_ppc_powerpc-gentoo-linux-musl-gcc_glibc_PTH_OPT.OBJ/Linux_SINGLE_SHLIB/freebl.def -Wl,-Bsymbolic -Wl,-O1 -Wl,--as-needed  -z noexecstack  -z noexecstack  -z noexecstack  -z noexecstack  -z noexecstack  -z noexecstack  -z noexecstack  -z noexecstack  -z noexecstack  -z noexecstack  -z noexecstack  -z noexecstack -o Linux6.6_ppc_powerpc-gentoo-linux-musl-gcc_glibc_PTH_OPT.OBJ/Linux_SINGLE_SHLIB/libfreebl3.so Linux6.6_ppc_powerpc-gentoo-linux-musl-gcc_glibc_PTH_OPT.OBJ/Linux_SINGLE_SHLIB/lowhash_vector.o      -ldl -lc
/usr/lib/gcc/powerpc-gentoo-linux-musl/13/../../../../powerpc-gentoo-linux-musl/bin/ld: Linux6.6_ppc_powerpc-gentoo-linux-musl-gcc_glibc_PTH_OPT.OBJ/Linux_SINGLE_SHLIB/lowhash_vector.o: in function `loader_GetOriginalPathname':
/var/tmp/portage/dev-libs/nss-3.91/work/nss-3.91/nss-.ppc/lib/freebl/genload.c:46:(.text.loader_GetOriginalPathname+0x98): undefined reference to `PR_SetError'
collect2: error: ld returned 1 exit status
make[5]: *** [../../coreconf/rules.mk:204: Linux6.6_ppc_powerpc-gentoo-linux-musl-gcc_glibc_PTH_OPT.OBJ/Linux_SINGLE_SHLIB/libfreebl3.so] Error 1
make[5]: Leaving directory '/var/tmp/portage/dev-libs/nss-3.91/work/nss-3.91/nss-.ppc/lib/freebl'
make[4]: *** [Makefile:711: freebl_NEED_STUB_BUILD] Error 2
```

The function PR_SetError is part of nspr (specifically, libnspr4.so), but the linker command in question doesn't link it. Passing LDFLAGS='-lnspr4' to emerge doesn't work around the problem, because strip-flags removes it before the build starts.

Commenting out the single function call responsible for the error does work, see the patch in https://lore.kernel.org/all/20240112192003.1004726-1-fontaine.fabrice@gmail.com/T/ (and the associated thread). The message also indicates that the error might not be specific to powerpc (I have no other musl systems to confirm this).

Reproducible: Always
Comment 1 jonys 2024-03-16 11:32:46 UTC
Created attachment 887746 [details]
emerge --info
Comment 2 jonys 2024-03-16 11:33:29 UTC
Created attachment 887747 [details]
build.log