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

Romain Francois romain.francois at dbmail.com
Mon Jul 5 13:11:51 CEST 2010


Thanks Simon to pick this up.

Adam, FWIW Rcpp has its own mailing list: 
http://lists.r-forge.r-project.org/mailman/listinfo/rcpp-devel

50% of the development team works on OSX ;-)

Romain

Le 30/06/10 05:05, Adam D. I. Kramer a écrit :
>
> Simon,
>
> Many thanks, as always! It was actually a bit trickier since I run R
> as root and then install.packages(). So this is what I needed:
>
> sudo PKG_LIBS=-L/sw/lib R
>
> ...and then I could install.packages("Rcpp").
>
> ...I'm sure you knew that, but I'm in favor of posting solutions to mailing
> lists. Additional replies inline.
>
> On Tue, 29 Jun 2010, Simon Urbanek wrote:
>
>> 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
>> ;).
>
> Yep, this is just an instance of me trying everything I could think of.
>
>>> 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.
>
> I compile R myself, I don't use fink for it. But yes, my setup is
> nonstandard.
>
>>> 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.
>
> To be clear, I'm trying to _install_ an extension, not write one. :)
> That is
> why I could not find this result, most likely.
>
>> 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.
>
> Right. Rcpp is using "Makevars" and not a configure script, and is required
> for lme4a, which I'm just dying to try out...that's dying for other
> reasons,
> but I'll probably ask on the R-sig-mixed-effects list before coming back
> here.
>
> Thanks again,
> Adam
>
>>> (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
>>>
>>>
>>
>>
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
>


-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://bit.ly/98Uf7u : Rcpp 0.8.1
|- http://bit.ly/c6YnCi : graph gallery collage
`- http://bit.ly/bZ7ltC : inline 0.3.5



More information about the R-SIG-Mac mailing list