[R-SIG-Mac] Need an appropriate way for setting rpath.

Wei-Chen Chen wccsnow at gmail.com
Thu Jan 18 02:00:42 CET 2018


Dear List Members,

I know linking with other shared library in mac may be tricky, but I think
it may save some space and worth a try.

The messages below are from a CRAN check recently from "
https://www.r-project.org/nosvn/R.check/r-release-osx-x86_64/JuniperKernel-00install.txt".
It obtained the correct paths (to libzmq.5.dylib) from a package pbdZMQ,
then set them for compiling and linking to the target package
JuniperKernel. However, the results before "install_name_tool" showed that
the path to the shared library is not what it said at linking time.
Therefore, later on at the run time the dyn.load() will not be able to find
the shared library.

The questions are:
1) How did this happen?
2) What path and what clang flags I should use in this case?
3) Is there an easy way to resolve this issue? (e.g. Would it work by
adding pbdZMQ to the "Depends:"?)

Sincerely,
Wei-Chen Chen


* installing *source* package ‘JuniperKernel’ ...
** package ‘JuniperKernel’ successfully unpacked and MD5 sums checked

************** Results of JuniperKernel package configure **************

>> RSCRIPT = /Library/Frameworks/R.framework/Resources/bin/Rscript
>> PBD_ZMQ = /Volumes/SSD-Data/Builds/R-dev-web/QA/Simon/packages/el-capitan-x86_64/Rlib/3.4/pbdZMQ
>> ZMQ_CPPFLAGS = -I"/Volumes/SSD-Data/Builds/R-dev-web/QA/Simon/packages/el-capitan-x86_64/Rlib/3.4/pbdZMQ/zmq/include"
>> ZMQ_LDFLAGS = -L"/Volumes/SSD-Data/Builds/R-dev-web/QA/Simon/packages/el-capitan-x86_64/Rlib/3.4/pbdZMQ/libs" -lzmq.5

************************************************************************

** libs
clang++ -std=gnu++11
-I/Library/Frameworks/R.framework/Resources/include -DNDEBUG
-I../inst/include/ -I.
-I"/Volumes/SSD-Data/Builds/R-dev-web/QA/Simon/packages/el-capitan-x86_64/Rlib/3.4/pbdZMQ/zmq/include"
-I"/Volumes/SSD-Data/Builds/R-dev-web/QA/Simon/packages/el-capitan-x86_64/Rlib/3.4/Rcpp/include"
-I"/Volumes/SSD-Data/Builds/R-dev-web/QA/Simon/packages/el-capitan-x86_64/Rlib/3.4/gdtools/include"
-I/usr/local/include   -fPIC  -Wall -g -O2 -c RcppExports.cpp -o
RcppExports.o
clang++ -std=gnu++11
-I/Library/Frameworks/R.framework/Resources/include -DNDEBUG
-I../inst/include/ -I.
-I"/Volumes/SSD-Data/Builds/R-dev-web/QA/Simon/packages/el-capitan-x86_64/Rlib/3.4/pbdZMQ/zmq/include"
-I"/Volumes/SSD-Data/Builds/R-dev-web/QA/Simon/packages/el-capitan-x86_64/Rlib/3.4/Rcpp/include"
-I"/Volumes/SSD-Data/Builds/R-dev-web/QA/Simon/packages/el-capitan-x86_64/Rlib/3.4/gdtools/include"
-I/usr/local/include   -fPIC  -Wall -g -O2 -c juniper.cpp -o juniper.o
clang++ -std=gnu++11 -dynamiclib -Wl,-headerpad_max_install_names
-undefined dynamic_lookup -single_module -multiply_defined suppress
-L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o
JuniperKernel.so RcppExports.o juniper.o
-L/Volumes/SSD-Data/Builds/R-dev-web/QA/Simon/packages/el-capitan-x86_64/Rlib/3.4/pbdZMQ/libs
-lzmq.5 -F/Library/Frameworks/R.framework/.. -framework R
-Wl,-framework -Wl,CoreFoundation
installing via 'install.libs.R' to
/Volumes/SSD-Data/Builds/R-dev-web/QA/Simon/packages/el-capitan-x86_64/results/3.4/JuniperKernel.Rcheck/JuniperKernel

Before install_name_tool (in install.libs.R):
[1] "/Volumes/SSD-Data/Builds/R-dev-web/QA/Simon/packages/el-capitan-x86_64/results/3.4/JuniperKernel.Rcheck/JuniperKernel/libs/JuniperKernel.so:"
[2] "\tJuniperKernel.so (compatibility version 0.0.0, current version
0.0.0)"
[3] "\t/Library/Frameworks/R.framework/Versions/3.4/Resources/library/pbdZMQ/libs/libzmq.5.dylib
(compatibility version 7.0.0, current version 7.2.0)"
[4] "\t/Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libR.dylib
(compatibility version 3.4.0, current version 3.4.3)"
[5] "\t/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
(compatibility version 150.0.0, current version 1259.11.0)"
[6] "\t/usr/local/clang4/lib/libc++.1.dylib (compatibility version
1.0.0, current version 1.0.0)"
[7] "\t/usr/lib/libSystem.B.dylib (compatibility version 1.0.0,
current version 1226.10.1)"
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error: package or namespace load failed for ‘JuniperKernel’ in
dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object
'/Volumes/SSD-Data/Builds/R-dev-web/QA/Simon/packages/el-capitan-x86_64/results/3.4/JuniperKernel.Rcheck/JuniperKernel/libs/JuniperKernel.so':
  dlopen(/Volumes/SSD-Data/Builds/R-dev-web/QA/Simon/packages/el-capitan-x86_64/results/3.4/JuniperKernel.Rcheck/JuniperKernel/libs/JuniperKernel.so,
6): Library not loaded:
/Library/Frameworks/R.framework/Versions/3.4/Resources/library/pbdZMQ/libs/libzmq.5.dylib
  Referenced from:
/Volumes/SSD-Data/Builds/R-dev-web/QA/Simon/packages/el-capitan-x86_64/results/3.4/JuniperKernel.Rcheck/JuniperKernel/libs/JuniperKernel.so
  Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Volumes/SSD-Data/Builds/R-dev-web/QA/Simon/packages/el-capitan-x86_64/results/3.4/JuniperKernel.Rcheck/JuniperKernel’

	[[alternative HTML version deleted]]



More information about the R-SIG-Mac mailing list