Bug#810579: nss: FTCBFS: defines LINUX based on uname
Helmut Grohne
helmut at subdivi.de
Mon Jan 11 05:21:27 UTC 2016
Control: tags -1 - patch
Hi Steven,
On Sun, Jan 10, 2016 at 12:13:29AM +0000, Steven Chamberlain wrote:
> Helmut Grohne pointed out to me that nss fails to cross-build for
> non-Linux host architectures, from a Linux build system:
Thank you for working in this bug.
> 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.
I applied your patch in a temporary rebootstrap branch and it keeps
failing in the same way.
| 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 -DLINUX=__linux__ -DHAVE_STRERROR -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)
| ^
You can see that after applying your patch, the -DLINUX=__linux__ is
properly picked up. However specifying that macro still makes "#if
defined(LINUX)" succeed despite __linux__ not being defined. Given that
the present patch does not work, I am removing the patch tag. Please add
it back if you add another patch.
I very much like your approach of using __linux__ as it makes the build
more robust, but I fear that this will require textually replacing LINUX
with __linux__ in the source rather than using a macro indirection.
Helmut
More information about the pkg-mozilla-maintainers
mailing list