[Rd] Lack of -O2 (or -O) gcc compiler flag causes package installation failure
alex.holehouse at gmail.com
Thu Jun 7 19:32:01 CEST 2012
Hello all - first time poster long time reader,
I'm currently working on a package, and was interested to compare
performance with and without gcc/g++ -O based optimization. I can turn the
-O flags off with a ~.R/Makevars file, but when I do something odd happens.
The package installs fine when gcc is fed -O2 or -O3
R CMD INSTALL --configure-args="CFLAGS=-g CXXFLAGS=-g --disable-openmp"
/NB: I have opnemp switched off here as it's not supported by Apple's GCC
(4.2.1). When the code runs on a linux cluster it compiles with openmp and
runs no problem./
CC = gcc -arch x86_64 -std=gnu99
CFLAGS = -g -O2 $(LTO) /# with -O2 we compile fine /
CPICFLAGS = -fPIC
CPPFLAGS = -I/usr/local/include
CXX = g++ -arch x86_64
CXXCPP = g++ -arch x86_64 -E
CXXFLAGS = -g $(LTO)
CXXPICFLAGS = -fPIC
... compiles and installs no problem.
However, if I remove the -O (or use -O0, -O1) it fails with the following
** preparing package for lazy loading
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object
Symbol not found: _mymax
Expected in: flat namespace
Error: loading failed
ERROR: loading failed
* removing ‘/Users/alex/Library/R/2.15/library/citpp’
* restoring previous ‘/Users/alex/Library/R/2.15/library/citpp’
This isn't a huge problem (for me, right now), but I don't understand why
changing the compiler optimization level to less optimization would cause a
dyn.load error? I can remove the optimization flag from g++ no problem. Any
advice or ideas would be appreciated!
View this message in context: http://r.789695.n4.nabble.com/Lack-of-O2-or-O-gcc-compiler-flag-causes-package-installation-failure-tp4632723.html
Sent from the R devel mailing list archive at Nabble.com.
More information about the R-devel