From simon.urbanek at r-project.org  Thu Dec 27 18:53:07 2012
From: simon.urbanek at r-project.org (Simon Urbanek)
Date: Thu, 27 Dec 2012 12:53:07 -0500
Subject: [Rd] How to ensure -O3 on Win64
In-Reply-To: <dbbc6e1436401aa2781e8a2069b360b1@imap.plus.net>
References: <dbbc6e1436401aa2781e8a2069b360b1@imap.plus.net>
Message-ID: <530A0026-07D0-4BAF-9E41-68D266FF9E58@r-project.org>


On Dec 23, 2012, at 9:22 PM, Matthew Dowle wrote:

> 
> Hi,
> 
> Similar questions have come up before on the list and elsewhere but I haven't found a solution yet.
> 
> winbuilder's install.out shows data.table's .c files compiled with -O3 on Win32 but -O2 on Win64. The same happens on R-Forge. I gather that some packages don't work with -O3 so the default is -O2.
> 
> I've tried this in data.table's Makevars (entire contents) :
> 
> ====
> MAKEFLAGS="CFLAGS=-O3"                        # added
> CFLAGS=-O3                                    # added
> PKG_CFLAGS=-O3                                # added
> all: $(SHLIB)                                 # no change
> 	mv $(SHLIB) datatable$(SHLIB_EXT)     # no change
> ====
> 
> but -O2 still appears in winbuilder's install.out (after -O3, and I believe the last -O is the one that counts) :
> 
> gcc -m64 -I"D:/RCompile/recent/R-2.15.2/include" -DNDEBUG     -I"d:/Rcompile/CRANpkg/extralibs215/local215/include"  -O3   -O2 -Wall  -std=gnu99 -mtune=core2 -c dogroups.c -o dogroups.o
> 
> How can I ensure that data.table is compiled with -O3 on Win64?
> 

You can't - at least not in a way that doesn't circumvent the R build system. Also it's not portable so you don't want to mess with optimization flags and hard-code it in your package as it's user's choice how they setup R and its flags. You can certainly setup your R to compile with -O3, you just can't impose that on others.

Cheers,
Simon



[Rd] How to ensure -O3 on Win64
Simon Urbanek