Reputation: 244
I'm trying to compile this Git repo using the given instructions. However, on the cmake --build .;
line, I run into the following issue.
Undefined symbols for architecture x86_64:
"boost::system::detail::generic_category_instance", referenced from:
boost::system::generic_category() in quorum_intersection.cpp.o
ld: symbol(s) not found for architecture x86_64
I edited the CMakeLists.txt
file to incorporate some of the previous answers I saw on similar StackOverflow threads. Below is the CMakeLists.txt file I'm using right now.
cmake_minimum_required (VERSION 2.6)
project (stellar-quorums-verifier)
set(CMAKE_CXX_STANDARD 14)
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED OFF)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost 1.66.0 COMPONENTS graph log program_options REQUIRED system)
if(Boost_FOUND)
add_definitions(-DBOOST_LOG_DYN_LINK)
include_directories(${Boost_INCLUDE_DIRS})
add_executable(quorum_intersection quorum_intersection.cpp)
target_link_libraries(quorum_intersection ${Boost_LIBRARIES})
TARGET_LINK_LIBRARIES(quorum_intersection ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY})
endif()
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_WIN32_THREADS_INIT 0)
set(CMAKE_USE_PTHREADS_INIT 1)
set (CMAKE_CXX_COMPILER_WORKS TRUE)
set (CMAKE_C_COMPILER_WORKS TRUE)
I installed Boost by downloading the source and running ./b2 cxxstd=14
and ./b2 install
, as described here.
What confuses me is that the output of cmake ../;
includes
-- Found Threads: TRUE
-- Boost version: 1.68.0
-- Found the following Boost libraries:
-- graph
-- log
-- program_options
-- system
-- date_time
-- log_setup
-- filesystem
-- thread
-- regex
-- chrono
-- atomic
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/Uthsav/Desktop/quorum_intersection-master/build
so it seems like system should be defined? So I'm not sure why it says boost::system is undefined. I've spent almost the whole night trying to run the code from this Git repo -- if anyone has any advice, I'd greatly appreciate it.
Upvotes: 1
Views: 1021
Reputation: 244
I got the build working by adding
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -O3 -lboost_system -lboost_thread")
to the CMakeLists.txxt file. Not sure why this works, but I found it online somewhere.
Upvotes: 2