[Rd] Lack of -O2 (or -O) gcc compiler flag causes package installation failure
alexholehouse
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
*install with*
R CMD INSTALL --configure-args="CFLAGS=-g CXXFLAGS=-g --disable-openmp"
package.tar.gz
/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./
*makevars file*
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
error
** preparing package for lazy loading
** help
*** 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
'/Users/alex/Library/R/2.15/library/citpp/libs/x86_64/citpp.so':
dlopen(/Users/alex/Library/R/2.15/library/citpp/libs/x86_64/citpp.so, 6):
Symbol not found: _mymax
Referenced from:
/Users/alex/Library/R/2.15/library/citpp/libs/x86_64/citpp.so
Expected in: flat namespace
in /Users/alex/Library/R/2.15/library/citpp/libs/x86_64/citpp.so
Error: loading failed
Execution halted
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
mailing list