CMake和Boost在OSX上 - 没有规则使目标 [英] CMake and Boost on OSX - no rule to make target

查看:177
本文介绍了CMake和Boost在OSX上 - 没有规则使目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用CMake来构建我的应用程序使用Qt5,Boost和其他库。当我在Ubuntu上开发时,它已经很好了,现在我想让我的代码在OSX上构建并运行,并且遇到了一些问题。





我的主要CMakeLists.txt的部分我认为相关:

  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日志线程系统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(服务器核心$ {Boost_LIBRARIES})
 

make [2]:***没有规则来使目标`/usr/local/lib/libboost_date_time-mt.a','server / server'需要。停止。



我在服务器/ CMakeLists.txt中添加了一条消息($ {Boost_Libraries}),

  /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 

cmake输出的开头如下所示:

   -  Boost版本: 1.54.0 
- 找到以下Boost库:
- date_time
- log
- thread
- system
- unit_test_framework

CMake版本2.8.12.1
OSX 10.9.2



从VERBOSE = 1输出make / server:

  cd / Users / dutt /利卢贝尔/ 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_dependsUnix 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]:没有为`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%]内置目标消息
/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_dependsUnix 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]:对于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%] 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_dependsUnix 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%]构建CXX对象服务器/ 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以使目标`/usr/local/lib/libboost_date_time-mt.a','server / server'需要。停止。
make [1]:*** [server / CMakeFiles / server.dir / all]错误2
make:*** [all]错误2



我在build / server / ...中找到了date,找到了:

  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 

在连接步骤中。

解决方案

结果证明文件不存在。这是一个不存在的文件的符号链接,在我的boost安装是错误的。



课程:不仅检查文件存在,检查符号链接。


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.

解决方案

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 existance, check for symlinks.

这篇关于CMake和Boost在OSX上 - 没有规则使目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆