[Rcpp-devel] Remove hard-coded path to /usr/bin in Makevars

Valentin Kuznetsov vkuznet at gmail.com
Fri Apr 26 23:08:16 CEST 2013

this is re-post from
as been advised by Dirk.

I was unable to build Rcpp due to the fact that on my system I use another compiler (it is installed from MacPorts in /opt/local/bin area). The Rcpp/src/Makevars uses hard-coded path to /usr/bin/install_name_tool. This cause the linker to pick-up wrong install_name_tool which in my case should come from location of my compiler (i.e. /opt/local/bin). The error I got was the following:

R CMD INSTALL /Users/vk/Work/Languages/R/Rcpp_0.10.3.tar.gz
Loading required package: utils
* installing to library ‘/Users/vk/Library/R/3.0/library’
* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** libs
/opt/local/bin/g++-mp-4.7 -I/opt/local/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include/ -I/opt/local/include    -fPIC  -O2 -m64  -c Date.cpp -o Date.o
/opt/local/bin/g++-mp-4.7 -I/opt/local/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include/ -I/opt/local/include    -fPIC  -O2 -m64  -c Module.cpp -o Module.o
/opt/local/bin/gcc-mp-4.7 -std=gnu99 -I/opt/local/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include/ -I/opt/local/include    -fPIC  -O2 -DOS_OBJECT_USE_OBJC=0 -m64 -c Rcpp_init.c -o Rcpp_init.o
/opt/local/bin/g++-mp-4.7 -I/opt/local/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include/ -I/opt/local/include    -fPIC  -O2 -m64  -c Timer.cpp -o Timer.o
/opt/local/bin/g++-mp-4.7 -I/opt/local/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include/ -I/opt/local/include    -fPIC  -O2 -m64  -c api.cpp -o api.o
/opt/local/bin/g++-mp-4.7 -I/opt/local/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include/ -I/opt/local/include    -fPIC  -O2 -m64  -c attributes.cpp -o attributes.o
/opt/local/bin/g++-mp-4.7 -I/opt/local/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include/ -I/opt/local/include    -fPIC  -O2 -m64  -c barrier.cpp -o barrier.o
/opt/local/bin/g++-mp-4.7 -I/opt/local/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include/ -I/opt/local/include    -fPIC  -O2 -m64  -c exceptions.cpp -o exceptions.o
/opt/local/bin/g++-mp-4.7 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/opt/local/lib -o Rcpp.so Date.o Module.o Rcpp_init.o Timer.o api.o attributes.o barrier.o exceptions.o -F/opt/local/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
/opt/local/bin/g++-mp-4.7 -o libRcpp.dylib Date.o Module.o Rcpp_init.o Timer.o api.o attributes.o barrier.o exceptions.o -dynamiclib -Wl,-headerpad_max_install_names  -undefined dynamic_lookup -single_module -multiply_defined suppress   -F/opt/local/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
/usr/bin/install_name_tool: object: libRcpp.dylib malformed object (unknown load command 15)
make: *** [libRcpp] Error 1
ERROR: compilation failed for package ‘Rcpp’

To fix the problem I untar the source code, modified Rcpp/src/Makevars, replaced the path to install_name_tool, tar the package again and manually install it. Please review your test in Makevars and remove hard-coded path to install_name_tool. It should be picked up from the environment.

More information about the Rcpp-devel mailing list