mercredi 9 août 2017

Building and linking Boost

iam trying to build the boost library and use cmake to build my application. Building and installing boost was just following the Getting Started Guide and changing the prefix to /usr

./bootstrap.sh --prefix=/usr
./b2 install

As result i have now in /usr/lib:

libboost_atomic.a
libboost_atomic.so
libboost_atomic.so.1.64.0
...

And in /usr/include/boost

aligned_storage.hpp
align.hpp
...

My CMakeLists.txt

cmake_minimum_required (VERSION 2.6)
project (NewMediaServer)
# Set the output folder where your program will be created
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/bin)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})    
# set the folder of the binarys
include_directories(${PROJECT_BINARY_DIR}/src)
# find all packages which we are depending on
find_package(Boost 1.64 REQUIRED)
# name the main cpp and the executable
add_executable(mediaserver src/MediaServer.cpp)
# configure compile and linking options
target_compile_options(mediaserver PUBLIC -std=c++11 -Wall)
target_link_libraries(mediaserver PUBLIC -pthread -lboost_system -lboost_log -lboost_log_setup -lboost_thread -lboost_date_time -lboost_filesystem)

When i run make everything works fine, but as soon as iam running the binary iam getting the following error ....

./bin/mediaserver: error while loading shared libraries: libboost_system.so.1.64.0: cannot open shared object file: No such file or directory

Really appreciate any help! I'am still new to Cmake and Boost so be gentle ;) Thanks in advance

Aucun commentaire:

Enregistrer un commentaire