jeroen / V8

Embedded JavaScript Engine for R
https://cran.r-project.org/package=V8
Other
200 stars 29 forks source link

Installation failure on RHEL 7.9 #172

Closed whipson closed 8 months ago

whipson commented 8 months ago

I'm trying to install V8 on an on premises server running RHEL 7.9. I've set DISABLE_STATIC_LIBV8=1. I'm getting the following error - seems to be related to C++ compilation.

trying URL 'https://cloud.r-project.org/src/contrib/V8_4.4.1.tar.gz'
Content type 'application/x-gzip' length 678532 bytes (662 KB)
==================================================
downloaded 662 KB

* installing *source* package ‘V8’ ...
** package ‘V8’ successfully unpacked and MD5 sums checked
** using staged installation
Using default C++11 compiler: 
Using CXXCPP=g++ -std=gnu++11 -E
Using PKG_CFLAGS=-I/usr/include/v8 -I/usr/include/v8-3.14
Using PKG_LIBS=-lv8 -lv8_libplatform
Running feature test for pointer compression...
In file included from /usr/include/v8.h:30:0,
                 from tools/test.cpp:2:
/usr/include/v8-internal.h: In function ‘void v8::internal::PerformCastCheck(T*)’:
/usr/include/v8-internal.h:492:33: error: ‘remove_cv_t’ is not a member of ‘std’
             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
                                 ^
/usr/include/v8-internal.h:492:33: error: ‘remove_cv_t’ is not a member of ‘std’
/usr/include/v8-internal.h:492:50: error: template argument 2 is invalid
             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
                                                  ^
/usr/include/v8-internal.h:492:61: error: ‘::Perform’ has not been declared
             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
                                                             ^
Enabling pointer compression
Running feature test for sandbox...
In file included from /usr/include/v8.h:30:0,
                 from tools/test.cpp:2:
/usr/include/v8-internal.h: In function ‘void v8::internal::PerformCastCheck(T*)’:
/usr/include/v8-internal.h:492:33: error: ‘remove_cv_t’ is not a member of ‘std’
             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
                                 ^
/usr/include/v8-internal.h:492:33: error: ‘remove_cv_t’ is not a member of ‘std’
/usr/include/v8-internal.h:492:50: error: template argument 2 is invalid
             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
                                                  ^
/usr/include/v8-internal.h:492:61: error: ‘::Perform’ has not been declared
             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
                                                             ^
In file included from /usr/include/v8.h:30:0,
                 from tools/version.cpp:1:
/usr/include/v8-internal.h: In function ‘void v8::internal::PerformCastCheck(T*)’:
/usr/include/v8-internal.h:492:33: error: ‘remove_cv_t’ is not a member of ‘std’
             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
                                 ^
/usr/include/v8-internal.h:492:33: error: ‘remove_cv_t’ is not a member of ‘std’
/usr/include/v8-internal.h:492:50: error: template argument 2 is invalid
             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
                                                  ^
/usr/include/v8-internal.h:492:61: error: ‘::Perform’ has not been declared
             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
                                                             ^
./configure: line 155: ./v8version: No such file or directory
** libs
rm -f V8.so RcppExports.o bindings.o
g++ -std=gnu++11 -I"/opt/R/4.2.3/lib/R/include" -DNDEBUG -I/usr/include/v8 -I/usr/include/v8-3.14 -DV8_COMPRESS_POINTERS -I'/home/admin/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include' -I/usr/local/include  -fvisibility=hidden -fpic  -g -O2  -c RcppExports.cpp -o RcppExports.o
In file included from /usr/include/v8.h:30:0,
                 from V8_types.h:1,
                 from RcppExports.cpp:4:
/usr/include/v8-internal.h: In function ‘void v8::internal::PerformCastCheck(T*)’:
/usr/include/v8-internal.h:492:33: error: ‘remove_cv_t’ is not a member of ‘std’
             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
                                 ^
/usr/include/v8-internal.h:492:33: error: ‘remove_cv_t’ is not a member of ‘std’
/usr/include/v8-internal.h:492:50: error: template argument 2 is invalid
             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
                                                  ^
/usr/include/v8-internal.h:492:61: error: ‘::Perform’ has not been declared
             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
                                                             ^
make: *** [RcppExports.o] Error 1
ERROR: compilation failed for package ‘V8’
* removing ‘/home/admin/R/x86_64-pc-linux-gnu-library/4.2/V8’

The downloaded source packages are in
    ‘/tmp/RtmpVYVZDr/downloaded_packages’
Warning message:
In install.packages("V8") :
  installation of package ‘V8’ had non-zero exit status
jeroen commented 8 months ago

Which version of R and gcc and libv8 do you have installed? Did you install libv8 from EPEL? Can you show output of

g++ --version

And

yum info v8-devel
whipson commented 8 months ago

R version = 4.2.3

gcc

g++ (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.

yum info v8-devel

Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
runner_gitlab-runner                                                                                                                                 245/245
Installed Packages
Name        : v8-devel
Arch        : x86_64
Epoch       : 2
Version     : 9.4.146.26
Release     : 1.16.20.2.1.el7
Size        : 0.0  
Repo        : installed
From repo   : epel
Summary     : v8 - development headers
URL         : http://nodejs.org/
License     : MIT and ASL 2.0 and ISC and BSD
Description : Development headers for the v8 runtime.
jeroen commented 8 months ago

Hmmm it seems that EPEL has upgraded their v8-devel to a version that requires more recent compilers from Redhat Developer Tools...

jeroen commented 8 months ago

Not sure if this is an option for you, but I tested it with the RedHat devtools compilers. This works on CentOS7:

yum install -y centos-release-scl
yum install -y devtoolset-9-gcc-c++

You can set the CXX17 compiler in R by creating a file ~/.R/Makevars that contains the following:

CXX17=/opt/rh/devtoolset-9/root/usr/bin/g++ -std=gnu++17
CXX17FLAGS=$(CXX11FLAGS)
CXX17PICFLAGS=$(CXX11PICFLAGS)

Alternatively you can set these fields globally for all users in the $(R RHOME)/etc/Makeconf file.

This should work, you can now try to install the V8 package in R.

By the way, there are many R packages these days that require more recent compilers than gcc 4.8. You can automatically but the devtools compilers on the PATH like so:

echo "source /opt/rh/devtoolset-9/enable" >> /etc/bashrc

Now if you restart the machine, g++ --version should give you g++9.

whipson commented 8 months ago

Thanks that seems to have resolved the issue

jeroen commented 8 months ago

By the way, is there any reason you want to use DISABLE_STATIC_LIBV8=1 ? Usually the static libv8 is the easiest solution.

whipson commented 8 months ago

I'd previously tried with DISABLE_STATIC_LIBV8=1 because I saw it is a solution in some previous related issues. When I tried your solution here, I returned it to empty.