zlib-ng: Regression: abicheck.sh fails with strange compilation error when building zlib-ng

Symptom:

$ sh test/abicheck.sh --refresh-if
...
/usr/bin/ld: zutil.lo: warning: relocation against `zng_z_errmsg' in read-only section `.text'
/usr/bin/ld: adler32.lo: relocation R_X86_64_PC32 against symbol `functable' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make: *** [Makefile:268: libz-ng.so.2.0.0] Error 1

This appears to be because exporting CHOST causes zlib-ng’s configure script to set CROSS_PREFIX, and then the test

if test "$gcc" -eq 1 && ($cc $CFLAGS -c $test.c) >> configure.log 2>&1; then

fails because the host compiler isn’t available with a cross name, leading to a whole big block of code getting skipped, including the code that adds -fPIC.

Looks like this is a regression introduced by https://github.com/zlib-ng/zlib-ng/commit/a1a807b814e9b1990dda4f80ebc73896c5410acd

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 21 (11 by maintainers)

Commits related to this issue

Most upvoted comments

OK! After reviewing https://github.com/zlib-ng/zlib-ng/issues/705#issuecomment-766523874, I think:

Canonicalization is still a good idea, so the .abi file can have a consistent name, but exporting in the no-chost case causes the observed problem. So my proposed fix of simply dropping the word export is probably optimal.

I will draft a fresh PR accordingly. Thank you for the careful review and the details.