eddelbuettel/rcpptoml

Install problems with rcpptoml

jgarrigan opened this issue · 8 comments

Hi, I am trying to install the rcpptoml as a prerequisite to installing reticulate but I am getting the following error which is double dutch to me. Any help would be greatly appreciated.

install.packages("RcppTOML")
Installing package into ‘/home/jgarrig1/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/RcppTOML_0.1.7.tar.gz'
Content type 'application/x-gzip' length 42551 bytes (41 KB)
==================================================
downloaded 41 KB

* installing *source* package ‘RcppTOML’ ...
** package ‘RcppTOML’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -std=gnu++11 -I"/opt/R/4.0.5/lib/R/include" -DNDEBUG -I../inst/include/ -DCPPTOML_USE_MAP -I'/opt/R/4.0.5/lib/R/library/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++11 -I"/opt/R/4.0.5/lib/R/include" -DNDEBUG -I../inst/include/ -DCPPTOML_USE_MAP -I'/opt/R/4.0.5/lib/R/library/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c parse.cpp -o parse.o
In file included from parse.cpp:28:0:
../inst/include/toml.hpp: In static member function ‘static std::string includize::toml_spec<char>::unescape_filename(const string&)’:
../inst/include/toml.hpp:29:66: error: no matching function for call to ‘regex_replace(const string&, std::regex, const char [2])’
         return std::regex_replace(str, std::regex("\\\\\""), "\"");
                                                                  ^
../inst/include/toml.hpp:29:66: note: candidates are:
In file included from /usr/include/c++/4.8.2/regex:62:0,
                 from ../inst/include/includize.hpp:7,
                 from ../inst/include/toml.hpp:4,
                 from parse.cpp:28:
/usr/include/c++/4.8.2/bits/regex.h:2162:5: note: template<class _Out_iter, class _Bi_iter, class _Rx_traits, class _Ch_type> _Out_iter std::regex_replace(_Out_iter, _Bi_iter, _Bi_iter, const std::basic_regex<_Ch_type, _Rx_traits>&, const std::basic_string<_Ch_type>&, std::regex_constants::match_flag_type)
     regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
     ^
/usr/include/c++/4.8.2/bits/regex.h:2162:5: note:   template argument deduction/substitution failed:
In file included from parse.cpp:28:0:
../inst/include/toml.hpp:29:66: note:   deduced conflicting types for parameter ‘_Bi_iter’ (‘std::basic_regex<char>’ and ‘const char*’)
         return std::regex_replace(str, std::regex("\\\\\""), "\"");
                                                                  ^
In file included from /usr/include/c++/4.8.2/regex:62:0,
                 from ../inst/include/includize.hpp:7,
                 from ../inst/include/toml.hpp:4,
                 from parse.cpp:28:
/usr/include/c++/4.8.2/bits/regex.h:2182:5: note: template<class _Rx_traits, class _Ch_type> std::basic_string<_Ch_type> std::regex_replace(const std::basic_string<_Ch_type>&, const std::basic_regex<_Ch_type, _Rx_traits>&, const std::basic_string<_Ch_type>&, std::regex_constants::match_flag_type)
     regex_replace(const basic_string<_Ch_type>& __s,
     ^
/usr/include/c++/4.8.2/bits/regex.h:2182:5: note:   template argument deduction/substitution failed:
In file included from parse.cpp:28:0:
../inst/include/toml.hpp:29:66: note:   mismatched types ‘const std::basic_string<_Ch_type>’ and ‘const char [2]’
         return std::regex_replace(str, std::regex("\\\\\""), "\"");
                                                                  ^
make: *** [parse.o] Error 1
ERROR: compilation failed for package ‘RcppTOML’
* removing ‘/home/jgarrig1/R/x86_64-pc-linux-gnu-library/4.0/RcppTOML’
Warning in install.packages :
  installation of package ‘RcppTOML’ had non-zero exit status

The downloaded source packages are in
	‘/tmp/Rtmpi9mgSN/downloaded_packages’

Below is a summary of my session info:

sessionInfo()
R version 4.0.5 (2021-03-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /usr/lib64/libopenblasp-r0.3.3.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] comorbidity_1.0.2         DBI_1.1.2                 readxl_1.4.0              h2o_3.36.0.4             
 [5] rsparkling_3.36.1.1-1-2.4 sparklyr_1.7.5            dbplyr_2.1.1              forcats_0.5.1            
 [9] stringr_1.4.0             dplyr_1.0.9               purrr_0.3.4               readr_2.1.2              
[13] tidyr_1.2.0               tibble_3.1.7              ggplot2_3.3.6             tidyverse_1.3.1          
[17] pacman_0.5.1             

loaded via a namespace (and not attached):
 [1] lubridate_1.8.0   forge_0.2.0       assertthat_0.2.1  rprojroot_2.0.3   digest_0.6.29     utf8_1.2.2       
 [7] R6_2.5.1          cellranger_1.1.0  backports_1.4.1   reprex_2.0.1      httr_1.4.3        pillar_1.7.0     
[13] rlang_1.0.2       rstudioapi_0.13   r2d3_0.2.6        htmlwidgets_1.5.4 RCurl_1.98-1.6    munsell_0.5.0    
[19] broom_0.8.0       compiler_4.0.5    modelr_0.1.8      pkgconfig_2.0.3   base64enc_0.1-3   htmltools_0.5.2  
[25] tidyselect_1.1.2  fansi_1.0.3       crayon_1.5.1      tzdb_0.3.0        withr_2.5.0       bitops_1.0-7     
[31] grid_4.0.5        jsonlite_1.8.0    gtable_0.3.0      lifecycle_1.0.1   magrittr_2.0.3    scales_1.2.0     
[37] cli_3.3.0         stringi_1.7.6     fs_1.5.2          xml2_1.3.3        ellipsis_0.3.2    generics_0.1.2   
[43] vctrs_0.4.1       tools_4.0.5       glue_1.6.2        hms_1.1.1         parallel_4.0.5    fastmap_1.1.0    
[49] colorspace_2.0-3  rvest_1.0.2       haven_2.5.0

From the top of my head, your issue may be CentOS 7. Note how at CRAN, with generally more modern compilers, the package is in good standing.

Also have this exact same issue on CentOS7.

Sorry to hear that. You are welcome to try an older source version of RcppTOML if you are forced to work with an older toolchain.

Great, I got v0.1.3 installed, the issue started with v0.1.4:

install.packages("https://cran.r-project.org/src/contrib/Archive/RcppTOML/RcppTOML_0.1.3.tar.gz", repos=NULL, type="source")

That is old!

The TOML parser I use here is no longer maintained upstream. If I ever switch, it is likely going to be to one even more modern (C++17 or so) so that won't help you.

Hello,

same situation here:
CentOS7, but compiler upgraded.

Current environment:

R version 4.2.1 (2022-06-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)
g++ (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)
Makevars: CXX17

Update from 0.1.3 to 0.1.7 fails apparently due to type mismatch:

> update.packages()
RcppTOML :
 Version 0.1.3 installed in /opt/R/4.2.1/lib/R/library 
 Version 0.1.7 available at https://ftp.fau.de/cran
Update? (Yes/no/cancel) y
trying URL 'https://ftp.fau.de/cran/src/contrib/RcppTOML_0.1.7.tar.gz'
Content type 'application/x-gzip' length 42551 bytes (41 KB)
==================================================
downloaded 41 KB

* installing *source* package ‘RcppTOML’ ...
** package ‘RcppTOML’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -std=gnu++11 -I"/opt/R/4.2.1/lib/R/include" -DNDEBUG -I../inst/include/ -DCPPTOML_USE_MAP -I'/opt/R/4.2.1/lib/R/library/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++11 -I"/opt/R/4.2.1/lib/R/include" -DNDEBUG -I../inst/include/ -DCPPTOML_USE_MAP -I'/opt/R/4.2.1/lib/R/library/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c parse.cpp -o parse.o
In file included from parse.cpp:28:0:
../inst/include/toml.hpp: In static member function ‘static std::string includize::toml_spec::unescape_filename(const string&)’:
../inst/include/toml.hpp:29:66: error: no matching function for call to ‘regex_replace(const string&, std::regex, const char [2])’
         return std::regex_replace(str, std::regex("\\\\\""), "\"");
                                                                  ^
../inst/include/toml.hpp:29:66: note: candidates are:
In file included from /usr/include/c++/4.8.2/regex:62:0,
                 from ../inst/include/includize.hpp:7,
                 from ../inst/include/toml.hpp:4,
                 from parse.cpp:28:
/usr/include/c++/4.8.2/bits/regex.h:2162:5: note: template _Out_iter std::regex_replace(_Out_iter, _Bi_iter, _Bi_iter, const std::basic_regex<_Ch_type, _Rx_traits>&, const std::basic_string<_Ch_type>&, std::regex_constants::match_flag_type)
     regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
     ^
/usr/include/c++/4.8.2/bits/regex.h:2162:5: note:   template argument deduction/substitution failed:
In file included from parse.cpp:28:0:
../inst/include/toml.hpp:29:66: note:   deduced conflicting types for parameter ‘_Bi_iter’ (‘std::basic_regex’ and ‘const char*’)
         return std::regex_replace(str, std::regex("\\\\\""), "\"");
                                                                  ^
In file included from /usr/include/c++/4.8.2/regex:62:0,
                 from ../inst/include/includize.hpp:7,
                 from ../inst/include/toml.hpp:4,
                 from parse.cpp:28:
/usr/include/c++/4.8.2/bits/regex.h:2182:5: note: template std::basic_string<_Ch_type> std::regex_replace(const std::basic_string<_Ch_type>&, const std::basic_regex<_Ch_type, _Rx_traits>&, const std::basic_string<_Ch_type>&, std::regex_constants::match_flag_type)
     regex_replace(const basic_string<_Ch_type>& __s,
     ^
/usr/include/c++/4.8.2/bits/regex.h:2182:5: note:   template argument deduction/substitution failed:
In file included from parse.cpp:28:0:
../inst/include/toml.hpp:29:66: note:   mismatched types ‘const std::basic_string<_Ch_type>’ and ‘const char [2]’
         return std::regex_replace(str, std::regex("\\\\\""), "\"");

I tried to get along with using the installed 0.1.3, but other packages to install depend on 0.1.7.
Any help would be highly welcome.

Best regards

You need to upgrade your compiler. There is a devtoolset with gcc and g++ version 8 available:

https://stackoverflow.com/questions/55345373/how-to-install-gcc-g-8-on-centos

You tried to compile with g++-4.8.2. That compiler is from 2013. Which makes it seriously outdated. We are now at g++-12 with g++-11 the default in many distributions.

I am closing and locking this now. These bugs do not show any issues in RcppTOML, they are solely caused by seriously old system. I am not going to debate the need for those -- many people have valid reasons for whatever crazyness -- but I support this project as a volunteer and it simply takes away from other (volunteer) work if I have to re-explain this again and again.