Hi all,

I'm trying to build the NSS libraries on Mac OS 10.6.5, on a 64-bit machine, 
using the instructions here:
https://developer.mozilla.org/en/NSS_reference/Building_and_installing_NSS/Build_instructions

but using the source code from this archive rather than the cvs checkout:
http://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_12_9_RTM/src/nss-3.12.9-with-nspr-4.8.7.tar.gz

I can extract the archive fine, but when I try the "make nss_build_all" step, 
the build exits with an error:

> ncraike@ncraikework 15:27:40 ~/Installs/nss-3.12.9/mozilla/security/nss
> $ make nss_build_all
> cd ../coreconf ;  make
> ...
> drbg.c: In function ‘RNG_RandomUpdate’:
> drbg.c:516: error: size of array ‘arg’ is negative
> make[3]: *** [Darwin10.5.0_DBG.OBJ/Darwin_SINGLE_SHLIB/drbg.o] Error 1
> make[2]: *** [libs] Error 2
> make[1]: *** [libs] Error 2
> make: *** [libs] Error 2


The line in question (line 516 of mozilla/security/nss/lib/freebl/drbg.c) seems 
to be an assertion that a particular type is of an expected size:

> PR_STATIC_ASSERT(sizeof(size_t) <= 4);


If I write a quick C program to print sizeof(size_t), it prints "8". Should 
this assertion be failing? Is there some problem with building on a 64-bit 
machine? From the build instructions:

>  By default, NSS builds for the 32-bit environment on all platforms except 
> Alpha/OSF1.

Is this the case for Mac OS X? Is it possible to build the 32-bit version on a 
64-bit Mac? The Mac OS X man page for gcc describes an "Apple only" option 
-arch:

> -arch arch
>            Compile for the specified target architecture arch.  The allowable 
> values are
>            i386, x86_64, ppc and ppc64.


...but same error occurs (the failing assertion) if I run the make script with 
this option, as below:

> ncraike@ncraikework 15:54:40 ~/Installs/nss-3.12.9/mozilla/security/nss
> $ CC="gcc -arch i386" CXX="g++ -arch i386" make nss_build_all

If I set the USE_64 environment variable:

> ncraike@ncraikework 16:00:09 ~/Installs/nss-3.12.9/mozilla/security/nss
> $ USE_64=1 make nss_build_all


...the build does succeed without errors (creating a 
mozilla/dist/Darwin10.5.0_64_DBG.OBJ directory), but I assume this produces the 
64-bit version. I'd eventually like to include the built libraries in software 
deployed an any machine running Mac OS X 10.6, which may be Intel 32-bit or 
64-bit machines, so a build which works on both architectures would be 
preferred (either 32-bit or some kind of universal binary, I assume).

Should I be able to build the 32-bit version of NSS? Should this assertion be 
failing?

I'm also trying to build python-nss on Mac OS X, with some issues, and this may 
be something I ask about later. I also have a Stack Overflow question about the 
two issues as a whole, if this interests anyone (or is easier to read):
http://stackoverflow.com/questions/4733108/how-do-i-build-python-nss-and-nss-for-mac-os-x

I'm more experienced with Python than C, so if my problem is a simple build 
config error, sorry for the trouble.

Any help is greatly appreciated.

Regards,
Nathan Craike 
-- 
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to