Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcc 4.8.5 compatibility #69

Closed
VincentGardeux opened this issue Aug 3, 2020 · 8 comments · Fixed by #71
Closed

gcc 4.8.5 compatibility #69

VincentGardeux opened this issue Aug 3, 2020 · 8 comments · Fixed by #71

Comments

@VincentGardeux
Copy link

Hi,

I'm trying to install another package (tidyr) on CentOS7 which is apparently trying to use cpp11 library.
It throws multiple errors:

g++ -std=gnu++11 -I"/software/R-3.6.2/include" -DNDEBUG  -I"/data/software/R-3.6.2/library/cpp11/include" -I/usr/include -I/software/CLAPACK-3.2.1/INCLUDE -I/software/gsl-2.6/include -I/software/proj-6.0.0/include/proj -I/software/hdf5-1.10.4/include/  -fpic  -g -O2  -c cpp11.cpp -o cpp11.o
In file included from /data/software/R-3.6.2/library/cpp11/include/cpp11/as.hpp:8:0,
                 from /data/software/R-3.6.2/library/cpp11/include/cpp11.hpp:5,
                 from /data/software/R-3.6.2/library/cpp11/include/cpp11/declarations.hpp:8,
                 from cpp11.cpp:4:
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp: In lambda function:
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:47: error: parameter packs not expanded with ‘...’:
       return unwind_protect([&] { return ptr_(a...); });
                                               ^
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:47: note:         ‘a’
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:48: error: expansion pattern ‘a’ contains no argument packs
       return unwind_protect([&] { return ptr_(a...); });
                                                ^
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp: In lambda function:
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:199:38: error: parameter packs not expanded with ‘...’:
   unwind_protect([&] { Rf_error(fmt, args...); });
                                      ^
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:199:38: note:         ‘args’
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:199:42: error: expansion pattern ‘args’ contains no argument packs
   unwind_protect([&] { Rf_error(fmt, args...); });
                                          ^
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp: In lambda function:
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:206:46: error: parameter packs not expanded with ‘...’:
   unwind_protect([&] { Rf_error(fmt.c_str(), args...); });
                                              ^
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:206:46: note:         ‘args’
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:206:50: error: expansion pattern ‘args’ contains no argument packs
   unwind_protect([&] { Rf_error(fmt.c_str(), args...); });
                                                  ^
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp: In instantiation of ‘struct cpp11::protect::function<F>::operator()(A ...) const [with A = {}; F = void(); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = void]::__lambda2’:
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:55:   required from ‘decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) cpp11::protect::function<F>::operator()(A ...) const [with A = {}; F = void(); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = void]’
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:195:65:   required from here
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:47: error: using invalid field ‘cpp11::protect::function<F>::operator()(A ...) const::__lambda2::__a’
       return unwind_protect([&] { return ptr_(a...); });
                                               ^
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp: In instantiation of ‘decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) cpp11::protect::function<F>::operator()(A ...) const [with A = {}; F = void(); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = void]’:
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:195:65:   required from here
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:55: error: return-statement with a value, in function returning 'void' [-fpermissive]
       return unwind_protect([&] { return ptr_(a...); });
                                                       ^
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp: In instantiation of ‘struct cpp11::protect::function<F>::operator()(A ...) const [with A = {const char*, cetype_t}; F = SEXPREC*(const char*, cetype_t); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = SEXPREC*]::__lambda2’:
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:55:   required from ‘decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) cpp11::protect::function<F>::operator()(A ...) const [with A = {const char*, cetype_t}; F = SEXPREC*(const char*, cetype_t); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = SEXPREC*]’
/data/software/R-3.6.2/library/cpp11/include/cpp11/r_string.hpp:16:69:   required from here
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:47: error: using invalid field ‘cpp11::protect::function<F>::operator()(A ...) const::__lambda2::__a’
       return unwind_protect([&] { return ptr_(a...); });
                                               ^
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp: In instantiation of ‘struct cpp11::protect::function<F>::operator()(A ...) const [with A = {int, long unsigned int}; F = SEXPREC*(unsigned int, long int); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = SEXPREC*]::__lambda2’:
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:55:   required from ‘decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) cpp11::protect::function<F>::operator()(A ...) const [with A = {int, long unsigned int}; F = SEXPREC*(unsigned int, long int); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = SEXPREC*]’
/data/software/R-3.6.2/library/cpp11/include/cpp11/list.hpp:75:67:   required from here
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:47: error: using invalid field ‘cpp11::protect::function<F>::operator()(A ...) const::__lambda2::__a’
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp: In instantiation of ‘struct cpp11::protect::function<F>::operator()(A ...) const [with A = {int, long int}; F = SEXPREC*(unsigned int, long int); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = SEXPREC*]::__lambda2’:
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:55:   required from ‘decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) cpp11::protect::function<F>::operator()(A ...) const [with A = {int, long int}; F = SEXPREC*(unsigned int, long int); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = SEXPREC*]’
/data/software/R-3.6.2/library/cpp11/include/cpp11/list.hpp:107:74:   required from here
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:47: error: using invalid field ‘cpp11::protect::function<F>::operator()(A ...) const::__lambda2::__a’
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp: In instantiation of ‘struct cpp11::protect::function<F>::operator()(A ...) const [with A = {SEXPREC*, long int}; F = SEXPREC*(SEXPREC*, long int); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = SEXPREC*]::__lambda2’:
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:55:   required from ‘decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) cpp11::protect::function<F>::operator()(A ...) const [with A = {SEXPREC*, long int}; F = SEXPREC*(SEXPREC*, long int); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = SEXPREC*]’
/data/software/R-3.6.2/library/cpp11/include/cpp11/list.hpp:108:73:   required from here
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:47: error: using invalid field ‘cpp11::protect::function<F>::operator()(A ...) const::__lambda2::__a’
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp: In instantiation of ‘struct cpp11::protect::function<F>::operator()(A ...) const [with A = {const char*}; F = SEXPREC*(const char*); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = SEXPREC*]::__lambda2’:
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:55:   required from ‘decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) cpp11::protect::function<F>::operator()(A ...) const [with A = {const char*}; F = SEXPREC*(const char*); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = SEXPREC*]’
/data/software/R-3.6.2/library/cpp11/include/cpp11/function.hpp:59:50:   required from here
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:47: error: using invalid field ‘cpp11::protect::function<F>::operator()(A ...) const::__lambda2::__a’
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp: In instantiation of ‘struct cpp11::protect::function<F>::operator()(A ...) const [with A = {SEXPREC*, SEXPREC*}; F = SEXPREC*(SEXPREC*, SEXPREC*); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = SEXPREC*]::__lambda2’:
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:55:   required from ‘decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) cpp11::protect::function<F>::operator()(A ...) const [with A = {SEXPREC*, SEXPREC*}; F = SEXPREC*(SEXPREC*, SEXPREC*); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = SEXPREC*]’
/data/software/R-3.6.2/library/cpp11/include/cpp11/function.hpp:59:58:   required from here
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:47: error: using invalid field ‘cpp11::protect::function<F>::operator()(A ...) const::__lambda2::__a’
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp: In instantiation of ‘struct cpp11::protect::function<F>::operator()(A ...) const [with A = {SEXPREC*, cpp11::sexp}; F = SEXPREC*(SEXPREC*, SEXPREC*); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = SEXPREC*]::__lambda2’:
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:55:   required from ‘decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) cpp11::protect::function<F>::operator()(A ...) const [with A = {SEXPREC*, cpp11::sexp}; F = SEXPREC*(SEXPREC*, SEXPREC*); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = SEXPREC*]’
/data/software/R-3.6.2/library/cpp11/include/cpp11/function.hpp:69:66:   required from here
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:47: error: using invalid field ‘cpp11::protect::function<F>::operator()(A ...) const::__lambda2::__a’
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp: In instantiation of ‘struct cpp11::protect::function<F>::operator()(A ...) const [with A = {SEXPREC*, SEXPREC*, Rboolean}; F = SEXPREC*(SEXPREC*, SEXPREC*, Rboolean); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = SEXPREC*]::__lambda2’:
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:55:   required from ‘decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) cpp11::protect::function<F>::operator()(A ...) const [with A = {SEXPREC*, SEXPREC*, Rboolean}; F = SEXPREC*(SEXPREC*, SEXPREC*, Rboolean); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = SEXPREC*]’
/data/software/R-3.6.2/library/cpp11/include/cpp11/environment.hpp:36:81:   required from here
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:47: error: using invalid field ‘cpp11::protect::function<F>::operator()(A ...) const::__lambda2::__a’
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp: In instantiation of ‘struct cpp11::protect::function<F>::operator()(A ...) const [with A = {cpp11::sexp, SEXPREC*, Rboolean}; F = SEXPREC*(SEXPREC*, SEXPREC*, Rboolean); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = SEXPREC*]::__lambda2’:
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:55:   required from ‘decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) cpp11::protect::function<F>::operator()(A ...) const [with A = {cpp11::sexp, SEXPREC*, Rboolean}; F = SEXPREC*(SEXPREC*, SEXPREC*, Rboolean); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = SEXPREC*]’
/data/software/R-3.6.2/library/cpp11/include/cpp11/environment.hpp:47:58:   required from here
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:47: error: using invalid field ‘cpp11::protect::function<F>::operator()(A ...) const::__lambda2::__a’
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp: In instantiation of ‘struct cpp11::protect::function<F>::operator()(A ...) const [with A = {int, int}; F = SEXPREC*(unsigned int, long int); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = SEXPREC*]::__lambda2’:
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:55:   required from ‘decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) cpp11::protect::function<F>::operator()(A ...) const [with A = {int, int}; F = SEXPREC*(unsigned int, long int); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = SEXPREC*]’
/data/software/R-3.6.2/library/cpp11/include/cpp11/strings.hpp:71:70:   required from here
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:47: error: using invalid field ‘cpp11::protect::function<F>::operator()(A ...) const::__lambda2::__a’
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp: In instantiation of ‘struct cpp11::protect::function<F>::operator()(A ...) const [with A = {SEXPREC*}; F = SEXPREC*(SEXPREC*); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = SEXPREC*]::__lambda2’:
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:55:   required from ‘decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) cpp11::protect::function<F>::operator()(A ...) const [with A = {SEXPREC*}; F = SEXPREC*(SEXPREC*); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = SEXPREC*]’
/data/software/R-3.6.2/library/cpp11/include/cpp11/strings.hpp:73:45:   required from here
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:47: error: using invalid field ‘cpp11::protect::function<F>::operator()(A ...) const::__lambda2::__a’
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp: In instantiation of ‘struct cpp11::protect::function<F>::operator()(A ...) const [with A = {cpp11::sexp, SEXPREC*}; F = SEXPREC*(SEXPREC*, SEXPREC*); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = SEXPREC*]::__lambda2’:
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:55:   required from ‘decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) cpp11::protect::function<F>::operator()(A ...) const [with A = {cpp11::sexp, SEXPREC*}; F = SEXPREC*(SEXPREC*, SEXPREC*); decltype (declval<F*>()(cpp11::protect::function::operator()::a ...)) = SEXPREC*]’
/data/software/R-3.6.2/library/cpp11/include/cpp11/function.hpp:27:43:   required from ‘cpp11::sexp cpp11::function::operator()(Args&& ...) const [with Args = {SEXPREC*&, cpp11::named_arg&}]’
/data/software/R-3.6.2/library/cpp11/include/cpp11/environment.hpp:60:35:   required from here
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:183:47: error: using invalid field ‘cpp11::protect::function<F>::operator()(A ...) const::__lambda2::__a’
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp: In instantiation of ‘struct cpp11::stop(const char*, Args ...) [with Args = {}]::__lambda3’:
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:199:49:   required from ‘void cpp11::stop(const char*, Args ...) [with Args = {}]’
/data/software/R-3.6.2/library/cpp11/include/cpp11/as.hpp:98:39:   required from ‘cpp11::is_logical<T> cpp11::as_cpp(SEXP) [with T = bool; cpp11::is_logical<T> = bool; SEXP = SEXPREC*]’
cpp11.cpp:24:452:   required from here
/data/software/R-3.6.2/library/cpp11/include/cpp11/protect.hpp:199:38: error: using invalid field ‘cpp11::stop(const char*, Args ...)::__lambda3::__args’
   unwind_protect([&] { Rf_error(fmt, args...); });
                                      ^
make: *** [cpp11.o] Error 1
ERROR: compilation failed for package ‘tidyr’

Apparently the compilation errors are coming from several hpp files.
If you have any idea of a simple flag to add to make it work? Or if I need to recompile the cpp11 library with specific flags.

Thanks in advance

@yousefi138
Copy link

I'm having the same issue. Also on CentOS. Also trying to install tidyr.

Suggestions would be appreciated.

@jimhester
Copy link
Member

cpp11 requires a compiler with full support for C++11.

What version of CentOS are you using, and what version of GNU compiler? e.g. what is the value of g++ --version

@VincentGardeux
Copy link
Author

Hello @jimhester

As I said, I'm with CentOS 7

Here is the version of the C++ compiler:

$ g++ --version
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)

@yousefi138
Copy link

I'm on:
CentOS Linux release 7.7.1908

On the exact same version of C++ as @VincentGardeux

@jimhester
Copy link
Member

I think this is possibly due to a bug with parameter packs in variadic templates in older gcc versions like 4.8.5 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47226)

I reproduced the issue in a centos 7 docker container using gcc 4.8.5. I was then able to compile tidyr successfully after installing a newer gcc version from the devtoolset-7 software collection, following the instructions at https://linuxize.com/post/how-to-install-gcc-compiler-on-centos-7/#installing-multiple-gcc-versions

@VincentGardeux
Copy link
Author

Very good catch @jimhester it works for me.
It also solves the installation of other packages.

Thanks!

@jimhester jimhester changed the title Bug when compiling another package with cpp11 gcc 4.8.5 compatibility Aug 3, 2020
@jimhester
Copy link
Member

Easy way to reproduce this is the following docker file.

FROM rstudio/r-base:4.0-centos7

RUN R -e 'install.packages("tidyr", repos = c(CRAN = "https://cloud.r-project.org"))'

@stefanoborini
Copy link

When is a new release going to be available for this fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants