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:
   NumericMatrix belplauHFast(NumericVector MACC, const arma::sp_mat& W2,
NumericMatrix h, bool display_progress = false)

Exports from /Users/garyzhubc/Work/dst-1/src/closure.cpp:
   LogicalMatrix closure(IntegerMatrix ttx, bool computeJoin = true, bool
display_progress = false)

Exports from /Users/garyzhubc/Work/dst-1/src/closureSparse.cpp:
   arma::sp_mat closureSparse(arma::sp_mat ttx, bool computeJoin = true,
bool display_progress = false)

Exports from /Users/garyzhubc/Work/dst-1/src/commSparse.cpp:
   NumericVector commSparse(arma::sp_mat x, arma::sp_mat x_c, double a,
bool display_progress = false)

Exports from /Users/garyzhubc/Work/dst-1/src/iotaSparse.cpp:
   arma::sp_mat iotaSparse(arma::sp_mat tt, bool display_progress = false)

Exports from /Users/garyzhubc/Work/dst-1/src/treeFast.cpp:
   SEXP buildTreeFast(const arma::sp_mat& tt, const Rcpp::NumericVector& q,
bool display_progress = false, Rcpp::Nullable<Rcpp::IntegerVector> indices
= R_NilValue)
   SEXP updateTreeFast(SEXP tree_ptr, LogicalVector xx_vec, LogicalVector
s_vec)
   SEXP supersetFast(SEXP node_ptr, LogicalVector z_vec)
   NumericVector unravelTreeFast(SEXP tree_ptr)
   List inspectNode(SEXP tree_ptr)
   Rcpp::List inspectNodes(Rcpp::List trees)
   Rcpp::List buildTreesFast(const arma::sp_mat& tt, const
Rcpp::NumericVector& q)
   Rcpp::NumericVector unravelTreesFast(Rcpp::List trees)
   Rcpp::List updateTreesFast(Rcpp::List trees, Rcpp::NumericVector xx_vec,
Rcpp::NumericVector s_vec)

/Users/garyzhubc/Work/dst-1/src/RcppExports.cpp updated.
/Users/garyzhubc/Work/dst-1/R/RcppExports.R updated.
ℹ Re-compiling dst
── R CMD INSTALL
──────────────────────────────────────────────────────────────────────────────────────
─  installing *source* package ‘dst’ ... (1.4s)
   ** using staged installation
   ** libs
   using C++ compiler: ‘Apple clang version 17.0.0 (clang-1700.0.13.3)’
   using SDK: ‘’
   clang++ -arch x86_64 -std=gnu++17
-I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG
 
-I'/Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library/Rcpp/include'
-I'/Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library/BH/include'
-I'/Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library/RcppProgress/include'
-I'/Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library/RcppArmadillo/include'
-I/opt/R/x86_64/include   -O3 -fPIC  -falign-functions=64 -Wall -g -O2   -c
RcppExports.cpp -o RcppExports.o



On Wed, May 21, 2025 at 12:57 PM Dirk Eddelbuettel <e...@debian.org> wrote:

>
> 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 just give up RCpp and move the program entirely to C++
> from now
> | on.
>
> Whatever works for you. You could also look at some existing projects and
> see
> what they do; I just did a quick recursive search below my git directory on
> the machine and saw at least two packages set -O3.  So it works for some
> of us.
>
> Good luck either way.
>
> Best, Dirk
>
> --
> dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org
>

        [[alternative HTML version deleted]]

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to