user helm...@debian.org usertags 682926 + rebootstrap tags 682926 + patch thanks
On Sun, Sep 01, 2013 at 08:14:42AM +0900, Mike Hommey wrote: > How is that a problem? nsinstall is a tool used during the build to copy > files. You cannot execute host arch binaries during (cross) build. Thus nsinstall must be built using the build arch compiler. The same applies to coreconf. Unfortunately, this is not the only problem with cross building nss. debian/rules tries to execute the built shlibsign and modutil. These cannot be executed either in a cross build. I am attaching a patch that solves all of these problems. Please consider applying it. If you have any questions regarding the patch, don't hesitate to ask. It might not be the best solution, but it actually makes things build. Also note that the current package was potentially swallowing errors from shlibsign by chaining them using ";". The patch replaces that with $(call cmd,...) to make these potential errors visible. Could you also consider fixing #699217? Helmut
diff -Nru nss-3.17.2/debian/control nss-3.17.2/debian/control --- nss-3.17.2/debian/control +++ nss-3.17.2/debian/control @@ -3,7 +3,7 @@ Priority: optional Maintainer: Maintainers of Mozilla-related packages <pkg-mozilla-maintain...@lists.alioth.debian.org> Uploaders: Mike Hommey <gland...@debian.org> -Build-Depends: debhelper (>= 9), dpkg-dev (>= 1.16.1.1~), libnspr4-dev (>= 2:4.9.4), zlib1g-dev, libsqlite3-dev (>= 3.3.9) +Build-Depends: debhelper (>= 9), dpkg-dev (>= 1.16.1.1~), libnspr4-dev (>= 2:4.9.4), zlib1g-dev, libsqlite3-dev (>= 3.3.9), libnss3-tools:native <cross> Standards-Version: 3.9.3.0 Homepage: http://www.mozilla.org/projects/security/pki/nss/ Vcs-Git: git://git.debian.org/git/pkg-mozilla/nss.git diff -Nru nss-3.17.2/debian/patches/99_cross.patch nss-3.17.2/debian/patches/99_cross.patch --- nss-3.17.2/debian/patches/99_cross.patch +++ nss-3.17.2/debian/patches/99_cross.patch @@ -0,0 +1,45 @@ +Description: fix cross compilation +Author: Helmut Grohne <hel...@subdivi.de> + +Since nss unconditionally assigns to CC it must be forced upon nss via a +command line make parameter. Thus replacing CC with NATIVE_CC no longer works +unless adding the override directive. + +--- nss-3.17.2.orig/nss/coreconf/nsinstall/Makefile ++++ nss-3.17.2/nss/coreconf/nsinstall/Makefile +@@ -26,11 +26,14 @@ + endif + + ifdef NATIVE_CC +-CC=$(NATIVE_CC) ++override CC=$(NATIVE_CC) + endif + + ifdef NATIVE_FLAGS +-OS_CFLAGS=$(NATIVE_FLAGS) ++override CFLAGS=$(NATIVE_FLAGS) ++endif ++ifdef NATIVE_LFLAGS ++override LDFLAGS=$(NATIVE_LFLAGS) + endif + + include $(DEPTH)/coreconf/rules.mk +--- nss-3.17.2.orig/nss/coreconf/mkdepend/Makefile ++++ nss-3.17.2/nss/coreconf/mkdepend/Makefile +@@ -31,11 +31,14 @@ + endif + + ifdef NATIVE_CC +-CC=$(NATIVE_CC) ++override CC=$(NATIVE_CC) + endif + + ifdef NATIVE_FLAGS +-OS_CFLAGS=$(NATIVE_FLAGS) ++override CFLAGS=$(NATIVE_FLAGS) ++endif ++ifdef NATIVE_LFLAGS ++override LDFLAGS=$(NATIVE_LFLAGS) + endif + + include $(DEPTH)/coreconf/rules.mk diff -Nru nss-3.17.2/debian/patches/series nss-3.17.2/debian/patches/series --- nss-3.17.2/debian/patches/series +++ nss-3.17.2/debian/patches/series @@ -5,3 +5,4 @@ 95_add_spi+cacert_ca_certs.patch 97_SSL_RENEGOTIATE_TRANSITIONAL.patch 98_CVE-2014-1569.patch +99_cross.patch diff -Nru nss-3.17.2/debian/rules nss-3.17.2/debian/rules --- nss-3.17.2/debian/rules +++ nss-3.17.2/debian/rules @@ -1,7 +1,11 @@ #!/usr/bin/make -f include debian/make.mk +$(call lazy,DEB_HOST_ARCH,$$(shell dpkg-architecture -qDEB_HOST_ARCH)) +$(call lazy,DEB_BUILD_ARCH,$$(shell dpkg-architecture -qDEB_BUILD_ARCH)) $(call lazy,DEB_HOST_MULTIARCH,$$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)) +$(call lazy,DEB_BUILD_MULTIARCH,$$(shell dpkg-architecture -qDEB_BUILD_MULTIARCH)) +$(call lazy,DEB_HOST_GNU_TYPE,$$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)) $(call lazy,CFLAGS,$$(shell dpkg-buildflags --get CFLAGS)) $(call lazy,CPPFLAGS,$$(shell dpkg-buildflags --get CPPFLAGS)) $(call lazy,LDFLAGS,$$(shell dpkg-buildflags --get LDFLAGS)) @@ -20,6 +21,14 @@ debian/nss-config: EXTRA_REPLACES := s/@MOD_MAJOR_VERSION@/$(MOD_MAJOR_VERSION)/;s/@MOD_MINOR_VERSION@/$(MOD_MINOR_VERSION)/;s/@MOD_PATCH_VERSION@/$(MOD_PATCH_VERSION)/ debian/libnss3.lintian-overrides: EXTRA_REPLACES := s,/@DEB_HOST_MULTIARCH_WC@,$(DEB_HOST_MULTIARCH:%=/*),g +ifeq ($(origin CC),default) +export CC=$(DEB_HOST_GNU_TYPE)-cc +endif +ifeq ($(origin CXX),default) +export CXX=$(DEB_HOST_GNU_TYPE)-g++ +endif +export CCC=$(CXX) +RANLIB ?= $(DEB_HOST_GNU_TYPE)-ranlib ifneq (,$(filter 64 alpha amd64 ia64 s390x,$(shell dpkg-architecture -qDEB_HOST_ARCH_BITS 2> /dev/null || dpkg-architecture -qDEB_HOST_ARCH))) USE_64 := USE_64=1 else @@ -55,7 +63,12 @@ SOURCE_MD_DIR=$(DISTDIR) \ DIST=$(DISTDIR) \ BUILD_OPT=1 \ - NS_USE_GCC=1 \ + CC=$(CC) \ + NATIVE_CC=cc \ + NATIVE_FLAGS=-UNONEMPTY_NATIVE_FLAGS \ + NATIVE_LFLAGS=-UNONEMPTY_NATIVE_LFLAGS \ + CCC=$(CXX) \ + RANLIB=$(RANLIB) \ OPTIMIZER="$(CFLAGS) $(CPPFLAGS)" \ LDFLAGS='$(LDFLAGS) $$(ARCHFLAG) $$(ZDEFS_FLAG)' \ DSO_LDOPTS='-shared $$(LDFLAGS)' \ @@ -135,12 +140,22 @@ override_dh_strip: dh_strip -a --dbg-package=libnss3-dbg +ifeq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH)) + $(foreach lib,libsoftokn3.so libfreebl3.so libnssdbm3.so, \ + $(call cmd,LD_LIBRARY_PATH=debian/libnss3/usr/lib/$(DEB_HOST_MULTIARCH):debian/libnss3/usr/lib/$(DEB_HOST_MULTIARCH)/nss \ + debian/libnss3-tools/usr/bin/shlibsign -v -i debian/libnss3/usr/lib/$(DEB_HOST_MULTIARCH)/nss/$(lib))) +else $(foreach lib,libsoftokn3.so libfreebl3.so libnssdbm3.so, \ - LD_LIBRARY_PATH=debian/libnss3/usr/lib/$(DEB_HOST_MULTIARCH):debian/libnss3/usr/lib/$(DEB_HOST_MULTIARCH)/nss \ - debian/libnss3-tools/usr/bin/shlibsign -v -i debian/libnss3/usr/lib/$(DEB_HOST_MULTIARCH)/nss/$(lib);) + $(call cmd,LD_LIBRARY_PATH=/usr/lib/$(DEB_BUILD_MULTIARCH):/usr/lib/$(DEB_BUILD_MULTIARCH)/nss \ + /usr/bin/shlibsign -v -i debian/libnss3/usr/lib/$(DEB_HOST_MULTIARCH)/nss/$(lib))) +endif # Check FIPS mode correctly works mkdir debian/tmp +ifeq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH)) LD_LIBRARY_PATH=debian/libnss3/usr/lib/$(DEB_HOST_MULTIARCH):debian/libnss3/usr/lib/$(DEB_HOST_MULTIARCH)/nss debian/libnss3-tools/usr/bin/modutil -create -dbdir debian/tmp < /dev/null LD_LIBRARY_PATH=debian/libnss3/usr/lib/$(DEB_HOST_MULTIARCH):debian/libnss3/usr/lib/$(DEB_HOST_MULTIARCH)/nss debian/libnss3-tools/usr/bin/modutil -fips true -dbdir debian/tmp < /dev/null +else + /usr/bin/modutil -create -dbdir debian/tmp < /dev/null +endif override_dh_makeshlibs: /usr/share/debhelper/autoscripts/postinst-makeshlibs /usr/share/debhelper/autoscripts/postrm-makeshlibs