NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: NetBSD tools/gmp build.sh issues on Solaris-11.4



Hello, this bug seems to occur on SPARC Solaris and only when system
GCC compiler was configured to generate 64-bit binaries by default.

The configure script always selects 32-bit compiler flags, even if the
default compiler output is 64-bit. This can be overriden by
"--build=sparc64-sun-solaris2.11" configure option if building gmp by
hand. However, in this case, gmp is part of NetBSD cross-compiler
bootstrap and NetBSD relies on gmp to automatically figure out correct
build environment.

The result is such that NetBSD build.sh eventually fails, since gmp is
incorrectly compiled into 32-bit binaries.

Below is a demonstration of the issue:

$ echo $PATH
/opt/gcc/bin:/usr/xpg4/bin:/usr/bin:/usr/sbin

$ echo "int main(void) {}" > test.c && gcc -o test test.c

$ file ./test
./test: ELF 64-bit MSB executable SPARCV9 Version 1, UltraSPARC3
Extensions Required, dynamically linked, not stripped, no debugging
information available

$ ./configure
checking build system type... sparc-sun-solaris2.11
checking host system type... sparc-sun-solaris2.11
checking for a BSD-compatible install... /usr/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/gmkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... no
checking whether make supports nested variables... no
checking whether to enable maintainer-specific portions of Makefiles...
no checking ABI=32
checking compiler gcc -m32 -O2 -pedantic ... yes
checking compiler gcc -m32 -O2 -pedantic has sizeof(long)==4... yes
checking compiler gcc -m32 -O2 -pedantic  -mcpu=v7... yes
checking for gcc... gcc
checking whether the C compiler works... yes
...
using ABI="32"
      CC="gcc"
      CFLAGS="-m32 -O2 -pedantic -mcpu=v7"
      CPPFLAGS=""
      MPN_PATH=" sparc32 generic"

My current workaround is to edit gmp configure script and manually
set 64-bit build host:

ac_cv_build=sparc64-sun-solaris2.11

This at least allows NetBSD build.sh to correctly build gmp. However
proper fix is for gmp configure script to perform runtime compiler check
and if the output object format is 64-bit then select 64-bit ABI and
flags.


Home | Main Index | Thread Index | Old Index