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

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

问题描述

我使用CMake的生成使用QT5,升压和其他图书馆我的申请。这已经持续大,而我是在Ubuntu开发,现在我试图让我的code编译和运行OSX,以及与已运行到一些问题。

该库文件是存在的,别的东西是错误的。

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

 项目(lillebror)
cmake_minimum_required(版本2.8)
cmake_policy(SET CMP0015新)集(Boost_USE_STATIC_LIBS ON)
集(Boost_USE_MULTITHREADED ON)
集(Boost_USE_STATIC_RUNTIME OFF)find_package(升压1.54组件DATE_TIME日志线程系统unit_test_framework必填)add_subdirectory(核心)
add_subdirectory(服务器)

服务器/的CMakeLists.txt

  aux_source_directory(SRC_LIST)
add_executable(服务器$ {} SRC_LIST)
target_link_libraries(服务器核心$ {} Boost_LIBRARIES)

然而,当我运行它,我得到这个错误:

 使[2]:***没有规则,使目标`/usr/local/lib/libboost_date_time-mt.a',用'服务器/服务器所需要的。停止。

我添加了服务器/的CMakeLists.txt消息($ {} Boost_Libraries),并得到了这样的输出:

<$p$p><$c$c>/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的输出的开头是这样的:

   - 升压版本:1.54.0
- 发现下列Boost库:
- 约会时间
- 日志
- 线程
- 系统
- unit_test_framework

CMake的版本2.8.12.1
OSX 10.9.2

从VERBOSE = 1请产出构建/服务器:

  CD /用户/杜特/工作区/ lillebror /编译和放大器;&安培; /应用/ CMake的2.8-12.app/Contents/bin/cmake-H /用户/杜特/工作区/ lillebror -B /用户/杜特/工作区/ lillebror /建造--check的构建系统CMakeFiles / Makefile文件。 cmake的0
CD /用户/杜特/工作区/ lillebror /编译和放大器;&安培; /应用/ CMake的2.8-12.app/Contents/bin/cmake-E cmake_progress_start /用户/杜特/工作区/ lillebror /编译/ CMakeFiles /Users/dutt/workspace/lillebror/build/server/CMakeFiles/progress.marks
CD /用户/杜特/工作区/ lillebror /编译和放大器;&安培; /Applications/X$c$c.app/Contents/Developer/usr/bin/make -f CMakeFiles / Makefile2服务器/所有
/Applications/X$c$c.app/Contents/Developer/usr/bin/make -f消息/ CMakeFiles / messages.dir / build.make消息/ CMakeFiles / messages.dir /取决于
CD /用户/杜特/工作区/ lillebror /编译和放大器;&安培; /应用/ CMake的2.8-12.app/Contents/bin/cmake-E cmake_depends的Unix Makefile文件/用户/杜特/工作区/ lillebror /用户/杜特/工作区/ lillebror /邮件/用户/杜特/工作区/ lillebror /建设/用户/杜特/工作区/ lillebror /编译/消息/Users/dutt/workspace/lillebror/build/messages/CMakeFiles/messages.dir/DependInfo.cmake --color =
/Applications/X$c$c.app/Contents/Developer/usr/bin/make -f消息/ CMakeFiles / messages.dir / build.make消息/ CMakeFiles / messages.dir /编译
使[2]:为`消息/ CMakeFiles / messages.dir /编译做什么也没有。
/应用/ CMake的2.8-12.app/Contents/bin/cmake-E cmake_progress_report /用户/杜特/工作区/ lillebror /编译/ CMakeFiles 14 15
[28%]内置目标信息
/Applications/X$c$c.app/Contents/Developer/usr/bin/make -f核心/ CMakeFiles / core.dir / build.make核心/ CMakeFiles / core.dir /取决于
CD /用户/杜特/工作区/ lillebror /编译和放大器;&安培; /应用/ CMake的2.8-12.app/Contents/bin/cmake-E cmake_depends的Unix Makefile文件/用户/杜特/工作区/ lillebror /用户/杜特/工作区/ lillebror /核心/用户/杜特/工作区/ lillebror /建设/用户/杜特/工作区/ lillebror /编译/核心/Users/dutt/workspace/lillebror/build/core/CMakeFiles/core.dir/DependInfo.cmake --color =
/Applications/X$c$c.app/Contents/Developer/usr/bin/make -f核心/ CMakeFiles / core.dir / build.make核心/ CMakeFiles / core.dir /编译
使[2]:为`核心/ CMakeFiles / core.dir /编译做什么也没有。
/应用/ CMake的2.8-12.app/Contents/bin/cmake-E cmake_progress_report /用户/杜特/工作区/ lillebror /编译/ CMakeFiles 3 4 5 6
[85%]内置目标核心
/Applications/X$c$c.app/Contents/Developer/usr/bin/make -f服务器/ CMakeFiles / server.dir / build.make / CMakeFiles / server.dir /取决于服务器
CD /用户/杜特/工作区/ lillebror /编译和放大器;&安培; /应用/ CMake的2.8-12.app/Contents/bin/cmake-E cmake_depends的Unix Makefile文件/用户/杜特/工作区/ lillebror /用户/杜特/工作区/ lillebror /服务器/用户/杜特/工作区/ lillebror /建设/用户/杜特/工作区/ lillebror /构建/服务器/Users/dutt/workspace/lillebror/build/server/CMakeFiles/server.dir/DependInfo.cmake --color =
/Applications/X$c$c.app/Contents/Developer/usr/bin/make -f服务器/ CMakeFiles / server.dir / build.make服务器/ CMakeFiles / server.dir /编译
/应用/ CMake的2.8-12.app/Contents/bin/cmake-E cmake_progress_report /用户/杜特/工作区/ lillebror /编译/ CMakeFiles 17
[100%]建筑CXX对象服务器/ CMakeFiles / server.dir / main.cpp.o
CD /用户/杜特/工作区/ lillebror /构建/服务器和放大器;&安培;在/ usr /斌/ C ++ -g -O0 -fno内联-fprofile弧-ftest覆盖-D__GLIBCXX_DEBUG -I /用户/杜特/工作区/ lillebror /编译/信息-I /用户/杜特/工作区/ lillebror /核心-std = C ++ 11 -o CMakeFiles / server.dir / main.cpp.o -c /Users/dutt/workspace/lillebror/server/main.cpp
使[2]:***没有规则,使目标`/usr/local/lib/libboost_date_time-mt.a',用'服务器/服务器所需要的。停止。
使[1]:*** [服务器/ CMakeFiles / server.dir /全部]错误2
使:*** [全部]错误2

我grepped在构建/服务器日期/ ...,发现这样的:

 服务器/ CMakeFiles / server.dir / link.txt:在/ usr / bin中/ C ++ -g -O0 -fno内联-fprofile弧-ftest覆盖-D__GLIBCXX_DEBUG -Wl ,-search_paths_first轮候册,-headerpad_max_install_names --coverage CMakeFiles / server.dir / main.cpp.o -o服务器../core/libcore.a /usr/local/lib/libboost_date_time-mt.a在/ usr /本地/ 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 /本地/ LIB / libboost_unit_test_framework-mt.a /usr/local/lib/libprotobuf.dylib

因此​​,似乎要包括在所述连接步骤为好。还有他们分开。


解决方案

所以,事实证明,该文件不存在。这是一个符号链接到一个不存在的文件,东西在我的提振安装是错误的。

课:不要只检查文件所有脑干,检查符号链接

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的升压和OSX上 - 没有规则,使目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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