Bug 16364 - Bug in R_PCRE autoconf macro can lead to linker errors when using system libz, libbz2
Summary: Bug in R_PCRE autoconf macro can lead to linker errors when using system libz...
Status: NEW
Alias: None
Product: R
Classification: Unclassified
Component: Installation (show other bugs)
Version: R 3.2.0
Hardware: All All
: P5 major
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2015-05-04 18:40 UTC by Leif Leonhardy
Modified: 2015-05-06 06:02 UTC (History)
1 user (show)

See Also:


Attachments
Patches m4/R.m4, and, just for convenience, also configure. (1.22 KB, patch)
2015-05-04 18:40 UTC, Leif Leonhardy
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Leif Leonhardy 2015-05-04 18:40:44 UTC
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'.
Comment 1 Leif Leonhardy 2015-05-04 18:51:30 UTC
P.S.:

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

../../lib/libR.so: undefined reference to `BZ2_bzReadGetUnused'
../../lib/libR.so: undefined reference to `BZ2_bzRead'
../../lib/libR.so: undefined reference to `BZ2_bzBuffToBuffCompress'
../../lib/libR.so: undefined reference to `BZ2_bzBuffToBuffDecompress'
../../lib/libR.so: undefined reference to `BZ2_bzWriteClose'
../../lib/libR.so: undefined reference to `BZ2_bzWriteOpen'
../../lib/libR.so: undefined reference to `BZ2_bzReadOpen'
../../lib/libR.so: undefined reference to `BZ2_bzDecompress'
../../lib/libR.so: undefined reference to `BZ2_bzDecompressEnd'
../../lib/libR.so: undefined reference to `BZ2_bzDecompressInit'
../../lib/libR.so: undefined reference to `BZ2_bzWrite'
../../lib/libR.so: undefined reference to `BZ2_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 to `inflateEnd'
../../lib/libR.so: undefined reference to `compress'
../../lib/libR.so: undefined reference to `deflate'
../../lib/libR.so: undefined reference to `inflateInit2_'
../../lib/libR.so: undefined reference to `inflate'
../../lib/libR.so: undefined reference to `crc32'
../../lib/libR.so: undefined reference to `deflateEnd'
../../lib/libR.so: undefined reference to `zlibVersion'
../../lib/libR.so: undefined reference to `deflateInit2_'
../../lib/libR.so: undefined reference to `uncompress'
collect2: error: ld returned 1 exit status
Makefile:153: recipe for target 'R.bin' failed
Comment 2 Leif Leonhardy 2015-05-06 06:02:01 UTC
(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.