cmake fails to find stxxl libraries on Centos7
I’m trying to compile osrm from source on CentOS 7.1.1503. This requires stxxl which seems unavailable for CentOS 7; so I got that from git and cmake-d, make-d and make install-ed that.
Then, running cmake .. in the osrm/build directory I get the following output:
cmake .. -- The C compiler identification is GNU 4.8.5 -- The CXX compiler identification is GNU 4.8.5 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Building on a 64 bit system -- Configuring OSRM in release mode -- Performing Test LTO_AVAILABLE -- Performing Test LTO_AVAILABLE - Success -- Performing Test LTO_WORKS -- Performing Test LTO_WORKS - Success -- LTO working -- Disabling LTO on GCC < 4.9.0 since it is broken, see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57038 -- Performing Test HAS_COLOR_FLAG -- Performing Test HAS_COLOR_FLAG - Success -- Setting linker optimizations -- Found ZLIB: /usr/lib64/libz.so (found version "1.2.7") -- Looking for include file pthread.h -- Looking for include file pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - not found -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE -- Found EXPAT: /usr/lib64/libexpat.so (found version "2.1.0") -- Found BZip2: /usr/lib64/libbz2.so (found version "1.0.6") -- Looking for BZ2_bzCompressInit in /usr/lib64/libbz2.so -- Looking for BZ2_bzCompressInit in /usr/lib64/libbz2.so - found -- Found Osmium: /home/pknoppers/osrm-backend/third_party/libosmium/include -- Boost version: 1.53.0 -- Found the following Boost libraries: -- date_time -- filesystem -- iostreams -- program_options -- regex -- system -- thread -- unit_test_framework -- Found Intel TBB -- Looking for Luabind... -- Found Luabind: /usr/local/lib/libluabind.a -- Found Luabind: /usr/local/lib/libluabind.a -- Found Lua52: /usr/lib64/liblua.so;/usr/lib64/libm.so (found version "5.1.4") -- Looking for LuaJIT 5.2 -- Could NOT find LUAJIT (missing: LUAJIT_LIBRARIES) -- Performing Test LUABIND_WORKS -- Performing Test LUABIND_WORKS - Success -- Luabind/Lua5.2 combination working with /usr/lib64/liblua.so -- Looking for STXXL... CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:108 (message): Could NOT find STXXL (missing: STXXL_LIBRARY) Call Stack (most recent call first): /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE) cmake/FindSTXXL.cmake:43 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:300 (find_package)
-- Configuring incomplete, errors occurred!
It is my impression that the make install for stxxl put junk in the /usr/local/lib directory. Part from the output of (re-running) that process is: -- Installing: /usr/local/lib/cmake/stxxl/stxxl-version.cmake -- Installing: /usr/local/lib/cmake/stxxl/stxxl-config.cmake -- Installing: /usr/local/lib/cmake/stxxl/stxxl-targets.cmake -- Installing: /usr/local/lib/cmake/stxxl/stxxl-targets-debug.cmake -- Up-to-date: /usr/local/lib/libstxxl_debug.a
I don't think ".cmake" files should wind up in that directory. Where should I go next?
I can only see
-- Up-to-date: /usr/local/lib/libstxxl_debug.a
so it seems like you built stxxl in debug mode, and you are building osrm-backend in release mode.
Try the following:
1/ Build and install stxxl
mkdir -p build
pushd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .
sudo cmake --build . --target install
popd
Then make sure the stxxl library gets installed; by default it creates a static library; you can also change that by means of -DBUILD_SHARED_LIBS=1 (in general it is probably easier to look at all cmake flags by using ccmake, as in ccmake .. and then toggle flags in the gui).
2/ Build osrm-backend, with a cmake configuration like this
mkdir -p build
pushd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .
sudo cmake --build . --target install
popd
Which should now pick up the stxxl's release version.
Option two, the hacky one: if cmake still does not pick up stxxl, there is the following option: I just looked at the FindSTXXL cmake module and it is also looking in the STXXL_DIR env var for the library. So try exporting that to a directory where you built stxxl locally.
For the record, here is the FindSTXXL CMake module --- I assume adding stxxl_debug after stxxl to NAMES would solve this immediately. Could you modify that file locally and report back?
Daniel-j-h's first comment did the job. After running your commands the cmake .. in osrm completed. Obviously I'm new to cmake. Now compiling osrm... Fingers crossed -- some time passes -- Seems to have worked as well. The last output line is [100%] Built target osrm-routed (Also built osrm-datastore, osrm-extract and osrm-prepare.) Will take some time to test if it all works.
Thanks a lot!
Added Jan 14 2016: Our osrm server is running now (currently serving routes withing the Netherlands).