autc04 / Retro68

a gcc-based cross-compiler for classic 68K and PPC Macintoshes
GNU General Public License v3.0
537 stars 51 forks source link

autoconf tests fail due to zero-length output #233

Closed agoode closed 2 months ago

agoode commented 4 months ago

I am trying to build GMP from nix (nix build github:autc04/Retro68#pkgsCross.m68k.gmp).

I've noticed that many of the autoconf tests fail to find functions that I know should be there:

checking for alarm... no
checking for attr_get... no
checking for clock... no
checking for cputime... no
checking for getpagesize... no
checking for getrusage... no
checking for gettimeofday... no
checking for getsysinfo... no
checking for localeconv... no
checking for memset... no
checking for mmap... no
checking for mprotect... no
checking for nl_langinfo... no
checking for obstack_vprintf... no
checking for popen... no
checking for processor_info... no
checking for pstat_getprocessor... no
checking for raise... no
checking for read_real_time... no
checking for sigaction... no
checking for sigaltstack... no
checking for sigstack... no
checking for syssgi... no
checking for strchr... no
checking for strerror... no
checking for strnlen... no
checking for strtol... no
checking for strtoul... no
checking for sysconf... no
checking for sysctl... no
checking for sysctlbyname... no
checking for times... no
checking for library containing clock_gettime... no
checking for vsnprintf... no

This seems to be because test -s only sees the output as a zero-length file:

++ ac_try_echo='configure:24676: m68k-apple-macos-gcc -o conftest -O2 -pedantic -fomit-frame-pointer -m68000   conftest.c  >&5'
+ printf '%s\n' 'configure:24676: m68k-apple-macos-gcc -o conftest -O2 -pedantic -fomit-frame-pointer -m68000   conftest.c  >&5'
+ ac_status=0
+ test -s conftest.err
+ grep -v '^ *+' conftest.err
+ cat conftest.er1
+ mv -f conftest.er1 conftest.err
+ printf '%s\n' 'configure:24676: $? = 0'
+ test 0 = 0
+ test -z ''
+ test -s conftest
+ printf '%s\n' 'configure: failed program was:'

Could we maybe stick a short message in the otherwise empty data fork? Or a \0 byte? We just need to make the file non-zero length.

(I can confirm that this does fix building GMP, see https://github.com/agoode/Retro68/commit/945dfb28c9da2fcb4331d76e89c236128feedec1)