ship versioned tbb libraries on linux again#260
Merged
Conversation
The oneTBB cmake build only versions its output on Windows, so on Linux RcppParallel 6.0.x installed unversioned libraries (e.g. 'libtbb.so' with SONAME 'libtbb.so'). RcppParallel 5.1.11 and earlier shipped a real 'libtbb.so.2' plus a 'libtbb.so' redirect, inherited from Intel TBB's make-based build (which set the SONAME from TBB_COMPATIBLE_INTERFACE_VERSION). Binaries compiled against those releases recorded a load-time dependency on 'libtbb.so.2', and so fail to load after an upgrade with "libtbb.so.2: cannot open shared object file". Restore the versioned layout for the bundled TBB on Linux by renaming 'libtbb*.so' to 'libtbb*.so.2' and re-creating 'libtbb*.so' as a symlink. A symlink (rather than a linker script) is used so the name resolves at runtime as well as at link time.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Linux, RcppParallel 6.0.x installs unversioned TBB libraries —
libtbb.sowith SONAMElibtbb.so, and nolibtbb.so.2. This is a regression from 5.1.11 and earlier, which shipped a reallibtbb.so.2plus alibtbb.soredirect.The cause is the oneTBB cmake build: it only versions its output under
if (WIN32)(OUTPUT_NAME "tbb${TBB_BINARY_VERSION}") and sets noSOVERSION, so Linux/macOS get the bare target name. 5.1.11's versioned layout was never something RcppParallel did explicitly — it came from Intel TBB's make-based build (build/linux.incset the SONAME suffix fromTBB_COMPATIBLE_INTERFACE_VERSION, i.e.2, andMakefile.tbbemittedlibtbb.soas anINPUT(libtbb.so.2)linker script).Binaries compiled against RcppParallel ≤ 5.1.11 recorded a load-time dependency on
libtbb.so.2. After an upgrade to 6.0.x that file no longer exists, so they fail to load:This was reported by the CRAN maintainer during revdep checking on Fedora.
Fix
For the bundled TBB on Linux only, after copying the libraries, rename each real unversioned
libtbb*.sotolibtbb*.so.2and re-createlibtbb*.soas a relative symlink pointing back at it. This restores the historical layout so legacyNEEDED libtbb.so.2dependencies resolve again.INPUT(...)) works at link time but the dynamic loader can't parse it, so it would fail at runtime — and 6.0.x'sRcppParallel.soitself hasNEEDED libtbb.so.Verification
Rebuilt into a temporary library on Linux:
libtbb.so.2(real) +libtbb.so -> libtbb.so.2fortbb,tbbmalloc, andtbbmalloc_proxy.setThreadOptions()works;tbbLibraryPath("tbb")returns the.so.2.RcppParallel.so's ownNEEDED libtbb.soresolves via the new symlink.NEEDED libtbb.so.2(mimicking a 5.1.11-built revdep) now resolves the file against the new install — the load error is gone.Note
Giving the new-ABI oneTBB the legacy
.so.2name means an old binary now loads it and could fault on a removed symbol rather than getting a clean file-not-found; that is what the existing compatibility headers/symbols are for, and a rebuild remains the real fix. This change restores pre-6.0 behavior and stops the file-level breakage.