Bug#810579: nss: FTCBFS: defines LINUX based on uname
Steven Chamberlain
steven at pyro.eu.org
Sun Jan 10 00:13:29 UTC 2016
Package: nss
Version: 3.21-1
Severity: normal
Tags: patch
User: helmutg at debian.org
Usertags: rebootstrap
Hi,
Helmut Grohne pointed out to me that nss fails to cross-build for
non-Linux host architectures, from a Linux build system:
| i586-kfreebsd-gnu-gcc -o OBJS/Linux_SINGLE_SHLIB/sysrand.o -c -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall -pipe -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Di386 -DLINUX2_1 -Wall -Werror -pipe -ffunction-sections -fdata-sections -DHAVE_STRERROR -DLINUX -Dlinux -DXP_UNIX -DSHLIB_SUFFIX=\"so\" -DSHLIB_PREFIX=\"lib\" -DSHLIB_VERSION=\"3\" -DSOFTOKEN_SHLIB_VERSION=\"3\" -DRIJNDAEL_INCLUDE_TABLES -UDEBUG -DNDEBUG -D_REENTRANT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -DFREEBL_NO_DEPEND -DNSS_X86_OR_X64 -DNSS_X86 -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE -DMP_ASSEMBLY_DIV_2DX1D -DMP_USE_UINT_DIGIT -DMP_CHAR_STORE_SLOW -DMP_IS_LITTLE_ENDIAN -DMP_API_COMPATIBLE -I/usr/include/nspr -I/tmp/buildd/nss/nss-3.21/dist/include -I/tmp/buildd/nss/nss-3.21/dist/public/nss -I/tmp/buildd/nss/nss-3.21/dist/private/nss -Impi -Iecl sysrand.c
| In file included from sysrand.c:16:0:
| unix_rand.c:354:1: error: redefinition of 'GetHighResClock'
| GetHighResClock(void *buf, size_t maxbytes)
| ^
| In file included from sysrand.c:16:0:
| unix_rand.c:166:1: note: previous definition of 'GetHighResClock' was here
| GetHighResClock(void *buf, size_t maxbytes)
| ^
| In file included from sysrand.c:16:0:
https://jenkins.debian.net/job/rebootstrap_kfreebsd-i386_gcc5/43/console
This is the fault of debian/patches/38_kbsd.patch, which defines "LINUX"
based on the Makefile variable KERNEL, which in turn is derived from
`uname -s`. This may be incorrect for cross-building situations:
-OS_CFLAGS = $(STANDARDS_CFLAGS) $(DSO_CFLAGS) $(OS_REL_CFLAGS) $(ARCHFLAG) -Wall -Werror-implicit-function-declaration -Wno-switch -pipe -DLINUX -Dlinux -DHAVE_STRERROR
+OS_CFLAGS = $(STANDARDS_CFLAGS) $(DSO_CFLAGS) $(OS_REL_CFLAGS) $(ARCHFLAG) -Wall -Werror-implicit-function-declaration -Wno-switch -pipe -DHAVE_STRERROR
+ifeq ($(KERNEL),linux)
+OS_CFLAGS += -DLINUX -Dlinux
+endif
I suggest a cleaner solution that aliases macro "LINUX" to the preferred
modern one, __linux__ which, along with "linux", are defined already by
the build system only when actually compiling for Linux:
-OS_CFLAGS = $(STANDARDS_CFLAGS) $(DSO_CFLAGS) $(OS_REL_CFLAGS) $(ARCHFLAG) -Wall -Werror-implicit-function-declaration -Wno-switch -pipe -DLINUX -Dlinux -DHAVE_STRERROR
+OS_CFLAGS = $(STANDARDS_CFLAGS) $(DSO_CFLAGS) $(OS_REL_CFLAGS) $(ARCHFLAG) -Wall -Werror-implicit-function-declaration -Wno-switch -pipe -DLINUX=__linux__ -DHAVE_STRERROR
Attached is a replacement debian/patches/38_kbsd.patch with this change.
I've tested it natively on kfreebsd-amd64 and linux-amd64. It should be
correct for hurd also.
Thanks!
-- System Information:
Debian Release: stretch/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: kfreebsd-amd64 (x86_64)
Kernel: kFreeBSD 10.1-0-amd64
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 38_kbsd.patch
Type: text/x-diff
Size: 5071 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-mozilla-maintainers/attachments/20160110/c9763ee6/attachment-0001.patch>
More information about the pkg-mozilla-maintainers
mailing list