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

Dirk Eddelbuettel edd at debian.org
Fri Apr 26 21:21:56 CEST 2013


On 26 April 2013 at 20:56, rcpp-bugs at r-forge.r-project.org wrote:
| Bugs item #2743, was opened at 2013-04-26 18:56 by Valentin Kuznetsov
| You can respond by visiting: 
| https://r-forge.r-project.org/tracker/?func=detail&atid=637&aid=2743&group_id=155
| 
| Status: Open
| Priority: 3
| Submitted By: Valentin Kuznetsov (vkuznet)
| Assigned to: Nobody (None)
| Summary: Remove hard-coded path to /usr/bin in Makevars 
| Hardware: Macintosh
| Product: None
| Operating System: MacOS X
| Component: None
| Version: None
| Severity: None
| Resolution: None
| URL: 
| 
| 
| Initial Comment:
| 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:
| 

It would appear that you are referring to the last line of this section:

$(USERLIB): 	$(OBJECTS)
		$(SHLIB_CXXLD) -o $(USERLIB) $(OBJECTS) $(SHLIB_CXXLDFLAGS) $(ALL_LIBS)
		@if test -e "/usr/bin/install_name_tool"; then /usr/bin/install_name_tool -id $(R_PACKAGE_DIR)/lib$(R_ARCH)/$(USERLIB) $(USERLIB); fi

That line, if memory serves, suggested and provided by Simon for the OS X
case.  It acts as both a test for OS X (as no other OS has
/usr/bin/install_name_tool) as well as a use of the tool.

What you suggest (ie remove the leading /usr/bin/) does not seem to
work. Witness this:

edd at max:~$ ls -l /usr/bin/install                            # I know I have thos
-rwxr-xr-x 1 root root 113864 Nov 19 16:20 /usr/bin/install
edd at max:~$ test -e install && echo "Found"                   # yet 'test -e' fails
edd at max:~$ test -e /usr/bin/install && echo "Found"          # only full path works
Found
edd at max:~$

With that I think your bug report is way too local.  I am sorry that your
particular case is not covered by our installation, but I have not intention
of breaking lots of working systems only to accomodate you.

There may be other ways, and I am open to suggestions.  Maybe Simon can help
once more.

One idea would be 

		@if test -e "/usr/bin/install_name_tool"; then install_name_tool -id $(R_PACKAGE_DIR)/lib$(R_ARCH)/$(USERLIB) $(USERLIB); fi

which still has the explicit test with a path, but then calls without a
path.  Or is that too fragile?

Any help from OS X users appreciated 

Dirk
 
| 
| 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.
| 
| Thanks,
| 
| Valentin.
| 
| ----------------------------------------------------------------------
| 
| You can respond by visiting: 
| https://r-forge.r-project.org/tracker/?func=detail&atid=637&aid=2743&group_id=155

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list