[Rd] Lack of -O2 (or -O) gcc compiler flag causes package installation failure

From: alexholehouse <alex.holehouse_at_gmail.com>
Date: Thu, 07 Jun 2012 10:32:01 -0700 (PDT)

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

... compiles and installs no problem.

However, if I remove the -O (or use -O0, -O1) it fails with the following error

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.

R-devel_at_r-project.org mailing list
Received on Thu 07 Jun 2012 - 17:36:24 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 07 Jun 2012 - 18:22:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive