[Rd] PKG_CFLAGS/CFLAGS and PKG_CXXFLAGS/CXXFLAGS
edd at debian.org
Wed Mar 21 01:51:36 CET 2007
On 20 March 2007 at 18:58, Ernest Turro wrote:
| Why is it that R places CFLAGS after PKG_CFLAGS and not before when
| compiling a package (e.g. through R CMD build pkg)? This can be
| problematic if, for instance, you want to use -O3, but -O2 is in
| R_HOME/etc/Makeconf. If -O2 (in CFLAGS) appears after -O3 (in
| PKG_CFLAGS), you are left with what you didn't want: -O2.
| In R-exts, it says that "Flags which are set in file etc/Makeconf can
| be overridden by the environment variable MAKEFLAGS (at least for
| systems using GNU make), as in (Bourne shell syntax)" but this
| doesn't work if I set either MAKEFLAGS or CFLAGS/CXXFLAGS in my
| configure.ac script or package Makevars.
| Does anyone have any ideas on how to reliably override the default
| CFLAGS/CXXFLAGS given in Makeconf?
It's one of my token problems too for the Debian package builds.
Often it is simply not possible to do this easily due to the automated
insertion 'at the wrong' place that you mention.
One way around is to set CFLAGS (or CXXFLAGS) inside a MAKEFLAGS variable. It
must be properly quoted -- which seems to lead to the restriction that you
get only one token at a time, see below.
I.e. the following was once useful when I needed to tone down the
optimization due to an architecture-specific optimisation bug:
MAKEFLAGS="FFLAGS=-O1" R CMD INSTALL -l $(debRlib) --clean .
An example of the 'one toke only' problem is
LDFLAGS+=-llibfoo LDFLAGS+=-llibbar" \
R CMD INSTALL foo
This issue has come up before, and e.g. Kurt has, IIRC, made some suggestions
about overrides below ~/.R. In my particular case that wouldn't always help
as automated Debian builds are disconnected from individual user accounts.
Hell, there are no rules here - we're trying to accomplish something.
-- Thomas A. Edison
More information about the R-devel