chap icon indicating copy to clipboard operation
chap copied to clipboard

external BOOST library not properly picked up

Open stiobhan opened this issue 5 years ago • 7 comments

I noticed an issue when building with a BOOST library that is installed in a non-standard location. I can get cmake to pick it up by setting -DBOOST_ROOT=/path/to/boost, but when I execute make it fails at some point because the compiler doesn't find the header files:

$ cmake .. -DBOOST_ROOT=$BOOST_HOME
-- The CXX compiler identification is GNU 7.3.0
-- The C compiler identification is GNU 7.3.0
-- 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
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- 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
-- Detecting C compile features
-- Detecting C compile features - done
-- Boost version: 1.68.0
-- Found LAPACKE: /usr/include/x86_64-linux-gnu  
-- Found GROMACS: 2018.4
CMake Warning at /opt/tcbsys/gromacs/2018.4/AVX2_256/share/cmake/gromacs/gromacs-config.cmake:132 (message):
  You are compiling with a different C++ compiler from the one that was used
  to compile GROMACS.  This may lead to linking or runtime problems.  GROMACS
  was compiled with GNU 5.4.0 (/usr/bin/g++-5).
Call Stack (most recent call first):
  CMakeLists.txt:87 (gromacs_check_compiler)


-- Looking for pthread.h
-- Looking for 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  
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/src/chap-version_0_9_1/build

$ make
Scanning dependencies of target googletest
[  0%] Creating directories for 'googletest'
[  1%] Performing download step (download, verify and extract) for 'googletest'
-- Downloading...
   dst='/tmp/src/chap-version_0_9_1/build/googletest-prefix/src/release-1.7.0.zip'
   timeout='none'
-- Using src='https://github.com/google/googletest/archive/release-1.7.0.zip'
-- [download 0% complete]
[...]
-- [download 100% complete]
-- Downloading... done
-- extracting...
     src='/tmp/src/chap-version_0_9_1/build/googletest-prefix/src/release-1.7.0.zip'
     dst='/tmp/src/chap-version_0_9_1/build/googletest-prefix/src/googletest'
-- extracting... [tar xfz]
-- extracting... [analysis]
-- extracting... [rename]
-- extracting... [clean up]
-- extracting... done
[  2%] No patch step for 'googletest'
[  3%] No update step for 'googletest'
[  3%] Performing configure step for 'googletest'
-- The CXX compiler identification is GNU 7.3.0
-- The C compiler identification is GNU 7.3.0
-- 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
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- 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
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PythonInterp: /usr/bin/python (found version "2.7.15") 
-- Looking for pthread.h
-- Looking for 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  
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/src/chap-version_0_9_1/build/googletest-prefix/src/googletest-build
[  4%] Performing build step for 'googletest'
Scanning dependencies of target gtest
[ 25%] Building CXX object CMakeFiles/gtest.dir/src/gtest-all.cc.o
[ 50%] Linking CXX static library libgtest.a
[ 50%] Built target gtest
Scanning dependencies of target gtest_main
[ 75%] Building CXX object CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
[100%] Linking CXX static library libgtest_main.a
[100%] Built target gtest_main
[  5%] No install step for 'googletest'
[  6%] Completed 'googletest'
[  6%] Built target googletest
Scanning dependencies of target chap
[  6%] Building CXX object CMakeFiles/chap.dir/src/aggregation/boltzmann_energy_calculator.cpp.o
[  7%] Building CXX object CMakeFiles/chap.dir/src/aggregation/multiscalar_time_series.cpp.o
[  8%] Building CXX object CMakeFiles/chap.dir/src/aggregation/number_density_calculator.cpp.o
[  9%] Building CXX object CMakeFiles/chap.dir/src/aggregation/scalar_time_series.cpp.o
[  9%] Building CXX object CMakeFiles/chap.dir/src/analysis-setup/residue_information_provider.cpp.o
[ 10%] Building CXX object CMakeFiles/chap.dir/src/config/back_matter.cpp.o
[ 11%] Building CXX object CMakeFiles/chap.dir/src/config/front_matter.cpp.o
[ 12%] Building CXX object CMakeFiles/chap.dir/src/geometry/abstract_cubic_spline_interp.cpp.o
[ 12%] Building CXX object CMakeFiles/chap.dir/src/geometry/abstract_spline_curve.cpp.o
[ 13%] Building CXX object CMakeFiles/chap.dir/src/geometry/basis_spline.cpp.o
[ 14%] Building CXX object CMakeFiles/chap.dir/src/geometry/bspline_basis_set.cpp.o
[ 15%] Building CXX object CMakeFiles/chap.dir/src/geometry/cubic_spline_interp_1D.cpp.o
[ 16%] Building CXX object CMakeFiles/chap.dir/src/geometry/cubic_spline_interp_3D.cpp.o
[ 16%] Building CXX object CMakeFiles/chap.dir/src/geometry/linear_spline_interp_1D.cpp.o
[ 17%] Building CXX object CMakeFiles/chap.dir/src/geometry/spline_curve_1D.cpp.o
/tmp/src/chap-version_0_9_1/src/geometry/spline_curve_1D.cpp:28:10: fatal error: boost/math/tools/minima.hpp: No such file or directory
 #include <boost/math/tools/minima.hpp>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
CMakeFiles/chap.dir/build.make:398: recipe for target 'CMakeFiles/chap.dir/src/geometry/spline_curve_1D.cpp.o' failed
make[2]: *** [CMakeFiles/chap.dir/src/geometry/spline_curve_1D.cpp.o] Error 1
CMakeFiles/Makefile2:355: recipe for target 'CMakeFiles/chap.dir/all' failed
make[1]: *** [CMakeFiles/chap.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2

Running make in verbose mode shows that the compiler command line is missing the flag -I/path/to/boost/include:

$ make VERBOSE=1
/usr/bin/cmake -H/tmp/src/chap-version_0_9_1 -B/tmp/src/chap-version_0_9_1/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /tmp/src/chap-version_0_9_1/build/CMakeFiles /tmp/src/chap-version_0_9_1/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/tmp/src/chap-version_0_9_1/build'
make -f CMakeFiles/googletest.dir/build.make CMakeFiles/googletest.dir/depend
make[2]: Entering directory '/tmp/src/chap-version_0_9_1/build'
cd /tmp/src/chap-version_0_9_1/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /tmp/src/chap-version_0_9_1 /tmp/src/chap-version_0_9_1 /tmp/src/chap-version_0_9_1/build /tmp/src/chap-version_0_9_1/build /tmp/src/chap-version_0_9_1/build/CMakeFiles/googletest.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/tmp/src/chap-version_0_9_1/build'
make -f CMakeFiles/googletest.dir/build.make CMakeFiles/googletest.dir/build
make[2]: Entering directory '/tmp/src/chap-version_0_9_1/build'
make[2]: Nothing to be done for 'CMakeFiles/googletest.dir/build'.
make[2]: Leaving directory '/tmp/src/chap-version_0_9_1/build'
[  6%] Built target googletest
make -f CMakeFiles/chap.dir/build.make CMakeFiles/chap.dir/depend
make[2]: Entering directory '/tmp/src/chap-version_0_9_1/build'
cd /tmp/src/chap-version_0_9_1/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /tmp/src/chap-version_0_9_1 /tmp/src/chap-version_0_9_1 /tmp/src/chap-version_0_9_1/build /tmp/src/chap-version_0_9_1/build /tmp/src/chap-version_0_9_1/build/CMakeFiles/chap.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/tmp/src/chap-version_0_9_1/build'
make -f CMakeFiles/chap.dir/build.make CMakeFiles/chap.dir/build
make[2]: Entering directory '/tmp/src/chap-version_0_9_1/build'
[  7%] Building CXX object CMakeFiles/chap.dir/src/geometry/spline_curve_1D.cpp.o
/usr/bin/c++  -DGMX_DOUBLE=0 -DRAPIDJSON_HAS_STDSTRING -I/opt/tcbsys/gromacs/2018.4/AVX2_256/include -I/tmp/src/chap-version_0_9_1/build/googletest-prefix/src/googletest/include -I/tmp/src/chap-version_0_9_1/build -I/tmp/src/chap-version_0_9_1/include  -O3 -DNDEBUG   -std=c++11 -o CMakeFiles/chap.dir/src/geometry/spline_curve_1D.cpp.o -c /tmp/src/chap-version_0_9_1/src/geometry/spline_curve_1D.cpp
/tmp/src/chap-version_0_9_1/src/geometry/spline_curve_1D.cpp:28:10: fatal error: boost/math/tools/minima.hpp: No such file or directory
 #include <boost/math/tools/minima.hpp>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
CMakeFiles/chap.dir/build.make:398: recipe for target 'CMakeFiles/chap.dir/src/geometry/spline_curve_1D.cpp.o' failed
make[2]: *** [CMakeFiles/chap.dir/src/geometry/spline_curve_1D.cpp.o] Error 1
make[2]: Leaving directory '/tmp/src/chap-version_0_9_1/build'
CMakeFiles/Makefile2:355: recipe for target 'CMakeFiles/chap.dir/all' failed
make[1]: *** [CMakeFiles/chap.dir/all] Error 2
make[1]: Leaving directory '/tmp/src/chap-version_0_9_1/build'
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2

CMakeCache.txt is attached CMakeCache.txt

stiobhan avatar Mar 19 '19 21:03 stiobhan