MichaelChirico / r-bugs

A ⚠️read-only⚠️mirror of https://bugs.r-project.org/
20 stars 0 forks source link

[BUGZILLA #16364] Bug in R_PCRE autoconf macro can lead to linker errors when using system libz, libbz2 #5766

Open MichaelChirico opened 4 years ago

MichaelChirico commented 4 years ago

Created attachment 1822 [details] Patches m4/R.m4, and, just for convenience, also configure.

When configuring R to use the system libraries of libz and/or libbz2 (the default when they're available and recent enough), 'configure' may lose '-lz' and/or '-lbz2' from LIBS on the way, which later leads to linker errors, since libR.so doesn't get linked against these. (Linking the R binary fails due to undefined symbols from these libraries, referenced from libR.so.)

Trivial patch fixing this attached. (Only restore LIBS from r_save_LIBS when they've really been saved in the same test, R_PCRE.)

Work-around: Configure with '--without-system-bzlib --without-system-zlib'.


METADATA

MichaelChirico commented 4 years ago

P.S.:

Missing symbols from libbz2 (in case '-lbz2' vanished):

../../lib/libR.so: undefined reference to BZ2_bzReadGetUnused' ../../lib/libR.so: undefined reference toBZ2_bzRead' ../../lib/libR.so: undefined reference to BZ2_bzBuffToBuffCompress' ../../lib/libR.so: undefined reference toBZ2_bzBuffToBuffDecompress' ../../lib/libR.so: undefined reference to BZ2_bzWriteClose' ../../lib/libR.so: undefined reference toBZ2_bzWriteOpen' ../../lib/libR.so: undefined reference to BZ2_bzReadOpen' ../../lib/libR.so: undefined reference toBZ2_bzDecompress' ../../lib/libR.so: undefined reference to BZ2_bzDecompressEnd' ../../lib/libR.so: undefined reference toBZ2_bzDecompressInit' ../../lib/libR.so: undefined reference to BZ2_bzWrite' ../../lib/libR.so: undefined reference toBZ2_bzlibVersion' ../../lib/libR.so: undefined reference to `BZ2_bzReadClose' collect2: error: ld returned 1 exit status Makefile:153: recipe for target 'R.bin' failed

Missing symbols from libz (in case '-lz' vanished):

../../lib/libR.so: undefined reference to inflateReset' ../../lib/libR.so: undefined reference toinflateEnd' ../../lib/libR.so: undefined reference to compress' ../../lib/libR.so: undefined reference todeflate' ../../lib/libR.so: undefined reference to inflateInit2_' ../../lib/libR.so: undefined reference toinflate' ../../lib/libR.so: undefined reference to crc32' ../../lib/libR.so: undefined reference todeflateEnd' ../../lib/libR.so: undefined reference to zlibVersion' ../../lib/libR.so: undefined reference todeflateInit2_' ../../lib/libR.so: undefined reference to `uncompress' collect2: error: ld returned 1 exit status Makefile:153: recipe for target 'R.bin' failed


METADATA

MichaelChirico commented 4 years ago

(In reply to Leif Leonhardy from comment #0)

Work-around:  Configure with '--without-system-bzlib --without-system-zlib'.

Alternatively, and probably better, '--without-system-pcre' will bypass the 'configure' test that causes the trouble, still allowing to use the system's libz and/or libbz2.


METADATA