0

System specifications: Centos 7 with devtoolset-8 enabled (gcc 8.3.1), cmake 3.14.6

I seem to have an error regarding gcc versioning causing a 'type error'

I am trying to build a gitlab project (https://github.com/ColinKennedy/USD-Cookbook/tree/master/plugins/custom_resolver) which needs a built version of Pixar's USD. I've already successfully built USD and run the following commands to build the custom resolver project and provide it the location of USD:

scl enable devtoolset-8 bash

USD_INSTALL_ROOT=/home/fernandos/Documents/USD cmake ..

make install

however during make install this error pops up:

/home/fernandos/Documents/USD/include/pxr/base/tf/hash.h:44:6: error: ‘enable_if_t’ in namespace ‘std’ does not name a template type
 std::enable_if_t<std::is_integral<T>::value>

This type error seems to indicate an error possibly caused by a wrong version of gcc if I look at other stack overflow posts. I know that enable_if_t was added in c++14, so if you have an old compiler (such as the standard gcc 4.8.1 on Centos 7) it would throw this error as it standard uses c++11 to compile. However, I'm using the devtoolset-8 environment and everything seems to indicate that I am using gcc 8.3.1 to compile (I even make the MakeFile print the version out). So, how is it possible that I get this error, does gcc 8.3.1 not know this type?

I also noticed that the error originates from my USD build: I am not sure if this matters, but I built it with gcc 6.3.1 (which certainly knows the enable_if_t type). As I am relatively new to building on linux with cmake/make could this cause problems?

  • 2
    ¿Are you compiling it using c++14 standard though? – user7860670 Mar 10 '21 at 12:52
  • Did you miss `set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON)`? – super Mar 10 '21 at 12:54
  • C++14 is default in GCC 6.1 and up, so it should be unavailable only if OP manually chose lower standard. – Yksisarvinen Mar 10 '21 at 13:03
  • I never chose any lower c++xx standard. I also tried explicitly passing the -DCMAKE_CXX_STANDARD=14 flag when calling cmake, to no avail. I'm really sure that I am using gcc 8.3.1 to compile which should use c++14 as the standard to compile (source: https://gcc.gnu.org/projects/cxx-status.html#cxx14). My only hunch is that maybe the gcc 4.8.1 from standard Centos 7 is somehow still found, but so far everything points to gcc 8.3.1 being used. – Fernando Suarez Mar 10 '21 at 17:50
  • I also tried adding the `set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON)` to the cmake file, but this also does not fix it – Fernando Suarez Mar 11 '21 at 09:23
  • I found the solution: in one of the CMakeLists.txt files there was indeed a line set(CMAKE_CXX_STANDARD 11) which was causing the problem. By changing it to 14 it got solved. So I guess the solution to this problem is to go over all the CMakeList files to see if any of them declare the wrong C++ version – Fernando Suarez Mar 12 '21 at 12:16

0 Answers0