[R-pkg-devel] Changing optimization level when building package?

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Thu Jul 7 12:04:54 CEST 2022


On 07/07/2022 3:41 a.m., Tomas Kalibera wrote:
> 
> On 7/5/22 16:11, Ivan Krylov wrote:
>> On Tue, 5 Jul 2022 09:35:05 -0400
>> Duncan Murdoch <murdoch.duncan using gmail.com> wrote:
>>
>>> I see the -O0 option that I added, but afterwards -O2 coming from
>>> somewhere in R.
>> It seems to come from the CXXFLAGS macro defined in /etc/R/Makeconf.
>> It's the last to be added to ALL_CXXFLAGS, so you probably have to
>> overwrite it in ~/.R/Makevars.
>>
> Yes. I set both CFLAGS and CXXFLAGS in my Makevars_dbg0 file and let R
> use it via R_MAKEVARS_USER.
> See R-Admin, 6.3.3, Customizing package compilation, for more.
> 
> Tomas
> 

In my case, the necessary settings needed to be put in CXX11FLAGS, 
because rgl defines CXX_STD = CXX11.  Thanks to Kevin Ushey and Prof. 
Brian Ripley for spotting this.

Duncan Murdoch



More information about the R-package-devel mailing list