[Rcpp-devel] g++-llvm still doesn't like RcppArmadillo?

Yan Zhou zhouyan at me.com
Mon Dec 26 03:08:49 CET 2011


On Dec 26, 2011, at 1:11 AM, Dirk Eddelbuettel wrote:

> 
> On 26 December 2011 at 00:44, Yan Zhou wrote:
> | I guess many are moving towards llvm-gcc and clang. In fact r itself now compiles with clang and passes make check successfully on Lion, Xcode 4.2. Also clang is now the default compiler. Llvm-gcc/g++ are going to be dropped in a not too long time.  gcc4.2 has already been dropped in xcode 4.2
> 
> Interesting.  Do you have a configuration setting for R I could borrow?  Or
> just "defaults", but having CC et al be llvm et al ?
> 

The attachment is the script I used to build R on my Mac. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: R-build-mac
Type: application/octet-stream
Size: 750 bytes
Desc: not available
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20111226/879e9e22/attachment-0001.obj>
-------------- next part --------------

I build it on Mac OS X 10.7.2, Xcode 4.2.1.
On Mac the default "cc" is llvm-gcc and and so does "gcc", which is no longer the real gcc but a symbolic link to llvm-gcc. The situation for c++ is similar.
Clang/Clang++ is now the default on Xcode (at least what I heard, I am not a fan of the IDE thing). Anyway, the build script is very straight forward as you can see. I am not sure if it will work on Linux. 


> | Sometimes I have to stick with old gcc-4.2 and I believe many are in the same situation now and then. Clang is somehow stricter than g++ in many cases and is good for checking status conforming. The clang 3.0 shipped with Xcode 4.2 is quite production quality. Also I thin you don't have to get a Mac to solve the problem. You can get clang on Linux easily enough.
> 
> Yes, of course. My Debian/Ubuntu had it for a long time, but whenever I tried
> naive Rcpp compilations it failed.  That said, we also got patches from llvm
> users because of the stricter C++ standard interpretation.
> 

Interesting. I build R with clang/clang++ as said. And Rcpp, RInside all build without a problem with "install.packages", which means they are build with clang/clang++. I remember there are some problems with old clang++. If my memory is accountable, I believe building R and Rcpp with clang/clang++ was only made possible after I upgrade to Xcode 4.2, which shipped llvm-3.0 toolchain. Clang has been of good shape since 2.8. But for clang++, my memory is that it was not ready for productive use until recent 3.0 version in many cases. However, clang++ 3.0 does build a lot of things successfully, most notably I can use it with many of Boost libraries now, which clang++ 2.9 failed miserably.

> | I don't think require a local gcc version other than compilers shipped with apple will be wise. System's default tool sets shall be supported whenever possible.
> | 
> | By the way, I found there are no problems of using armadillo with clang at all. But I don't know how RcppArmadillo is built. 
> 
> We are still using the initial insight by Doug Bates: no need for BLAS,
> Lapack, ... compile-time configuration detection as we can simply borrow what
> R has.  That allow us to use Armadillo in pure template mode, and everthing
> it needs via linked object code is provided from R via Rcpp.  
> 
> | Though I cannot really help with the problem, but hope the information on compiler status on Mac will help some way. My suggestion is that support system default compilers whenever possible as that is what most people use. If they are not use clang now, they will start soon.
> 
> It would be very good for advanced Mac users to come to our help. 
> 
> Rcpp itself is fine, RcppArmadillo is too but e.g. RcppEigen is in trouble as
> CRAN insists on building it with g++ 4.2.1 for three arches, and it goes
> belly up and dies when building for ppc while hosted in i386.  That prevents
> RcppEigen from being on CRAN and hence prevents other packages from
> piggybacking on it.
> 
clang++ can build RcppEigen but not RcppArmadillo, same error as Davor's.
CRAN R on Mac OS X insist on compatibility with Leopard and x86/x86-64/ppc. And I agree that they have a good reason for that. However, though not available on CRAN, many packages can be build natively from source.

> Dirk
> | 
> | On Dec 23, 2011, at 11:39 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
> | 
> | > 
> | > On 23 December 2011 at 11:03, Davor Cubranic wrote:
> | > | Did we ever find a way to make RcppArmadillo compile with g++-llvm 
> | > | on OS X Lion?
> | > | 
> | > | There was a thread in July about unresolved 'arma_version' symbol 
> | > | (http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2011-July/002621.html), 
> | > | and it appears the only way around it was by compiling with the 
> | > | vanilla g++.
> | > | 
> | > | I just ran into the same error, using R installed from MacPorts as 
> | > | the R-framework port. This uses the llvm-g++-4.2 toolchain, so 
> | > | getting it to use apple-g++ to compile just RcppArmadillo would 
> | > | probably require manual fiddling with the configure step, which I 
> | > | would prefer to avoid given that this is on a compute cluster where 
> | > | we're automating software installation and upgrading.
> | > 
> | > No idea, as I'm not a mac user I can't really help.
> | > 
> | > Are OS X users / developers moving towards llvm, or towards local copies of
> | > newer g++ versions?
> | > 
> | > Dirk
> | > 
> | > | Also, does anyone know if this will mean that every package that 
> | > | depends on RcppArmadillo will have to avoid using LLVM as well?
> | > | 
> | > | Installation output below:
> | > | 
> | > | * installing *source* package 'RcppArmadillo' ...
> | > | ** package 'RcppArmadillo' successfully unpacked and MD5 sums 
> | > | checked
> | > | ** libs
> | > | *** arch - x86_64
> | > | /opt/local/bin/llvm-g++-4.2 
> | > | -I/opt/local/Library/Frameworks/R.framework/Resources/include 
> | > | -I/opt/local/Library/Frameworks/R.framework/Resources/include/x86_64 
> | > | -I/opt/local/include 
> | > | -I"/opt/local/Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/include" 
> | > | -I../inst/include -fPIC  -pipe -O2 -m64 -c RcppArmadillo.cpp -o 
> | > | RcppArmadillo.o
> | > | /opt/local/bin/llvm-g++-4.2 
> | > | -I/opt/local/Library/Frameworks/R.framework/Resources/include 
> | > | -I/opt/local/Library/Frameworks/R.framework/Resources/include/x86_64 
> | > | -I/opt/local/include 
> | > | -I"/opt/local/Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/include" 
> | > | -I../inst/include -fPIC  -pipe -O2 -m64 -c fastLm.cpp -o fastLm.o
> | > | /opt/local/bin/llvm-g++-4.2 -dynamiclib 
> | > | -Wl,-headerpad_max_install_names -undefined dynamic_lookup 
> | > | -single_module -multiply_defined suppress -L/opt/local/lib 
> | > | -L/opt/local/lib/llvm-gcc42 -lgfortran -o RcppArmadillo.so 
> | > | RcppArmadillo.o fastLm.o 
> | > | /opt/local/Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/lib/x86_64/libRcpp.a 
> | > | -L/opt/local/Library/Frameworks/R.framework/Resources/lib/x86_64 
> | > | -lRlapack 
> | > | -L/opt/local/Library/Frameworks/R.framework/Resources/lib/x86_64 
> | > | -lRblas -F/opt/local/Library/Frameworks/R.framework/.. -framework R 
> | > | -Wl,-framework -Wl,CoreFoundation
> | > | installing to 
> | > | /opt/local/Library/Frameworks/R.framework/Versions/2.14/Resources/library/RcppArmadillo/libs/x86_64
> | > | ** R
> | > | ** inst
> | > | ** preparing package for lazy loading
> | > | ** help
> | > | *** installing help indices
> | > | ** building package indices ...
> | > | *** tangling vignette sources ...
> | > |     'RcppArmadillo-unitTests.Rnw'
> | > | ** testing if installed package can be loaded
> | > | Error in dyn.load(file, DLLpath = DLLpath, ...) :
> | > |    unable to load shared object 
> | > | '/opt/local/Library/Frameworks/R.framework/Versions/2.14/Resources/library/RcppArmadillo/libs/x86_64/RcppArmadillo.so':
> | > | 
> | > | dlopen(/opt/local/Library/Frameworks/R.framework/Versions/2.14/Resources/library/RcppArmadillo/libs/x86_64/RcppArmadillo.so, 
> | > | 6): Symbol not found: __ZN4arma12arma_version5majorE
> | > |    Referenced from: 
> | > | /opt/local/Library/Frameworks/R.framework/Versions/2.14/Resources/library/RcppArmadillo/libs/x86_64/RcppArmadillo.so
> | > |    Expected in: flat namespace
> | > |   in 
> | > | /opt/local/Library/Frameworks/R.framework/Versions/2.14/Resources/library/RcppArmadillo/libs/x86_64/RcppArmadillo.so
> | > | Error: loading failed
> | > | Execution halted
> | > | ERROR: loading failed
> | > | * removing 
> | > | '/opt/local/Library/Frameworks/R.framework/Versions/2.14/Resources/library/RcppArmadillo'
> | > | 
> | > | The downloaded packages are in
> | > |          '/private/tmp/RtmpXwDIXY/downloaded_packages'
> | > | Warning message:
> | > | In install.packages("RcppArmadillo") :
> | > |    installation of package 'RcppArmadillo' had non-zero exit status
> | > | 
> | > | _______________________________________________
> | > | Rcpp-devel mailing list
> | > | Rcpp-devel at lists.r-forge.r-project.org
> | > | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
> | > 
> | > -- 
> | > "Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
> | > dark to read." -- Groucho Marx
> | > _______________________________________________
> | > Rcpp-devel mailing list
> | > Rcpp-devel at lists.r-forge.r-project.org
> | > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
> | 
> 
> -- 
> "Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
> dark to read." -- Groucho Marx



More information about the Rcpp-devel mailing list