[R-pkg-devel] Fwd: How to use O4 flag in an RCpp project?

2025-05-21 Thread Peiyuan Zhu
Thanks Kevin, I tried both options and it seems to have worked. Not sure which one actually got it work. Claude, Maybe now you can test the new Makevar on your end. Let me know how it goes. -- Forwarded message - From: Kevin Ushey Date: Wed, May 21, 2025 at 8:26 PM Subject: Re: [

Re: [R-pkg-devel] How to use O4 flag in an RCpp project?

2025-05-21 Thread Peiyuan Zhu
Hi Kevin, This is the package that I'm trying to build: https://github.com/RAPLER/dst-1. The Makefile is in the src folder. I don't think I have something like you said in Makevars and DESCRIPTION. I tried CFLAGS and CXXFLAGS but still the Makeconf flags are used. I have no control over this Make

Re: [R-pkg-devel] How to use O4 flag in an RCpp project?

2025-05-21 Thread Peiyuan Zhu
Doing dry-run gives: [zhupy@cedar1 src]$ R CMD SHLIB --dry-run closure.cpp [mii] *Please select a module to run *R*:* * MODULE PARENT(S)* 1 r/4.4.0 StdEnv/2023 2 r/4.3.1 StdEnv/2023 3 r/4.3.1 StdEnv/2020 4 r/4.2.2 StdEnv/2020 5 r/4.2.

Re: [R-pkg-devel] How to use O4 flag in an RCpp project?

2025-05-21 Thread Kasper Daniel Hansen
You set the systems compile options when you run configure for R. Like .configure \ CFLAG="-O4" and then you do the usual make (you need to set a lot more stuff for this to work) On Wed, May 21, 2025 at 4:17 PM Peiyuan Zhu wrote: > So are you suggesting to make a Make file that can skip

Re: [R-pkg-devel] How to use O4 flag in an RCpp project?

2025-05-21 Thread Peiyuan Zhu
So are you suggesting to make a Make file that can skip the system’s setting? I’m not sure what exactly is the solution you’re proposing. On Wednesday, May 21, 2025, Dirk Eddelbuettel wrote: > > On 21 May 2025 at 13:55, Peiyuan Zhu wrote: > | Thanks Kasper, but I don’t know how exactly to accomp

Re: [R-pkg-devel] How to use O4 flag in an RCpp project?

2025-05-21 Thread Dirk Eddelbuettel
On 21 May 2025 at 13:55, Peiyuan Zhu wrote: | Thanks Kasper, but I don’t know how exactly to accomplish this. As Dirk says | the system overwrites it every time.  That is *not* what Dirk said. Dirk -- dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org _

Re: [R-pkg-devel] How to use O4 flag in an RCpp project?

2025-05-21 Thread Kasper Daniel Hansen
As a package writer, you should not in general (IMO) override the settings made by whoever compiled R on your system If you want to use -O4, you should really compile R from source using -O4 and check that it works. Then your package will use it as well. Best, Kasper On Wed, May 21, 2025 at 3:30

Re: [R-pkg-devel] How to use O4 flag in an RCpp project?

2025-05-21 Thread Peiyuan Zhu
The closest I got is the below after putting: PKG_CXXFLAGS = -O3 PKG_CFLAGS = -O3 in Makevars. Still I'm seeing "-falign-functions=64 -Wall -g -O2" after -O3 so the last flag always wins. > load_all(".") ℹ Loading dst Exports from /Users/garyzhubc/Work/dst-1/src/belplauHFast.cpp: NumericMatr

Re: [R-pkg-devel] How to use O4 flag in an RCpp project?

2025-05-21 Thread Dirk Eddelbuettel
On 21 May 2025 at 09:34, Peiyuan Zhu wrote: | I'm happy to just use O3 but it sounds like this isn't something doable in C++. It is called -O3, not 'O3'. (Also Rcpp, not RCpp.) We do not know what you did because you never posted anything even remotely close to reproducible. | Maybe I should 

Re: [R-pkg-devel] gcc-asan replication for armadillo

2025-05-21 Thread Kevin Ushey
Hi Andrew, The relevant code defining the constant is here: https://github.com/RcppCore/RcppArmadillo/blob/66dcdb5e878b391cd44a8c2854898abd002272ed/inst/include/armadillo_bits/constants.hpp#L176 If I understand correctly, that is effectively defining static (global) values for a template class,

Re: [R-pkg-devel] How to use O4 flag in an RCpp project?

2025-05-21 Thread Peiyuan Zhu
Hi Dirk, I'm happy to just use O3 but it sounds like this isn't something doable in C++. Maybe I should just give up RCpp and move the program entirely to C++ from now on. Best regards, Gary On Wed, May 21, 2025 at 5:50 AM Dirk Eddelbuettel wrote: > > On 20 May 2025 at 19:39, Peiyuan Zhu wro

Re: [R-pkg-devel] gcc-asan replication for armadillo

2025-05-21 Thread Dirk Eddelbuettel
Andrew, On 21 May 2025 at 12:48, andrew--- via R-package-devel wrote: | I'm currently having difficulty replicating an ODR violation that is being raised by the gcc-asan check here: https://www.stats.ox.ac.uk/pub/bdr/memtests/gcc-ASAN/RcppPlanc/00install.out. Perhaps weirder, it seems to be t

Re: [R-pkg-devel] gcc-asan replication for armadillo

2025-05-21 Thread andrew--- via R-package-devel
If this were the case I don't think that I'd be having problems replicating it. From: Serguei Sokol Sent: Wednesday, May 21, 2025 9:21 AM To: and...@robbinsa.me ; R Package Development Subject: Re: [R-pkg-devel] gcc-asan replication for armadillo L

Re: [R-pkg-devel] gcc-asan replication for armadillo

2025-05-21 Thread Serguei Sokol
Le 21/05/2025 à 14:48, andrew--- via R-package-devel a écrit : Hi all, I'm currently having difficulty replicating an ODR violation that is being raised by the gcc-asan check here: https://www.stats.ox.ac.uk/pub/bdr/memtests/gcc-ASAN/RcppPlanc/00install.out. Perhaps weirder, it seems to be tr

Re: [R-pkg-devel] How to use O4 flag in an RCpp project?

2025-05-21 Thread Dirk Eddelbuettel
On 20 May 2025 at 19:39, Peiyuan Zhu wrote: | How to use the O4 flag in an RCpp project? Every time when I load_all it | starts using the O2 flag or the debug flag. What should I put into Makevar? | Can I still do remote::install.github(...)? Given that this mailing list can need explicit approv

[R-pkg-devel] gcc-asan replication for armadillo

2025-05-21 Thread andrew--- via R-package-devel
Hi all, I'm currently having difficulty replicating an ODR violation that is being raised by the gcc-asan check here: https://www.stats.ox.ac.uk/pub/bdr/memtests/gcc-ASAN/RcppPlanc/00install.out. Perhaps weirder, it seems to be triggered by an inclusion of armadillo_bits/constants.hpp in both

[R-pkg-devel] How to use O4 flag in an RCpp project?

2025-05-21 Thread Peiyuan Zhu
How to use the O4 flag in an RCpp project? Every time when I load_all it starts using the O2 flag or the debug flag. What should I put into Makevar? Can I still do remote::install.github(...)? [[alternative HTML version deleted]] __ R-package-de