From tangoh at gmail.com  Wed Mar 11 20:07:19 2015
From: tangoh at gmail.com (Hsiu-Khuern Tang)
Date: Wed, 11 Mar 2015 12:07:19 -0700
Subject: [Rd] Notes on building a gcc toolchain for Rtools (but not
	multilib)
In-Reply-To: <CAL6gwn+4zKHGFZV-QPDv5oSt_pY4UKjmU=R+Kxoqq7NuLGBL_g@mail.gmail.com>
References: <1110879639.489054.1426013789755.JavaMail.root@fredhutch.org>
	<54FF432C.8030200@gmail.com>
	<CAL6gwn+7k9=BnzCZ+v9s3rXVMZ_okns7WUVKfFLp7bj7pDzWfA@mail.gmail.com>
	<CAPuMoLb-1zoWV59atQH5eKi4oPG1sY+WXr4e+cDw5V9soiM3NQ@mail.gmail.com>
	<CAL6gwn+cBmUnouoEG=-X-bm-QNYUiBv54TZRSYiTJZKt9KXFCg@mail.gmail.com>
	<CAPuMoLZB8j_xvOEy9VTrFvbp7TNmaFy7UXkNg694f3o8sDg+Tw@mail.gmail.com>
	<CAL6gwn+4zKHGFZV-QPDv5oSt_pY4UKjmU=R+Kxoqq7NuLGBL_g@mail.gmail.com>
Message-ID: <CAPuMoLZJMQ+mgQv7vd_UAbwF=wkM=cBxSjvPgYp3fX5KG=hYHw@mail.gmail.com>

On Wed, Mar 11, 2015 at 10:32 AM, Avraham Adler <avraham.adler at gmail.com> wrote:
> On Wed, Mar 11, 2015 at 1:23 PM, Hsiu-Khuern Tang <tangoh at gmail.com> wrote:
>> On Tue, Mar 10, 2015 at 10:47 PM, Avraham Adler <avraham.adler at gmail.com> wrote:
>>> On Wed, Mar 11, 2015 at 1:40 AM, Hsiu-Khuern Tang <tangoh at gmail.com> wrote:
>>>> On Tue, Mar 10, 2015 at 8:54 PM, Avraham Adler <avraham.adler at gmail.com> wrote:
>>>>>
>>>>> I successfully rebuilt R-devel_2015-03-09 with the most recent version
>>>>> of Rtools tonight, building both ICU_531 and this time libcurl (7.39)
>>>>> as well (and OpenBLAS, of course). The internet bug is still there,
>>>>> but the rest of make-check all passed with flying colors, as did
>>>>> building 'microbenchmark' from source (with all the other needed
>>>>> packages, including Rcpp and Hsiu-Kheurn's change to NM was *not*
>>>>> used).
>>>>> ...
>>>>
>>>> The NM_FILTER change seems to be needed only when compiling C++ code
>>>> with -std=c++11 or -std=gnu++11.
>>>>
>>>> Even though the current CRAN policy doesn't allow the C++11 standard,
>>>> it would still be useful to document this, perhaps in the Writing R
>>>> Extensions manual.
>>>>
>>>> - Hsiu-Khuern
>>>
>>> Hello, Hsiu-Khuern.
>>>
>>> All the times I have built, I've passed -std-gnu++11. Specifically, I
>>> pass: -march=native -O3 -mfpmath=sse -std=gnu++11 -msse2avx
>>> -mavx256-split-unaligned-load -mavx256-split-unaligned-store
>>> -mvzeroupper --param l1-cache-line-size=64 --param l1-cache-size=64
>>> --param l2-cache-size=256.
>>> ...
>>
>> Interesting.  I tested the use of -O0, ..., -O3 together with
>> -std=gnu++11.  With -O0 (which I suppose is the default if not
>> specified), I get the following error when R CMD INSTALL is trying to
>> create Rcpp.dll:
>>
>> collect2.exe: error: ld returned 5 exit status
>>
>> With -O1, -O2, or -O3, there is no error.
>>
>> - Hsiu-Khuern
>>
>
> The default is O2, I believe, as the default EOPTS in
> src/gnuwin32/Mkrules.dist are -O2 -mtune=core2.

I was setting CXXFLAGS=-std=gnu++11 in my .R/Makevars, which overrides
the CXXFLAGS setting in $R_HOME/etc/x64/Makeconf, hence the final g++
option didn't include the -O2 -mtune=core2.

Sorry for not being clear.

- Hsiu-Khuern



[Rd] Notes on building a gcc toolchain for Rtools (but not multilib)
Hsiu-Khuern Tang