[Rd] compiling packages without Framework and CoreFoundation options on OSX

Simon Urbanek simon.urbanek at r-project.org
Thu Oct 8 15:04:14 CEST 2009


Jeff,

On Oct 7, 2009, at 18:48 , Jeff Hamann wrote:

> I've been trying to get R+PostgreSQL+PL/R to work together on a OSX
> machine without the Framework and CoreFoundation options and have
> noticed some suspicious switches when compiling packages.
>
> I've installed R (on OSX) with the following ./configure:
>
> ./configure \
>  CC="gcc -arch i386" \
>  CXX="g++ -arch i386" \
>  OBJC="gcc -arch i386" \
>  F77="gfortran -arch i386" \
>  FC="gfortran -arch i386" \
>  --enable-R-framework=no \
>  --enable-R-shlib \
>  --without-blas \
>  --x-includes=/usr/X11/include \
>  --x-libraries=/usr/X11/lib
>
> Notice the
>
>  --enable-R-framework=no \
>  --enable-R-shlib \
>
> No flames please.I'm sure I'm breaking lot's of R purist-isms.  
> There's a bigger picture here than trying to get R and packages to  
> build by themselves.
>
> When I build packages, using sudo R, for example:
>
>> install.packages(c("rconifers"),
> +  lib="/usr/local/lib/R/library",
> +  repos="http://cran.r-project.org",
> +  dependencies=TRUE )
>
> the package seems to get built with the "-Wl,-framework - 
> Wl,CoreFoundation" switches, even when R isn't built with the  
> framework (and CoreFoundation) options.

You're confusing entirely different things here - "-Wl,-framework - 
Wl,CoreFoundation" is simply a safe form of "-framework  
CoreFoundation" which means that R uses the CoreFoundation framework  
which is part of OS X. It has nothing to do with the --enable-R- 
framework option which is about creating *R* as a framework.


> For example:
>
> gcc -arch i386 -std=gnu99 -dynamiclib -Wl,-headerpad_max_install_names
> -undefined dynamic_lookup -single_module -multiply_defined suppress - 
> L/
> usr/local/lib -o rconifers.so coeffs.o file_io.o grow.o mortality.o
> plot.o rconifers.o sample.o smc_coeffs.o smc_model.o stats.o
> swo_coeffs.o swo_model.o thin.o -L/usr/local/lib/R/lib -lR -Wl,-
> framework -Wl,CoreFoundation
>

Note the "-lR" which is caused by --enable-R-framework=no, in the  
normal R on OS X you'd have seen "-framework R" instead.


> I would like to build packages without the "-Wl,-framework -
> Wl,CoreFoundation" options because I'm going to install it on other OS
> (FreeBSD, Linux, whatever)
>

If you install it on other OS, you'll get entirely different switches,  
of course. CF is needed on OS X for certain OS-specific functionality  
such as locales support, Quartz graphics etc.

Clearly, a binary is specific for given OS, so you have to build a  
binary of your package for each single OS you want to support in  
binary form (with different switches each time).


> Does this cause a problem? Will this cause a problem? I'm guessing  
> the CoreFoundations are an artifact of the XCode compiler.

"XCode compiler" is gcc, so, no.


> What's with the   -Wl,-framework stuff?

It's roughly the same as -l but it's more powerful as it covers  
umbrellas, resources etc. You may want to read more about frameworks:
http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPFrameworks/Frameworks.html


> Can I make it stop?

Not really without hacking R.


> Will I be okay?
>

I have the suspicion that you're heading in a very wrong direction  
(but you didn't tell us what you're really up to so that's just a  
speculation). It should be entirely irrelevant for you what switches  
are used, because packages get all necessary switches from R, so they  
never need to worry about them. If you do, then it's highly likely  
that you're doing something wrong.

Cheers,
Simon



More information about the R-devel mailing list