Hi,

I'm trying to understand the "correct" way to cross compile NSS.

The first approach I tried is based on firefox's
config/external/nss/Makefile.in where I found:

ifdef CROSS_COMPILE
DEFAULT_GMAKE_FLAGS += \
        NATIVE_CC='$(HOST_CC)' \
        CC='$(CC)' \
        CCC='$(CXX)' \
        LINK='$(LD)' \
        AS='$(AS)' \
        AR='$(AR) $(AR_FLAGS:$@=$$@)' \
        RANLIB='$(RANLIB)' \
        RC='$(RC) $(RCFLAGS)' \
        OS_ARCH='$(OS_ARCH)' \
        OS_TEST='$(OS_TEST)' \
        CPU_ARCH='$(TARGET_CPU)' \
        $(NULL)

i.e., override both the native compile NATIVE_CC) and cross compiler
(CC) using GNU make command line arguments.  Then, down in
security/nss/coreconf/nsinstall/Makefile (nsinstall needs to be built
native) can use them to set up the native compile vis:

ifdef NATIVE_CC
CC=$(NATIVE_CC)
endif
ifdef NATIVE_FLAGS
OS_CFLAGS=$(NATIVE_FLAGS)
endif

There are two things I'm not understanding with this technique:

- because CC was overridden on the command line, the CC=$(NATIVE_CC)
line gets ignored.  I ended up changing it to:

override CC=$(NATIVE_CC)

- puzzlingly NATIVE_FLAGS is not passed down, and when I did pass them
I found it didn't exactly help  I ended up overriding CFLAGS vis:

ifneq ($(origin NATIVE_FLAGS),undefined)
#override OS_CFLAGS=$(NATIVE_FLAGS)
override CFLAGS=$(NATIVE_FLAGS)
endif


The second technique I've found is to specify OS_TARGET=uClinux-dist
(say), and then add the file nss/coreconf/ucLinux-dist.mk which sets
things up for a cross compile.  With that, the "override" wasn't
needed but the CFLAGS= assignment was.

puzzled,

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

Reply via email to