[R-pkg-devel] Rcpp with clang++ -stdlib=libc++ ?

Dirk Eddelbuettel edd @end|ng |rom deb|@n@org
Sat Sep 12 14:50:11 CEST 2020


Hi Jens,

On 11 September 2020 at 21:00, Dr. Jens Oehlschlägel wrote:
| I can compile a package under clang++ with -stdlib=libstdc++, but with -stdlib=libc++ I get
| 
| "
| In file included from /home/jo/R/x86_64-pc-linux-gnu-library/4.0/Rcpp/include/Rcpp/r/headers.h:67:
| /home/jo/R/x86_64-pc-linux-gnu-library/4.0/Rcpp/include/Rcpp/platform/compiler.h:100:10: fatal error: 'cmath' file not found
| #include <cmath>
|          ^~~~~~~
| 1 error generated.
| "
| 
| Is there any howto for using Rcpp with -stdlib=libc++ ?

That has zero to do with Rcpp.  You are lacking a C++ library header when
switching the C++ standard library along with clang. Nothing that Rcpp ships,
or governs, or selects.  

I am forgetting the fine details here (and someone may hopefully fill in
fuller details) but in short, "that is just the way it is".  I think we
simply pivot back to the g++ standard C++ library even when using clang++.

Cheers from Chicago,  Dirk

| Greetings from Munich
| 
| Jens Oehlschlägel
| 
|  
| P.S.
| 
| Package Makevars
| CXX_STD = CXX17
| PKG_CXXFLAGS=-O3 -march=native -pthread
| PKG_LIBS=-latomic -pthread
| 
| ~.R/Makevars
| CXX17 = clang++ -stdlib=libc++
| CXX17FLAGS = -fstack-protector-strong -D_FORTIFY_SOURCE=2 -g $(LTO)
| CXX17STD = -std=c++17
| 
| > packageVersion("Rcpp")
| [1] ‘1.0.5’
| 
| > version
|                _                          
| platform       x86_64-pc-linux-gnu        
| arch           x86_64                     
| os             linux-gnu                  
| system         x86_64, linux-gnu          
| status                                    
| major          4                          
| minor          0.2                        
| year           2020                       
| month          06                         
| day            22                         
| svn rev        78730                      
| language       R                          
| version.string R version 4.0.2 (2020-06-22)
| nickname       Taking Off Again
| 
| ______________________________________________
| R-package-devel using r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-package-devel

-- 
https://dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org



More information about the R-package-devel mailing list