I'm trying to compile and install Pistache on a CentOS 7 machine, following their instructions.
This is a package that requires C++ 11, so since the Development Tools package on CentOS 7 installs an old version of gcc (4.8.3) that doesn't support C++ 11 features, I've installed devtoolset-7 and enabled it with scl enable devtoolset-7 bash
. This appears to be functioning properly, as gcc --version
displays gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
.
However, when I try to make
the Pistache sources, I get this compilation error:
/root/compiler_installation_script/pistache/src/server/router.cc:102:45: error: no matching function for call to ‘regex_replace(const string&, std::regex&, const char [2])’
SegmentTreeNode::multiple_slash, "/");
^
/root/compiler_installation_script/pistache/src/server/router.cc:102:45: note: candidates are:
In file included from /usr/include/c++/4.8.2/regex:62:0,
Unless I'm misunderstanding, this seems to indicate that my compiler is using outdated C++ include headers that are compatible with gcc 4.8.3, resulting in the error. How can I fix this?
Note: I'm sure the issue isn't with Pistache source itself, as I've compiled this successfully on other machines, including a fresh CentOS 7 machine yesterday.
Best Answer
Figured it out.
cmake
was using an old version of gcc/g++, not the one that my command line was picking up when I rangcc
org++
myself. So, I had to export CC and CXX to the appropriate paths before running cmake.Previously, I was only running the last line above.