[R-SIG-Mac] Rcpp on OSX?

Dirk Eddelbuettel edd at debian.org
Fri Nov 21 00:39:19 CET 2008


Simon,  David,

On 20 November 2008 at 18:17, Simon Urbanek wrote:
| David,
| 
| you may want to tell the maintainer (hopefully CCed here ;)). That  
| package is horribly non-portable (for no real reason) so it's not just  

The reason is that I need to work around restrictions in R about how and I
where I can build libraries.  And e.g. the complete lack of follow-up from R
Core about the suggested additions to the R CMD INSTALL functionality (cf
r-devel in the summer).

Rcpp builds and works for me under Linux and Windows -- the only platforms I
have access too -- and I use it daily.  I had asked a friend who uses OS X to
test this, but he hadn't gotten around to it.  So OS X is simply untested.

On Windows and Linux I now install one copy of Rcpp and have other package
compile and link against it.

| a matter of setting some flags to get it to work. (Re the message you  
| quoted - It's not really excluded, it simply doesn't work).
| 
| Just to get you started, *remove* src/Makefile and create the  
| following src/Makevars:
| 
| all: $(SHLIB) userLibrary
| 
| USERLIB=libRcpp$(DYLIB_EXT)
| USERDIR=../inst/lib
| 
| userLibrary: $(USERLIB)
| 	- at if test ! -e $(USERDIR)$(R_ARCH); then mkdir -p $(USERDIR)$ 
| (R_ARCH); fi
| 	cp $(USERLIB) $(USERDIR)$(R_ARCH)
| 	cp Rcpp.h $(USERDIR)

The platforms I work on don't need the $R_ARCH stuff which is why I didn't
add it.  If this is portable, we can surely talk about making it more
generic.  

If David is willing to test this, we can probably sort this out over a few
off-list emails. I'd be up for that.

| $(USERLIB): Rcpp.o
| 	$(SHLIB_CXXLD) -o $(USERLIB) $^ $(SHLIB_CXXLDFLAGS) $(ALL_LIBS)
| 
| .PHONY: 	all clean userLibrary
| 
| clean:
| 		rm -f $(OBJECTS) $(SHLIB) $(USERLIB)

That is overall a pretty small change.  So I don't see the need for the
belligerent tone above, especially given that I have no access to OS X.

Thanks, Dirk

 
| 
| Cheers,
| Simon
| 
| 
| On Nov 20, 2008, at 16:57 , David Reiss wrote:
| 
| > Hi,
| > I am very eager to use Rcpp on my Mac. However, the package doesn't  
| > compile,
| > as reported at CRAN ("MacOS X binary: not available as excluded from  
| > build,
| > see excludes<https://svn.r-project.org/R-dev-web/trunk/QA/Simon/packages/excludes 
| > >.")
| > I thought I'd check if any R/OSX experts here have gotten it to  
| > work, or
| > have any ideas on how to compile it on OSX, before I tried  
| > contacting the
| > package maintainer. Here are the compilation errors I get when I try  
| > (on my
| > 2nd-gen Mac Pro running Tiger; similar results on a Leopard box).  
| > Thanks for
| > any assistance.
| >
| > % R CMD INSTALL Rcpp_0.6.0.tar.gz
| > * Installing *source* package 'Rcpp' ...
| > ** libs
| > ** arch - i386
| > g++ -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
| > -mmacosx-version-min=10.4
| > -I/Library/Frameworks/R.framework/Resources/include
| > -I/Library/Frameworks/R.framework/Resources/include/i386  -msse3    - 
| > fPIC
| > -I. `/Library/Frameworks/R.framework/Resources/bin/R CMD config -- 
| > cppflags`
| > -Wall -O2  -c Rcpp.cpp -o Rcpp.o
| > g++ -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
| > -mmacosx-version-min=10.4 -shared -o ../inst/lib/libRcpp.dylib Rcpp.o
| > i686-apple-darwin8-g++-4.0.1: unrecognized option '-shared'
| > /usr/bin/ld: Undefined symbols:
| > _main
| > _INTEGER
| > _LOGICAL
| > _REAL
| > _R_CHAR
| > _R_ClassSymbol
| > _R_DimSymbol
| > _R_LevelsSymbol
| > _R_NamesSymbol
| > _R_NilValue
| > _R_alloc
| > _Rf_allocMatrix
| > _Rf_allocVector
| > _Rf_eval
| > _Rf_getAttrib
| > _Rf_isFactor
| > _Rf_isInteger
| > _Rf_isLogical
| > _Rf_isMatrix
| > _Rf_isNewList
| > _Rf_isNumeric
| > _Rf_isReal
| > _Rf_isString
| > _Rf_isVector
| > _Rf_lang2
| > _Rf_length
| > _Rf_mkChar
| > _Rf_protect
| > _Rf_setAttrib
| > _Rf_unprotect
| > _SETCADR
| > _SET_STRING_ELT
| > _SET_VECTOR_ELT
| > _STRING_ELT
| > _VECTOR_ELT
| > collect2: ld returned 1 exit status
| > make: *** [../inst/lib/libRcpp.dylib] Error 1
| > ERROR: compilation failed for package 'Rcpp'
| > ** Removing '/Users/dreiss/.R/packages/Rcpp'
| >
| > 	[[alternative HTML version deleted]]
| >
| > _______________________________________________
| > R-SIG-Mac mailing list
| > R-SIG-Mac at stat.math.ethz.ch
| > https://stat.ethz.ch/mailman/listinfo/r-sig-mac
| >
| >
| 

-- 
Three out of two people have difficulties with fractions.



More information about the R-SIG-Mac mailing list