boost - cmake 找不到 boost 线程

标签 boost cmake ubuntu-12.04 emscripten

我正在尝试使用 emscripten 将一些项目编译为 js。该项目使用cmake作为构建工具。

这就是我调用 cmake 的方式:

cmake -DEMSCRIPTEN=1 
-DCMAKE_TOOLCHAIN_FILE=~/Documents/emscripten/cmake/Platform/Emscripten_unix.cmake
-DCMAKE_MODULE_PATH=~/Documents/emscripten/cmake 
-DCMAKE_BUILD_TYPE=Release 
-G "Unix Makefiles" 
-DRDK_BUILD_PYTHON_WRAPPERS= 
-DBOOST_INCLUDEDIR=~/Documents/boost_1_53_0/boost 
-DBOOST_LIBRARYDIR=~/Documents/boost_1_53_0/stage/lib 
-DBoost_REGEX_LIBRARY=~/Documents/boost_1_53_0/stage/lib/libboost_regex.a 
-DBOOST_ROOT=~/Documents/boost_1_53_0 
-DBoost_NO_SYSTEM_PATHS=TRUE 
-DBoost_USE_MULTITHREADED=FALSE 
-DBoost_USE_STATIC_LIBS=OFF 
-DBoost_USE_STATIC_RUNTIME=OFF 
-DBoost_ADDITIONAL_VERSIONS="1.53.0" 
-DBoost_DETAILED_FAILURE_MSG=TRUE 
-DBoost_NO_BOOST_CMAKE=ON 
-DBoost_DEBUG=TRUE 
..

这是我在/home/mnowotka/Documents/boost_1_53_0/stage/lib 目录中的内容:

ls -lh ~/Documents/boost_1_53_0/stage/lib
total 4.4M
-rw-rw-r-- 1 mnowotka mnowotka 2.6M Apr 11 10:49 libboost_regex.a
lrwxrwxrwx 1 mnowotka mnowotka   24 Apr 11 10:10 libboost_regex.so -> libboost_regex.so.1.53.0
-rw-rw-r-- 1 mnowotka mnowotka 1.9M Apr 11 10:10 libboost_regex.so.1.53.0

这是我从 cmake 得到的:

-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:667 ] Include debugging info:
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:669 ]   _boost_INCLUDE_SEARCH_DIRS = /home/mnowotka/Documents/boost_1_53_0/boost;/home/mnowotka/Documents/boost_1_53_0/include;/home/mnowotka/Documents/boost_1_53_0
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:671 ]   _boost_PATH_SUFFIXES = boost-1_53_0;boost_1_53_0;boost-1_48_0;boost_1_48_0;boost-1_48;boost_1_48;boost-1_47_0;boost_1_47_0;boost-1_47;boost_1_47;boost-1_46_1;boost_1_46_1;boost-1_46_0;boost_1_46_0;boost-1_46;boost_1_46;boost-1_45_0;boost_1_45_0;boost-1_45;boost_1_45;boost-1_44_0;boost_1_44_0;boost-1_44;boost_1_44;boost-1_43_0;boost_1_43_0;boost-1_43;boost_1_43;boost-1_42_0;boost_1_42_0;boost-1_42;boost_1_42;boost-1_41_0;boost_1_41_0;boost-1_41;boost_1_41;boost-1_40_0;boost_1_40_0;boost-1_40;boost_1_40;boost-1_39_0;boost_1_39_0;boost-1_39;boost_1_39
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:696 ] location of version.hpp: /home/mnowotka/Documents/boost_1_53_0/boost/version.hpp
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:715 ] version.hpp reveals boost 1.53.0
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:808 ] guessed _boost_COMPILER = 
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:818 ] _boost_MULTITHREADED = 
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:861 ] _boost_RELEASE_ABI_TAG = -
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:863 ] _boost_DEBUG_ABI_TAG = -d
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:906 ] _boost_LIBRARY_SEARCH_DIRS = /home/mnowotka/Documents/boost_1_53_0/stage/lib;/home/mnowotka/Documents/boost_1_53_0/lib;/home/mnowotka/Documents/boost_1_53_0/stage/lib;/home/mnowotka/Documents/boost_1_53_0/lib;/home/mnowotka/Documents/boost_1_53_0/../lib;/home/mnowotka/Documents/boost_1_53_0/stage/lib
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:1119 ] Boost_FOUND = TRUE
-- Boost version: 1.53.0
-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_PTHREAD_H - found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE 
-- Found BISON: /usr/bin/bison 
-- Found FLEX: /usr/bin/flex 
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:525 ] Boost not in cache
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:528 ] _boost_TEST_VERSIONS = 1.53.0;1.48.0;1.48;1.47.0;1.47;1.46.1;1.46.0;1.46;1.45.0;1.45;1.44.0;1.44;1.43.0;1.43;1.42.0;1.42;1.41.0;1.41;1.40.0;1.40;1.39.0;1.39
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:530 ] Boost_USE_MULTITHREADED = FALSE
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:532 ] Boost_USE_STATIC_LIBS = OFF
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:534 ] Boost_USE_STATIC_RUNTIME = OFF
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:536 ] Boost_ADDITIONAL_VERSIONS = 1.53.0
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:538 ] Boost_NO_SYSTEM_PATHS = TRUE
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:606 ] Declared as CMake or Environmental Variables:
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:608 ]   BOOST_ROOT = /home/mnowotka/Documents/boost_1_53_0
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:610 ]   BOOST_INCLUDEDIR = /home/mnowotka/Documents/boost_1_53_0/boost
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:612 ]   BOOST_LIBRARYDIR = /home/mnowotka/Documents/boost_1_53_0/stage/lib
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:614 ] _boost_TEST_VERSIONS = 1.53.0;1.48.0;1.48;1.47.0;1.47;1.46.1;1.46.0;1.46;1.45.0;1.45;1.44.0;1.44;1.43.0;1.43;1.42.0;1.42;1.41.0;1.41;1.40.0;1.40;1.39.0;1.39
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:696 ] location of version.hpp: /home/mnowotka/Documents/boost_1_53_0/boost/version.hpp
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:715 ] version.hpp reveals boost 1.53.0
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:808 ] guessed _boost_COMPILER = 
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:818 ] _boost_MULTITHREADED = 
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:861 ] _boost_RELEASE_ABI_TAG = -
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:863 ] _boost_DEBUG_ABI_TAG = -d
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:906 ] _boost_LIBRARY_SEARCH_DIRS = /home/mnowotka/Documents/boost_1_53_0/stage/lib;/home/mnowotka/Documents/boost_1_53_0/lib;/home/mnowotka/Documents/boost_1_53_0/stage/lib;/home/mnowotka/Documents/boost_1_53_0/lib;/home/mnowotka/Documents/boost_1_53_0/../lib;/home/mnowotka/Documents/boost_1_53_0/stage/lib
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:977 ] Searching for REGEX_LIBRARY_RELEASE: boost_regex-1_53;boost_regex;boost_regex-1_53;boost_regex;boost_regex
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:1009 ] Searching for REGEX_LIBRARY_DEBUG: boost_regex-d-1_53;boost_regex-d;boost_regex-d-1_53;boost_regex-d;boost_regex;boost_regex
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:1119 ] Boost_FOUND = FALSE
CMake Error at /usr/share/cmake-2.8/Modules/FindBoost.cmake:1202 (message):
Unable to find the requested Boost libraries.

Boost version: 1.53.0

Boost include path: /home/mnowotka/Documents/boost_1_53_0

The following Boost libraries could not be found:

      boost_regex

No Boost libraries were found.  You may need to set BOOST_LIBRARYDIR to the
directory containing Boost libraries or BOOST_ROOT to the location of
Boost.
Call Stack (most recent call first):
Code/GraphMol/SLNParse/CMakeLists.txt:4 (find_package)


CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
Boost_REGEX_LIBRARY (ADVANCED)
linked by target "testSLNParse" in directory /home/mnowotka/Documents/rdkit-code/Code/GraphMol/SLNParse

-- Configuring incomplete, errors occurred!

我只有一个问题:为什么?

我做错了什么?这让我发疯......

(顺便说一句:我设置 Boost_USE_STATIC_LIBSBoost_USE_STATIC_RUNTIME ONOFF 并不重要 - 它也不起作用...)

最佳答案

  1. 您知道,Emscripten 目前只能使用其源代码模块(例如 BoostBoost-Regex)编译?换句话说,Emscripten不能使用动态库或预编译的静态库!

    • 因此,您必须将 Boost-Regex 的源代码添加到您的 cmake 文件中,并将它们一起构建(我还没有完成 cmake em> 很长一段时间所以我无法告诉你如何)。

    • 或者您可以从 cmake 中删除对 Boost-Regex 的检查,并对必要的引用进行硬编码

    无论您选择做什么,您都必须使用 Emscripten 构建 Boost-Regex!

  2. 对于 Emscripten,您确实应该使用 Boost_USE_STATIC_LIBS=ON,因为 Emscripten 目前不支持动态库(参见上文) )。

  3. Emscripten 也不支持调用 pthread* 或任何并发处理。您应该在代码中搜索这些内容。

抱歉,听起来如此消极,但目前使用 Emscripten 库并不是小菜一碟。

关于boost - cmake 找不到 boost 线程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15950395/

相关文章:

c++ - CMAKE COMPILER_CXX_ID 行为

python-2.7 - 如何在 Ubuntu 12.04 中删除 Python 版本?

tsql - 使用 freeTDS 错误 : Read from the server failed 连接到 SQL-Azure

linux - Windows Azure Linux VM 缓慢重启

python - 比较 Boost.Odeint 与 Scipy.integrate.odeint?

c++ - 你如何区分取消和重新触发的 boost deadline_timer

cmake add_library 在自定义位置

python - 导出 32 位枚举时 Boost Python 1.48 失败

multithreading - 使用 OpenMP 进行复杂线程处理

CMAKE - 如何正确地将静态库的头文件复制到/usr/include?