ycphs / openxlsx

openxlsx - a fast way to read and write complex xslx files
https://ycphs.github.io/openxlsx/
Other
220 stars 74 forks source link

Specify C++11 as a System Requirement #396

Closed hutch3232 closed 1 year ago

hutch3232 commented 1 year ago

Describe the bug When I try to install version 2.4.5, the install fails due to apparently not knowing the variable declaration auto.

To Reproduce


install.packages(pkgs = "/home/pdonn/openxlsx_4.2.5.tar.gz", repos = NULL, type = "source")
Installing package into ‘/home/pdonn/r_packages’
(as ‘lib’ is unspecified)

* installing *source* package ‘openxlsx’ ...
** package ‘openxlsx’ successfully unpacked and MD5 sums checked
** libs

g++  -I/opt/microsoft/ropen/3.5.3/lib64/R/include -DNDEBUG  -I"/home/pdonn/r_packages/Rcpp/include" -DU_STATIC_IMPLEMENTATION   -fpic  -DU_STATIC_IMPLEMENTATION -O2 -g  -c RcppExports.cpp -o RcppExports.o
g++  -I/opt/microsoft/ropen/3.5.3/lib64/R/include -DNDEBUG  -I"/home/pdonn/r_packages/Rcpp/include" -DU_STATIC_IMPLEMENTATION   -fpic  -DU_STATIC_IMPLEMENTATION -O2 -g  -c helper_functions.cpp -o helper_functions.o
g++  -I/opt/microsoft/ropen/3.5.3/lib64/R/include -DNDEBUG  -I"/home/pdonn/r_packages/Rcpp/include" -DU_STATIC_IMPLEMENTATION   -fpic  -DU_STATIC_IMPLEMENTATION -O2 -g  -c load_workbook.cpp -o load_workbook.o
load_workbook.cpp: In function ‘Rcpp::CharacterVector getChildlessNode(std::string, std::string)’:
load_workbook.cpp:925:10: error: ‘itr’ does not name a type
     auto itr = 0;
          ^
load_workbook.cpp:934:11: error: ‘itr’ was not declared in this scope
       if (itr == 0) begPos = begPos + begTag.length();
           ^
load_workbook.cpp:945:9: error: ‘itr’ was not declared in this scope
       ++itr;
         ^
make: *** [load_workbook.o] Error 1
ERROR: compilation failed for package ‘openxlsx’
* removing ‘/home/pdonn/r_packages/openxlsx’
Warning in install.packages :
  installation of package ‘/home/pdonn/openxlsx_4.2.5.tar.gz’ had non-zero exit status

I suspect the issue is due to me being on a very old system. Unfortunately I cannot upgrade it for the foreseeable future:

sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server 7.9 (Maipo)

Matrix products: default
BLAS: /opt/microsoft/ropen/3.5.3/lib64/R/lib/libRblas.so
LAPACK: /opt/microsoft/ropen/3.5.3/lib64/R/lib/libRlapack.so

locale:
[1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     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] RevoUtils_11.0.3     RevoUtilsMath_11.0.0

loaded via a namespace (and not attached):
[1] compiler_3.5.3 httr_1.4.4     R6_2.5.1       tools_3.5.3  

> system("gcc --version")
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)

Copyright (C) 2015 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Expected behavior Package should declare the use of C++11 to help the compiler know to use that.

Screenshots NA

Example files NA

Additional context I found this page: https://teuder.github.io/rcpp4everyone_en/050_c++11.html

There it says: image

As a test I added that one line to DESCRIPTION and then successfully was able to install the package!

install.packages(pkgs = "/home/pdonn/openxlsx_4.2.5.tar.gz", repos = NULL, type = "source")
Installing package into ‘/home/pdonn/r_packages’
(as ‘lib’ is unspecified)
* installing *source* package ‘openxlsx’ ...
file ‘DESCRIPTION’ has the wrong MD5 checksum
** libs
g++ -std=gnu++11 -I/opt/microsoft/ropen/3.5.3/lib64/R/include -DNDEBUG  -I"/home/pdonn/r_packages/Rcpp/include" -DU_STATIC_IMPLEMENTATION   -fpic  -DU_STATIC_IMPLEMENTATION -g -O2 -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++11 -I/opt/microsoft/ropen/3.5.3/lib64/R/include -DNDEBUG  -I"/home/pdonn/r_packages/Rcpp/include" -DU_STATIC_IMPLEMENTATION   -fpic  -DU_STATIC_IMPLEMENTATION -g -O2 -c helper_functions.cpp -o helper_functions.o
g++ -std=gnu++11 -I/opt/microsoft/ropen/3.5.3/lib64/R/include -DNDEBUG  -I"/home/pdonn/r_packages/Rcpp/include" -DU_STATIC_IMPLEMENTATION   -fpic  -DU_STATIC_IMPLEMENTATION -g -O2 -c load_workbook.cpp -o load_workbook.o
g++ -std=gnu++11 -I/opt/microsoft/ropen/3.5.3/lib64/R/include -DNDEBUG  -I"/home/pdonn/r_packages/Rcpp/include" -DU_STATIC_IMPLEMENTATION   -fpic  -DU_STATIC_IMPLEMENTATION -g -O2 -c read_workbook.cpp -o read_workbook.o
g++ -std=gnu++11 -I/opt/microsoft/ropen/3.5.3/lib64/R/include -DNDEBUG  -I"/home/pdonn/r_packages/Rcpp/include" -DU_STATIC_IMPLEMENTATION   -fpic  -DU_STATIC_IMPLEMENTATION -g -O2 -c write_data.cpp -o write_data.o
g++ -std=gnu++11 -I/opt/microsoft/ropen/3.5.3/lib64/R/include -DNDEBUG  -I"/home/pdonn/r_packages/Rcpp/include" -DU_STATIC_IMPLEMENTATION   -fpic  -DU_STATIC_IMPLEMENTATION -g -O2 -c write_file.cpp -o write_file.o
g++ -std=gnu++11 -I/opt/microsoft/ropen/3.5.3/lib64/R/include -DNDEBUG  -I"/home/pdonn/r_packages/Rcpp/include" -DU_STATIC_IMPLEMENTATION   -fpic  -DU_STATIC_IMPLEMENTATION -g -O2 -c write_file_2.cpp -o write_file_2.o
g++ -std=gnu++11 -shared -L/opt/microsoft/ropen/3.5.3/lib64/R/lib -o openxlsx.so RcppExports.o helper_functions.o load_workbook.o read_workbook.o write_data.o write_file.o write_file_2.o -L/opt/microsoft/ropen/3.5.3/lib64/R/lib -lR
installing to /home/pdonn/r_packages/openxlsx/libs

** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (openxlsx)
hutch3232 commented 1 year ago

Was informed that CRAN requires C++17 as the minimum version: https://github.com/JanMarvin/openxlsx2/pull/529 Also noted here: https://cran.r-project.org/doc/manuals/R-exts.html#Using-C_002b_002b-code. Closing as no longer needed.