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
- abicheck.sh: Don't export CHOST if it wasn't already exported. Fixes https://github.com/zlib-ng/zlib-ng/issues/1219 — committed to dankegel/zlib-ng by dankegel 2 years ago
- abicheck.sh: don't export CHOST if it wasn't already exported. This fixes https://github.com/zlib-ng/zlib-ng/issues/1219, a regression when running abicheck.sh with default compiler. — committed to dkegel-fastly/zlib-ng by dankegel 2 years ago
- abicheck.sh: don't export CHOST if it wasn't already exported. This fixes https://github.com/zlib-ng/zlib-ng/issues/1219, a regression when running abicheck.sh with default compiler. — committed to dankegel/zlib-ng by dankegel 2 years ago
- abicheck.sh: don't export CHOST if it wasn't already exported. This fixes https://github.com/zlib-ng/zlib-ng/issues/1219, a regression when running abicheck.sh with default compiler. — committed to zlib-ng/zlib-ng by dankegel 2 years ago
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.