我正在尝试构建几个月前上一次工作的CMake项目,但收到以下错误消息:

make[3]: *** No rule to make target `/usr/lib/libboost_unit_test_framework-mt.so', needed by `test/baumwelchtests'.  Stop.

实际上,此文件不存在于/usr/lib中,只有libboost_unit_test_framework.so。普通版和-mt版有什么区别?我很确定-mt版本是在最近的一次系统升级后删除的(我正在运行Debian Testing,因此在最新的稳定版本之后进行了很多更改)。我该如何编译我的东西?

我的CMakeLists.txt看起来像这样:
# Include subdirectories for headers
find_package( Boost REQUIRED COMPONENTS unit_test_framework regex)

include_directories(${BaumWelch_SOURCE_DIR}/../../grzesLib/src
                    ${BaumWelch_SOURCE_DIR}/src
                    ${Boost_INCLUDE_DIRS})

if(CMAKE_COMPILER_IS_GNUCXX)
    add_definitions(-g -std=c++11 -Wall -Werror -Wextra -pedantic -Wuninitialized)
endif()


# Create the unit tests executable
add_executable(
 baumwelchtests stockestimationtests.cpp forecasttest.cpp lagstest.cpp hiddenmarkovmodeltest.cpp stateindextest.cpp baumiterationtest.cpp baumwelchtest.cpp sampleparameters.cpp sdetest.cpp hmmgenerator.h
 # Key includes for setting up Boost.Test
 testrunner.cpp
 # Just for handy reference
 exampletests.cpp
)

# Link the libraries
target_link_libraries( baumwelchtests ${Boost_LIBRARIES} baumwelchlib grzeslib)

最佳答案

-mt代表多线程。

您可以通过设置set(Boost_USE_MULTITHREADED OFF)强制CMake与常规Boost库链接

但很可能您只需要安装libboost-test-dev

关于c++ - Debian测试中缺少 `/usr/lib/libboost_unit_test_framework-mt.so',我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/18853777/

10-12 18:31