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

Simon Urbanek simon.urbanek at r-project.org
Wed Jun 30 04:17:52 CEST 2010


Adam,

the correct way to specify custom linking flags is via PKG_LIBS so try that (more comments inline).

Cheers,
Simon


On Jun 29, 2010, at 5:42 PM, Adam D. I. Kramer wrote:

> 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.
> 

That is clear - LD_LIBRARY_PATH has no effect on OS X and the package has no configure script so there is no point in trying to set configure-vars ;). 


> I would also note that LDFLAGS=-L/sw/lib is actually included in my call to
> ./configure when building R in the first place...

Your'e asking for trouble with that. Although it is unrelated to your issue if you have fink setup R's configure will pick it up automatically so better stick to that.


> 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.
> 

It is well documented in R-exts section 1.2.1.


Just for completeness (not related to your case), packages with configure scripts should respect the usual autoconf settings such as CFLAGS, LIBS etc. and pass them to Makevars as PKG_LIBS etc., but there are some that are badly written and don't.



> (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
> 
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> 
> 



More information about the R-SIG-Mac mailing list