简体   繁体   中英

R package requiring the 'libquadmath' library

I made a R package which uses Rcpp and which requires the libquadmath library (to use the multiprecision numbers of boost ). On my personal laptop (Ubuntu 18.04), it works "as is". On win-builder it works by setting PKGLIBS = -lquadmath or PKGLIBS = $(FLIBS) in the Makevars file. But I also checked on r-hub with these settings and for the Fedora Linux distribution (R-devel, clang, gfortran) I get a failure.

This failure is:

/home/docker/R/BH/include/boost/multiprecision/float128.hpp:40:10: fatal error: 'quadmath.h' file not found

So I'm fearing that my package will not pass the CRAN checks. What is the way to go?

You write that you set " PKGLIBS = -lquadmath or PKGLIBS = $(FLIBS) ". Those are linker instructions.

You write that fatal error: 'quadmath.h' file not found . That is a compiler error .

Now, the error comes from float128.hpp which happens to be in a package I maintain, so I took a quick look:

#if defined(BOOST_MP_USE_FLOAT128)

extern "C" {
#include <quadmath.h>
}

So you could suppress the inclusion by trying to ensure BOOST_MP_USE_FLOAT128 . Other than that, I would recommend to look at the Boost documentation for package multiprecision. They may have a hint or two.

Edit: I took a quick peep at the multiprecision documentation but didn't see any leads. For other Boost libraries I have often started from some of the example but I am less familiar with this one.

Edit 2: Your example is also not exactly reproducible. I run Ubuntu here too, and the Boost float128.cpp example works fine on my box via g++ -o fl128 fl128.cpp -lquadmath (when save as fl128.cpp ). You may need to do some discovery in a configure script to see why the other Linux systems at RHub fail.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM