Figured it out. cmake was using an old version of gcc/g++, not the one that my command line was picking up when I ran gcc or g++ myself. So, I had to export CC and CXX to the appropriate paths before running cmake.
export CC=/opt/rh/devtoolset-7/root/usr/bin/gcc
export CXX=/opt/rh/devtoolset-7/root/usr/bin/g++
cmake3 -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ..
Previously, I was only running the last line above.
Answer from Josh1billion on Stack ExchangeI think the problem is with the more recent versions of binutils. I tried to compile OpenFOAM with gcc-4.7.2 using binutils 2.23.2 and got the same error with cmake. I tried versions 2.8.3, 2.8.4 and the most recent 2.8.12.1 - all without success (same keypad error). However I later succeeded in compiling cmake-2.8.3 (using gcc 4.7.3 but I think 4.7.2 will work as well) but using binutils 2.23 (not my idea I would add). You can follow the discussion in posts 18-21 http://www.cfd-online.com/Forums/openfoam-installation/121996-error-installing-openfoam-2-2-0-centos-6-4-a.html
in folder OpenFOAM/ThirdParty-2.3.1/cmake-2.8.12.1/Source/CursesDialog
in file CMakeLists.txt
add the following line
target_link_libraries(ccmake tinfo)
(just below other target_link_libraries commands)
regards
I think you should unset CC and CXX, or at least use the system compilers, like this (drop the /local):
export CC=/usr/bin/gcc
export CXX=/usr/bin/g++
I have seen the same symptoms if you have build folders left behind from a build in a different environment (ie switching from local to a container, or between different container variants).
Ensure that you clean the generated build before retrying as it will cache locations to things it can no longer find.