Installation issues on RedHat 7

Hi- I am having issues installing nupic-core on my Redhat7 system.(nupic installed ok.). Not sure how much info to put here. But here goes and thanks

ERROR #1:
-- Check for working CXX compiler: /bin/g++ -- broken
      CMake Error at /usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:54 (message):
  The C++ compiler "/bin/g++" is not able to compile a simple test program.
  It fails with the following output:
   Change Dir: /tmp/tmpVb17vn/scripts/ThirdParty/Build/CapnProto/CMakeFiles/CMakeTmp
  Run Build Command:/bin/gmake "cmTryCompileExec1656490146/fast"
  gmake[3]: Entering directory
  `/tmp/tmpVb17vn/scripts/ThirdParty/Build/CapnProto/CMakeFiles/CMakeTmp'
  /bin/gmake -f CMakeFiles/cmTryCompileExec1656490146.dir/build.make
  CMakeFiles/cmTryCompileExec1656490146.dir/build
  gmake[4]: Entering directory
  `/tmp/tmpVb17vn/scripts/ThirdParty/Build/CapnProto/CMakeFiles/CMakeTmp'
  /usr/bin/cmake -E cmake_progress_report
  /tmp/tmpVb17vn/scripts/ThirdParty/Build/CapnProto/CMakeFiles/CMakeTmp/CMakeFiles
  1
  Building CXX object
  CMakeFiles/cmTryCompileExec1656490146.dir/testCXXCompiler.cxx.o
  /bin/g++ -fvisibility=hidden -shared-libgcc -fdiagnostics-show-option -m64
  -fPIC -Wno-unused-variable -Wno-unused-parameter
  -Wno-incompatible-pointer-types -Wno-deprecated-declarations
  -static-libstdc++ -std=c++11 -fvisibility-inlines-hidden -DHAVE_UNISTD_H -o
  CMakeFiles/cmTryCompileExec1656490146.dir/testCXXCompiler.cxx.o -c
  /tmp/tmpVb17vn/scripts/ThirdParty/Build/CapnProto/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
  Linking CXX executable cmTryCompileExec1656490146
  /usr/bin/cmake -E cmake_link_script
  CMakeFiles/cmTryCompileExec1656490146.dir/link.txt --verbose=1
  /bin/g++ -fvisibility=hidden -shared-libgcc -fdiagnostics-show-option -m64
  -fPIC -Wno-unused-variable -Wno-unused-parameter
  -Wno-incompatible-pointer-types -Wno-deprecated-declarations
  -static-libstdc++ -std=c++11 -fvisibility-inlines-hidden -DHAVE_UNISTD_H
  CMakeFiles/cmTryCompileExec1656490146.dir/testCXXCompiler.cxx.o -o
  cmTryCompileExec1656490146 -rdynamic
  /bin/ld: cannot find -lstdc++
  collect2: error: ld returned 1 exit status
  gmake[4]: Leaving directory
  `/tmp/tmpVb17vn/scripts/ThirdParty/Build/CapnProto/CMakeFiles/CMakeTmp'
  gmake[3]: Leaving directory
  `/tmp/tmpVb17vn/scripts/ThirdParty/Build/CapnProto/CMakeFiles/CMakeTmp'
  gmake[4]: *** [cmTryCompileExec1656490146] Error 1
  gmake[3]: *** [cmTryCompileExec1656490146/fast] Error 2
  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)
ERROR # 2 
pcretest.c:1506:14: error: conflicting types for 'sys_errlist'
 extern char *sys_errlist[];
              ^
In file included from /usr/include/stdio.h:853:0,
                 from pcretest.c:54:
/usr/include/bits/sys_errlist.h:27:26: note: previous declaration of 'sys_errlist' was here
 extern const char *const sys_errlist[];
                          ^
make[4]: *** [pcretest-pcretest.o] Error 1
make[3]: *** [all] Error 2
Could not build PCRE
make[2]: *** [ThirdParty/Stamp/Swig/Swig-configure] Error 1
make[1]: *** [external/CMakeFiles/Swig.dir/all] Error 2
make: *** [all] Error 2
Traceback (most recent call last):
  File "setup.py", line 58, in <module>
    
  File "/cfs/ad/binello/nupic.core/bindings/py/setup.py", line 201, in <module>
    getExtensionFiles(platform)
  File "/cfs/ad/binello/nupic.core/bindings/py/setup.py", line 166, in getExtensionFiles
    generateExtensions()
  File "/cfs/ad/binello/nupic.core/bindings/py/setup.py", line 185, in generateExtensions
    subprocess.check_call(["make", "-j3"])
  File "/opt/Anaconda2/lib/python2.7/subprocess.py", line 541, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['make', '-j3']' returned non-zero exit status 2
1 Like

Hi @Sev, thanks for posting your question here. The answers will help others who may run into the same problem.

First of all, it looks like you don’t have g++ installed, which is a C++ compiler. You need to install a C++ 11 compatible compiler on your system. I recommend GCC 4.8 or higher.

No thats whats confusing
We have 4.8.5
ex: g++ --version
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)

You might have more than one gcc compiler installed, and the build is picking up the wrong one. Try setting the following environment variables:

export CC=gcc
export CXX=g++

Also for error num 2. It looks like HAVE_STRERROR is not getting defined
so that in pcretest.c a strerror function is getting defined, Thus causing duplicate declaration error. Is there something I need to set to have this correctly defined.

Right those are defined correctly as well
ex:
acnvm010 259:printenv CC
gcc
acnvm010 260:printenv CXX
g++

This could also be a cmake / gmake issue. I have never used gmake, so not sure how compatible it is with our build.

The make and gmake are one and the same on our system
acnvm010 274:ls /bin/make
-rwxr-xr-x. 1 root root 182736 Jan 26 2014 /bin/make
acnvm010 275:ls /bin/gmake
lrwxrwxrwx. 1 root root 4 Mar 24 2016 /bin/gmake -> make

So make is used to build
and from output I do see cmake is getting used for configuration

Ok, just a guess. This still seems to be the main indicator, IMO:

The C++ compiler "/bin/g++" is not able to compile a simple test program.

Have you compiled any other C++ programs with g++ on this system?

Yes. that works fine.
Do you know what the test is that is used here
If I can find it, I could try compiling it separately.

I don’t know, I thought that cmake was running that check. Honestly I’m not all that familiar with C++ build systems.

Here’s another idea… the error is caused by compilation of Capnproto, which you might try installing yourself manually. I’ve done this before on OS X and it worked for me. See instructions at https://capnproto.org/

Yes cmake does.
Ok. I can try that.
But Let me ask you about error #2 also
as it may relate

Any idea why HAVE_STRERROR is not getting defined.
If I look at code it indicates this should only happen of some old Sun systems.
There arent any env variables/flags I need to set are there ?

Are you using these instructions? These are the commands you should be running assuming $NUPIC_CORE points to the nupic.core checkout directory:

mkdir -p $NUPIC_CORE/build/scripts
cd $NUPIC_CORE/build/scripts
cmake $NUPIC_CORE -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../release -DPY_EXTENSIONS_DIR=$NUPIC_CORE/bindings/py/nupic/bindings

Just making sure you’re running the right commands.

Yes

Also I checked the version of cmake it is 2.8.11
Is that Ok ?
I see that there is a 3.7 release
Is a paticular version required ?

So I downloaded built and installed capnproto ok
How do I now prevent the nupic from doing the same ?
It still seems to go do all the same things as before

I’m sorry @sev, I don’t know the answer to your question. I don’t have time to spin up a VM with Red Hat right now, and I’ve run out of ideas. Give it a few days and maybe someone else will help you out.

Anyone else have NuPIC running on Red Hat?

ok thanks
have a good weekend

Hi I was able to fix our problem. In case it helps others this is a summary.
The compiler test failed, when looking further it indicated it could not find libstdc++
even though this is present on our system. Looking further the link specification
was calling out a static version of this library i.e.: -static-libstdc++
I am not sure why in this case they would call out for a static version, anyhow this is not part of the standard install. Once this was installed I was able to compile.

2 Likes

@sev Excellent! Thanks for being persistent and especially for posting your solution here.