0
votes

I am trying to compile a C++ project that uses Boost. I have tried this on a Windows machine (first trying with cygwin, then with Visual Studio) as well as a Macbook. I continue to run into the problem that cmake will find Boost just fine, but make will tell me that it can't find the first boost library it needs to look for. I've tried using make -I/path/to/boost/parent/directory/ and the output is identical.

I've attached the Mac terminal output for cmake .. and make below. I'll also include the steps that I took, and attempts to dissect the problem:

  1. Ran brew install boost
  2. Ran git clone git-repo
  3. Ran mkdir build cmake .. make

I have also reinstalled boost, reinstalled brew, and checked that the proper include paths were being used by the compiler. CMakeLists.txt has the line find_package(Boost REQUIRED). Doing all these yields the same results shown below.

Any help solving this would be greatly appreciated.

mudly@MyMac build % cmake ..

-- The C compiler identification is AppleClang 12.0.5.12050022
-- The CXX compiler identification is AppleClang 12.0.5.12050022
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Boost: /usr/local/lib/cmake/Boost-1.76.0/BoostConfig.cmake (found version "1.76.0")  
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES) 
-- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES) 
-- Could NOT find OpenMP (missing: OpenMP_C_FOUND OpenMP_CXX_FOUND) 
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/mudly/source/matching/matching/build
mudly@MyMac build % make

[ 10%] Building CXX object CMakeFiles/matching_distance_test.dir/tests/test_bifiltration.cpp.o
[ 20%] Building CXX object CMakeFiles/matching_distance_test.dir/tests/test_common.cpp.o
In file included from /Users/mudly/source/matching/matching/tests/test_common.cpp:9:
In file included from /Users/mudly/source/matching/matching/include/matching_distance.h:19:
In file included from /Users/mudly/source/matching/matching/../bottleneck/include/bottleneck.h:41:
In file included from /Users/mudly/source/matching/matching/../bottleneck/include/bottleneck_detail.h:41:
In file included from /Users/mudly/source/matching/matching/../bottleneck/include/bound_match.h:36:
In file included from /Users/mudly/source/matching/matching/../bottleneck/include/neighb_oracle.h:37:
/Users/mudly/source/matching/matching/../bottleneck/include/dnn/geometry/euclidean-fixed.h:4:10: fatal error: 'boost/operators.hpp' file not found

#include <boost/operators.hpp>

         ^~~~~~~~~~~~~~~~~~~~~

1 error generated.
make[2]: *** [CMakeFiles/matching_distance_test.dir/tests/test_common.cpp.o] Error 1
make[1]: *** [CMakeFiles/matching_distance_test.dir/all] Error 2
make: *** [all] Error 2
1
"...using make -I/path/to/boost/..." this should be the parent directory of boost as #include <boost/operators.hpp> includes boost/ in the name of the file to be included.Richard Critten
@RichardCritten Thanks for the note. I was a cavalier about editing out actual paths on my computer, but I did use the parent directory. I'll edit the post to reflect a more accurate pathMudly
It might be helpful to look at the exact command used by make to invoke your compiler (make sure that the desired flags are there and that they match the directory structure on your system).JaMiT

1 Answers

0
votes

I have solved the problem. Adding the line include_directories(/path/to/libraries/) in the CMake file was enough.