On 01/22/2011 04:58 AM, Kaspar Brand wrote: > On 20.1.11 20:57, Robert Relyea wrote: >> On 01/19/2011 10:36 PM, Kaspar Brand wrote: >>> That's certainly doable, but I don't think the NSS build system has >>> support for building universal binaries (you'd have to fiddle with lipo >>> yourself). >> I think it depends on what the Mac compiler kicks out. On Windows or >> Linux, the non-64 bit builds automatically set the compiler to produce >> 32-bit binaries unless the USE_64 is set. > By default, GCC on OS X does not create universal binaries. Starting > with 10.6 (Snow Leopard), the default changed from 32 to 64 bit, though. > >> My guess is that no one has set the compiler flags correct for building >> 32-bit binaries on Mac 64. > That's a perfect guess, yes: > >> If you have the proper changes to coreconf to produce 32 bits on a Mac >> 64 bit system, we would certainly be interested. > I think something like the attached patches (not only for NSS, but also > for NSPR) should do the trick. Adding "-arch" options shouldn't hurt for > older OS X versions. > > Building universal binaries for NSS in a single step, on the other hand, > is something which doesn't work properly yet. In theory, this could be > achieved by setting CC="gcc -arch x86_64 -arch i386" with the make > command (which instructs GCC to compile separate versions and assemble > them with lipo afterwards), but this will currently fail at drbg.c: > >> gcc -arch x86_64 -arch i386 -o >> Darwin10.6.0_OPT.OBJ/Darwin_SINGLE_SHLIB/drbg.o -c -O2 -fPIC -Di386 -Wall >> -fno-common -pipe -DDARWIN -DHAVE_STRERROR -DHAVE_BSD_FLOCK -DXP_UNIX >> -DSHLIB_SUFFIX=\"dylib\" -DSHLIB_PREFIX=\"lib\" -DSHLIB_VERSION=\"3\" >> -DSOFTOKEN_SHLIB_VERSION=\"3\" -DRIJNDAEL_INCLUDE_TABLES -UDEBUG -DNDEBUG >> -DNSS_ENABLE_ECC -DUSE_UTIL_DIRECTLY -DMP_API_COMPATIBLE >> -I../../../../dist/Darwin10.6.0_OPT.OBJ/include >> -I../../../../dist/public/nss -I../../../../dist/private/nss -Impi -Iecl >> drbg.c >> drbg.c: In function 'RNG_RandomUpdate': >> drbg.c:516: error: size of array 'arg' is negative > Looking at the current logic in drgb.c > >> #if defined(NS_PTR_GT_32) || (defined(NSS_USE_64) && !defined(NS_PTR_LE_32)) >> PR_STATIC_ASSERT(sizeof(size_t) > 4); >> #else >> PR_STATIC_ASSERT(sizeof(size_t) <= 4); >> #endif > this is due to GCC trying to compile for x86_64, but without NSS_USE_64 > being set. Maybe this could be addressed by modifications to drbg.c? > (Adding USE_64=1 to the make command won't help, because that makes the > i386 part fail.) > > Kaspar If this is the only place where Universal fails, then we can set NS_PTR_GR_32 for the universal binary. I'm a little worried that we'll get something suboptimal for the 64 bit case. Does mozilla build univeral binaries and how do the get them. (I always thought the universal binaries were built by building each arch separately and then combining them at the end).
bob
-- dev-tech-crypto mailing list dev-tech-crypto@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-tech-crypto