0
votes

I'm using CMake to build my application using Qt5, Boost and other libraries. It's been going great while I was developing on Ubuntu, now I'm trying to make my code build and run on OSX as well and have been running into some problems.

The library file is there, something else is wrong.

Parts of my main CMakeLists.txt I think relevant:

project(lillebror)
cmake_minimum_required(VERSION 2.8)
cmake_policy(SET CMP0015 NEW)

set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)

find_package(Boost 1.54 COMPONENTS date_time log thread system unit_test_framework REQUIRED)

add_subdirectory(core)
add_subdirectory(server)

server/CMakeLists.txt

aux_source_directory(. SRC_LIST)
add_executable(server ${SRC_LIST})
target_link_libraries(server core ${Boost_LIBRARIES})

However when I run it I get this error:

make[2]: *** No rule to make target `/usr/local/lib/libboost_date_time-mt.a', needed by `server/server'.  Stop.

I added a message(${Boost_Libraries}) in server/CMakeLists.txt and got this output:

/usr/local/lib/libboost_date_time-mt.a/usr/local/lib/libboost_log.a/usr/local/lib/libboost_thread-mt.a/usr/local/lib/libboost_system-mt.a/usr/local/lib/libboost_unit_test_framework-mt.a

The beginning of the cmake output looks like this:

-- Boost version: 1.54.0
-- Found the following Boost libraries:
--   date_time
--   log
--   thread
--   system
--   unit_test_framework

CMake version 2.8.12.1 OSX 10.9.2

Output from VERBOSE=1 make in build/server:

cd /Users/dutt/workspace/lillebror/build && "/Applications/CMake 2.8-12.app/Contents/bin/cmake" -H/Users/dutt/workspace/lillebror -B/Users/dutt/workspace/lillebror/build --check-build-system CMakeFiles/Makefile.cmake 0
cd /Users/dutt/workspace/lillebror/build && "/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E cmake_progress_start /Users/dutt/workspace/lillebror/build/CMakeFiles /Users/dutt/workspace/lillebror/build/server/CMakeFiles/progress.marks
cd /Users/dutt/workspace/lillebror/build && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/Makefile2 server/all
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f messages/CMakeFiles/messages.dir/build.make messages/CMakeFiles/messages.dir/depend
cd /Users/dutt/workspace/lillebror/build && "/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E cmake_depends "Unix Makefiles" /Users/dutt/workspace/lillebror /Users/dutt/workspace/lillebror/messages /Users/dutt/workspace/lillebror/build /Users/dutt/workspace/lillebror/build/messages /Users/dutt/workspace/lillebror/build/messages/CMakeFiles/messages.dir/DependInfo.cmake --color=
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f messages/CMakeFiles/messages.dir/build.make messages/CMakeFiles/messages.dir/build
make[2]: Nothing to be done for `messages/CMakeFiles/messages.dir/build'.
"/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E cmake_progress_report /Users/dutt/workspace/lillebror/build/CMakeFiles  14 15
[ 28%] Built target messages
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f core/CMakeFiles/core.dir/build.make core/CMakeFiles/core.dir/depend
cd /Users/dutt/workspace/lillebror/build && "/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E cmake_depends "Unix Makefiles" /Users/dutt/workspace/lillebror /Users/dutt/workspace/lillebror/core /Users/dutt/workspace/lillebror/build /Users/dutt/workspace/lillebror/build/core /Users/dutt/workspace/lillebror/build/core/CMakeFiles/core.dir/DependInfo.cmake --color=
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f core/CMakeFiles/core.dir/build.make core/CMakeFiles/core.dir/build
make[2]: Nothing to be done for `core/CMakeFiles/core.dir/build'.
"/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E cmake_progress_report /Users/dutt/workspace/lillebror/build/CMakeFiles  3 4 5 6
[ 85%] Built target core
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f server/CMakeFiles/server.dir/build.make server/CMakeFiles/server.dir/depend
cd /Users/dutt/workspace/lillebror/build && "/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E cmake_depends "Unix Makefiles" /Users/dutt/workspace/lillebror /Users/dutt/workspace/lillebror/server /Users/dutt/workspace/lillebror/build /Users/dutt/workspace/lillebror/build/server /Users/dutt/workspace/lillebror/build/server/CMakeFiles/server.dir/DependInfo.cmake --color=
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f server/CMakeFiles/server.dir/build.make server/CMakeFiles/server.dir/build
"/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E cmake_progress_report /Users/dutt/workspace/lillebror/build/CMakeFiles 17
[100%] Building CXX object server/CMakeFiles/server.dir/main.cpp.o
cd /Users/dutt/workspace/lillebror/build/server && /usr/bin/c++    -g -O0 -fno-inline -fprofile-arcs -ftest-coverage -D__GLIBCXX_DEBUG -I/Users/dutt/workspace/lillebror/build/messages -I/Users/dutt/workspace/lillebror/core    -std=c++11 -o CMakeFiles/server.dir/main.cpp.o -c /Users/dutt/workspace/lillebror/server/main.cpp
make[2]: *** No rule to make target `/usr/local/lib/libboost_date_time-mt.a', needed by `server/server'.  Stop.
make[1]: *** [server/CMakeFiles/server.dir/all] Error 2
make: *** [all] Error 2

I grepped for "date" in build/server/... and found this:

server/CMakeFiles/server.dir/link.txt:/usr/bin/c++   -g -O0 -fno-inline -fprofile-arcs -ftest-coverage -D__GLIBCXX_DEBUG -Wl,-search_paths_first -Wl,-headerpad_max_install_names    --coverage CMakeFiles/server.dir/main.cpp.o  -o server  ../core/libcore.a /usr/local/lib/libboost_date_time-mt.a /usr/local/lib/libboost_log.a /usr/local/lib/libboost_thread-mt.a /usr/local/lib/libboost_system-mt.a /usr/local/lib/libboost_unit_test_framework-mt.a ../messages/libmessages.a /usr/local/lib/libboost_date_time-mt.a /usr/local/lib/libboost_log.a /usr/local/lib/libboost_thread-mt.a /usr/local/lib/libboost_system-mt.a /usr/local/lib/libboost_unit_test_framework-mt.a /usr/local/lib/libprotobuf.dylib 

So it seems to be included in the linking step as well. And there they're seperated.

1
Could you please run 'VERBOSE=1 make' and provide output? Looks like missed separator for ${Boost_LIBRARIES} list on MacOSX.Sergei Nikulov
Added to question, if that isn't enough I can add output from make in the root build directory.dutt
Do you have the corresponding libraries in /usr/local/lib ?lrineau
Yes, I'll reformat the question to make that clearer.dutt
@Inneau: Oh, actually it did NOT exist, it's a symlink to a nonexistant file. I didn't check properly before.dutt

1 Answers

1
votes

So it turned out that the file did not exist. It was a symlink to a file that didn't exist, something in my boost installation is wrong.

Lesson: don't just check for file existence, check for symlinks.