Re: Issues cross compiling NSS for arm undefined reference to, pthread_atfork

2019-09-06 Thread Hamish MB
I have since figured out how to do this by adding -Wl, --verbose, and it
shows the library that is being found is the right one, under /lib.

I also have checked that this file contains the required symbols:

readelf -Ws libpthread.so  | grep atfork    62:  0 FUNC   
GLOBAL DEFAULT  UND __register_atfork@GLIBC_2.4 (4)
   218: b46c    24 FUNC    GLOBAL DEFAULT   12 pthread_atfork@GLIBC_2.4
   366:  0 FILE    LOCAL  DEFAULT  ABS old_pthread_atfork.c
   764: b46c    24 FUNC    LOCAL  DEFAULT   12 __dyn_pthread_atfork
  1063: b46c    24 FUNC    GLOBAL DEFAULT   12 pthread_atfork@GLIBC_2.4
  1202:  0 FUNC    GLOBAL DEFAULT  UND
__register_atfork@@GLIBC_2.4

While I'm not familiar with this kind of thing, it does look to me like
pthread_atfork is present, so I'm not really sure what's going on. Does
anyone have any ideas?

Also I'm pretty sure I'm cross compiling this the wrong way - are there
instructions for doing it properly?

Hamish

-- 
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto


NSS 3.25.1 undefined reference to `pthread_atfork'

2019-09-06 Thread hamishmb
Hello,

I'm trying to cross-compile NSS for armv5, glibc 2.8, and Linux 2.6. I know 
this is an old platform, but it seems like it's almost working.

I've had to modify the coreconf/Linux.mk and coreconf/arch.mk files to specify 
the target architecture and kernel version, and use a special build command:

make CROSS_COMPILE=1 BUILD_OPT=1 
NSPR_INCLUDE_DIR=/home/wmt/nas-sysroot/usr/local/include/nspr/ 
USE_SYSTEM_ZLIB=1 ZLIB_LIBS=-lz CC="arm-unknown-linux-gnueabi-gcc 
--sysroot=/home/wmt/nas-sysroot" CXX="arm-unknown-linux-gnueabi-g++ 
--sysroot=/home/wmt/nas-sysroot" LD="arm-unknown-linux-gnueabi-ld 
--sysroot=/home/wmt/nas-sysroot" 
DEFAULT_COMPILER="arm-unknown-linux-gnueabi-gcc --sysroot=/home/wmt/nas-sysroot"

It seems like this very nearly works, but it fails with:

Linux2.6_arm_glibc_PTH_DBG.OBJ/pkcs11.o: In function `nsc_CommonInitialize':
/home/wmt/Downloads/nss-3.25.1/nss/lib/softoken/pkcs11.c:3022: undefined 
reference to `pthread_atfork'
collect2: error: ld returned 1 exit status

I'm wondering if there is a better way to cross compile. I've had difficulty 
finding instructions, but this is definitely a hacky way to achieve it.

I would appreciate any advice anyone has to offer with this - I'm pretty 
stumped at the moment.

Hamish
-- 
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto


Re: Issues cross compiling NSS for arm undefined reference to pthread_atfork

2019-09-06 Thread Hamish McIntyre-Bhatty
> The error is not about whether you have definitions in your header
> files; the error is about the linker being unable to find a definition
> for `pthread_atfork` in whatever libraries you're linking against.
> I'd check whether your LDFLAGS specified to `make` are actually
> getting through to your link command (and whether you're supposed to
> be using `-lpthread`, `-pthread`, or `-pthreads`...), what libraries
> your linker command is trying to link against, and whether those
> libraries contain the expected definitions.
> 
> -Nathan

I forgot to mention that -lpthread is in the linker command. The full linker 
commandline is:

arm-unknown-linux-gnueabi-gcc --sysroot=/home/wmt/nas-sysroot -shared  
-Wl,--gc-sections -Wl,-z,defs -Wl,-soname -Wl,libsoftokn3.so  
-Wl,--version-script,Linux2.6_arm_glibc_PTH_DBG.OBJ/softokn.def -o 
Linux2.6_arm_glibc_PTH_DBG.OBJ/libsoftokn3.so 
Linux2.6_arm_glibc_PTH_DBG.OBJ/fipsaudt.o 
Linux2.6_arm_glibc_PTH_DBG.OBJ/fipstest.o 
Linux2.6_arm_glibc_PTH_DBG.OBJ/fipstokn.o 
Linux2.6_arm_glibc_PTH_DBG.OBJ/lgglue.o Linux2.6_arm_glibc_PTH_DBG.OBJ/lowkey.o 
Linux2.6_arm_glibc_PTH_DBG.OBJ/lowpbe.o Linux2.6_arm_glibc_PTH_DBG.OBJ/padbuf.o 
Linux2.6_arm_glibc_PTH_DBG.OBJ/pkcs11.o 
Linux2.6_arm_glibc_PTH_DBG.OBJ/pkcs11c.o 
Linux2.6_arm_glibc_PTH_DBG.OBJ/pkcs11u.o Linux2.6_arm_glibc_PTH_DBG.OBJ/sdb.o 
Linux2.6_arm_glibc_PTH_DBG.OBJ/sftkdb.o 
Linux2.6_arm_glibc_PTH_DBG.OBJ/sftkhmac.o 
Linux2.6_arm_glibc_PTH_DBG.OBJ/sftkpars.o 
Linux2.6_arm_glibc_PTH_DBG.OBJ/sftkpwd.o 
Linux2.6_arm_glibc_PTH_DBG.OBJ/softkver.o 
Linux2.6_arm_glibc_PTH_DBG.OBJ/tlsprf.o 
Linux2.6_arm_glibc_PTH_DBG.OBJ/jpakesftk.o   ../../../dist/L
 inux2.6_arm_glibc_PTH_DBG.OBJ/lib/libfreebl.a  
-L../../../dist/Linux2.6_arm_glibc_PTH_DBG.OBJ/lib -lsqlite3 
-L../../../dist/Linux2.6_arm_glibc_PTH_DBG.OBJ/lib -lnssutil3 
-L../../../dist/Linux2.6_arm_glibc_PTH_DBG.OBJ/lib 
-L/home/wmt/nas-sysroot/usr/include/ -lplc4 -lplds4 -lnspr4  -lpthread  -ldl -lc

How can I check which library its trying to build with? It could be trying to 
use the host libraries I guess.

Hamish
-- 
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto


NSS 3.25.1 undefined reference to `pthread_atfork'

2019-09-06 Thread Hamish McIntyre-Bhatty
Hello,

I've been having issues cross compiling NSS 3.25.1 for an armv5 system that 
uses glibc 2.8 and Linux 2.6.31.8. An old platform, I know, but it seems to 
nearly be working. I've modified the coreconf/Linux.mk and coreconf/arch.mk 
files to use the target system's architecture and kernel version.

I keep encountering a problem during the build phase where I get this message:

Linux2.6_arm_glibc_PTH_DBG.OBJ/pkcs11.o: In function `nsc_CommonInitialize':
/home/wmt/Downloads/nss-3.25.1/nss/lib/softoken/pkcs11.c:3022: undefined 
reference to `pthread_atfork'
collect2: error: ld returned 1 exit status

My build command is as follows:

make CROSS_COMPILE=1 BUILD_OPT=1 
NSPR_INCLUDE_DIR=/home/wmt/nas-sysroot/usr/local/include/nspr/ 
USE_SYSTEM_ZLIB=1 ZLIB_LIBS=-lz CC="arm-unknown-linux-gnueabi-gcc 
--sysroot=/home/wmt/nas-sysroot" CXX="arm-unknown-linux-gnueabi-g++ 
--sysroot=/home/wmt/nas-sysroot" LD="arm-unknown-linux-gnueabi-ld 
--sysroot=/home/wmt/nas-sysroot" 
DEFAULT_COMPILER="arm-unknown-linux-gnueabi-gcc --sysroot=/home/wmt/nas-sysroot"

Does anyone have any ideas why this is happening? I have checked pthread.h and 
it does contain a definition for this function.

Hamish
-- 
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto