diff --git a/tools/config/configure.R b/tools/config/configure.R index 6293fe1..2f84337 100644 --- a/tools/config/configure.R +++ b/tools/config/configure.R @@ -186,12 +186,23 @@ define( ) # set PKG_LIBS +# +# bincraft patch: the library directories below are passed as plain '-L', not +# '-Wl,-L'. gcc expands its own search dirs (/usr/lib64, /usr/lib/) +# into explicit '-L' options ahead of anything forwarded verbatim with '-Wl,', +# so with '-Wl,-L' a system libtbb.so wins over the one named here: on a build +# host with a distro TBB installed, '-ltbb' resolves to that library and +# RcppParallel.so records its SONAME (libtbb.so.12, or libtbb.so.2 for the +# classic Intel TBB) instead of the bundled 'libtbb.so'. The binary then loads +# the system TBB rather than the copy shipped in RcppParallel/lib, and fails +# outright on a machine that has no system TBB. gcc places a plain '-L' before +# its built-in dirs, so the intended library is found first. pkgLibs <- if (!is.na(tbbLib)) { # a TBB supplied via TBB_LIB / TBB_ROOT. an rpath is meaningless on Windows, # where the loader has no equivalent -- see R/zzz.R for how we resolve there c( - "-Wl,-L\"$(TBB_LIB)\"", + "-L\"$(TBB_LIB)\"", if (.Platform$OS.type != "windows") sprintf("-Wl,-rpath,%s", shQuote(tbbLib)), "-l$(TBB_NAME)", @@ -201,14 +212,14 @@ pkgLibs <- if (!is.na(tbbLib)) { } else if (R.version$os == "emscripten") { c( - "-Wl,-Ltbb/build/lib_release", + "-Ltbb/build/lib_release", "-l$(TBB_NAME)" ) } else { c( - "-Wl,-Ltbb/build/lib_release", + "-Ltbb/build/lib_release", "-l$(TBB_NAME)", "-l$(TBB_MALLOC_NAME)" )