[R-SIG-Mac] Trouble compiling Rcpp from source

Adam D. I. Kramer adik at ilovebacon.org
Tue Jun 29 23:42:52 CEST 2010


Hi,

 	I tried to install the source version of Rcpp under 64-bit R 2.11.1,
which I had compiled myself under OS 10.6.4.  The install.packages() run
failed, however, with this error:

g++ -arch x86_64 -o libRcpp.dylib Date.o DateVector.o Datetime.o
DatetimeVector.o Dimension.o DottedPair.o Environment.o Evaluator.o
Formula.o Function.o Language.o Module.o Pairlist.o Promise.o RObject.o
RcppCommon.o RcppDate.o RcppDateVector.o RcppDatetime.o RcppDatetimeVector.o
RcppFrame.o RcppFunction.o RcppList.o RcppNumList.o RcppParams.o
RcppResultSet.o RcppStringVector.o RcppStringVectorView.o S4.o Symbol.o
WeakReference.o coerce.o debugging.o exceptions.o posixt.o r_cast.o
-dynamiclib -Wl,-headerpad_max_install_names  -undefined dynamic_lookup
-single_module -multiply_defined suppress    -lintl -Wl,-framework
-Wl,CoreFoundation
ld: library not found for -lintl
collect2: ld returned 1 exit status
make: *** [libRcpp] Error 1
ERROR: compilation failed for package 'Rcpp'
* removing '/usr/local/lib/R/library/Rcpp'

...libintl could not be found. Well, shoot--I have that. It's in /sw/lib.
So, I tried setting LDFLAGS, I tried setting
--configure-vars="LDFLAGS=-L/sw/lib", I tried setting configure-args the
same way, I added /sw/lib to my LD_LIBRARY_PATH environment
variable...pretty much everything, but when I install.packages() the above
command does not change even though it is clearly linking.

I would also note that LDFLAGS=-L/sw/lib is actually included in my call to
./configure when building R in the first place...so my hand-compiled version
of R should well know where to look for libraries.

So my question to the list: Is there some specific way to make R pass the
correct flags to the compiler in this case?  I can't figure one out.

(I also note that if I download the source, unarchive it, and tweak the
makefile to hard-code -L/sw/lib into the path, the package installs just
fine and works...so the problem is in how install.packages() is working.)

So, could someone please explain to me how to get R CMD INSTALL or
install.packages() on OSX to add linker flags that I would like to specify? 
Or if this is a problem with R in general, or a problem with Rcpp in
general, please kindly let me know. I doubt that I am the only person having
this trouble.

Cordially,
Adam Kramer



More information about the R-SIG-Mac mailing list