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

Dr. Jens Oehlschlägel jen@@oeh|@ch|@ege| @end|ng |rom truec|u@ter@com
Sun Sep 13 16:04:56 CEST 2020


Thank you Dirk and Kevin,

that was very helpful and

 >      sudo apt install libc++-dev libc++abi-dev

did the job!

Great, this was very important to me.
Thanks again

Jens



On 13.09.20 02:55, Kevin Ushey wrote:
> My understanding is that many Linux OSes package the clang compiler, the 
> libc++ standard library, and the headers used by the libc++ standard 
> library separately. To install those headers, you likely need (e.g. on 
> Ubuntu):
> 
>      sudo apt install libc++-dev libc++abi-dev
> 
> to be able to build and compile programs against libc++.
> 
> This also comes with the caveat that mixing programs built against 
> different standard library implementations is in general a bad idea, so 
> you may see issues if you mix libraries compiled with libstdc++ and 
> libc++ in the same R session. (This can come up with R packages that 
> link to other libraries installed on the system, which will typically be 
> built with and linked against the "default" system compiler + standard 
> library implementations.) I'm not sure if this will be an issue in 
> practice with what you're doing, but it's worth being aware of.
> 
> Best,
> Kevin
> 
> On Sat, Sep 12, 2020 at 5:50 AM Dirk Eddelbuettel <edd using debian.org 
> <mailto:edd using debian.org>> wrote:
> 
> 
>     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
>     <mailto: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
>     <mailto:edd using debian.org>
> 
>     ______________________________________________
>     R-package-devel using r-project.org <mailto:R-package-devel using r-project.org>
>     mailing list
>     https://stat.ethz.ch/mailman/listinfo/r-package-devel
> 



More information about the R-package-devel mailing list