[Rcpp-devel] C++11 Solaris cmath/math.H

Jan Wijffels jwijffels at bnosac.be
Wed Sep 6 15:03:40 CEST 2017


Hello,

I'm trying to fix the installation issue I have with the package udpipe:
https://github.com/bnosac/udpipe but I'm getting issues on Solaris giving
messages like this:

/opt/csw/bin/g++ -std=gnu++11
-I/opt/R/R-3.4.1-patched-gcc/lib/R/include -DNDEBUG
-I"/export/home/XyG0aYI/R/Rcpp/include" -I/opt/csw/include
-I/usr/local/include   -fPIC  -O2 -c RcppExports.cpp -o RcppExports.o
In file included from /opt/csw/include/c++/5.2.0/cmath:44:0,
                 from
/export/home/XyG0aYI/R/Rcpp/include/Rcpp/platform/compiler.h:100,
                 from /export/home/XyG0aYI/R/Rcpp/include/Rcpp/r/headers.h:48,
                 from /export/home/XyG0aYI/R/Rcpp/include/RcppCommon.h:29,
                 from /export/home/XyG0aYI/R/Rcpp/include/Rcpp.h:27,
                 from RcppExports.cpp:4:
/usr/include/math.h:45:12: error: ‘std::float_t’ has not been declared
 using std::float_t;
            ^
/usr/include/math.h:46:12: error: ‘std::double_t’ has not been declared
 using std::double_t;

This type of error seems to be something that has been mentioned in
https://journal.r-project.org/archive/2011-2/RJournal_2011-2_Plummer.pdf
but still can't seem to find the solution.

To make this problem as tiny as possible, I've made a reproducible example.
Let's say I have an R package with the following inside the src folder

#include <Rcpp.h>
using namespace Rcpp;

// [[Rcpp::plugins(cpp11)]]
CharacterVector na_locf(CharacterVector x) {
  return x;
}

If the DESCRIPTION file mentions the following:

Imports: Rcpp (>= 0.12.12)
LinkingTo: Rcpp
SystemRequirements: C++11

Or if there is CXX_STD=CXX11 in the Makevars file, I get the errors like
this when building on Solaris (see log on
https://builder.r-hub.io/status/original/ttt_0.1.0.tar.gz-26c279a1b07047fea8ded89b4e07c6ad),
using rhub::check(platform  = "solaris-x86-patched"), while on Ubuntu this
is working fine.

/opt/csw/bin/g++ -std=gnu++11
-I/opt/R/R-3.4.1-patched-gcc/lib/R/include -DNDEBUG
-I"/export/home/XyG0aYI/R/Rcpp/include" -I/opt/csw/include
-I/usr/local/include   -fPIC  -O2 -c RcppExports.cpp -o RcppExports.o
In file included from /opt/csw/include/c++/5.2.0/cmath:44:0,
                 from
/export/home/XyG0aYI/R/Rcpp/include/Rcpp/platform/compiler.h:100,
                 from /export/home/XyG0aYI/R/Rcpp/include/Rcpp/r/headers.h:48,
                 from /export/home/XyG0aYI/R/Rcpp/include/RcppCommon.h:29,
                 from /export/home/XyG0aYI/R/Rcpp/include/Rcpp.h:27,
                 from RcppExports.cpp:4:
/usr/include/math.h:45:12: error: ‘std::float_t’ has not been declared
 using std::float_t;

I
​f I do not add ​SystemRequirements: C++11 and remove the Makevars file,
this works fine on Solaris. I need however C++11 as I need it in the udpipe
R package for building udpipe.cpp but can't add
to that udpipe.cpp file the following types of statements due to conflicts
on the use of the Free macro.
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::plugins(cpp11)]]

Is there anyone having similar problems that can give an indication on how
to solve this Solaris build issue?

many thanks,
Jan



Jan Wijffels
Statistician
www.bnosac.be  | +32 486 611708
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20170906/c8af4900/attachment.html>


More information about the Rcpp-devel mailing list