【问题标题】:Use boost libraries in appveyor在 appveyor 中使用 boost 库
【发布时间】:2018-06-25 14:03:34
【问题描述】:

我正在为 appveyor 编写脚本。 我需要在我的 c++ 项目中使用 boost 库。 在我的 appveyor 脚本中,我写了以下几行:

set INCLUDE=C:\Libraries\boost_1_67_0;%INCLUDE%


cd C:\Libraries\boost_1_67_0
dir
.\bootstrap.bat
.\b2 --with-iostreams runtime-link=static --build-type=complete

set LIB=C:\Libraries\boost_1_67_0\stage\lib;%LIB%

但这会在.\bootstrap.bat 上给出错误

.\bootstrap.bat
Building Boost.Build engine
Failed to build Boost.Build engine.
Please consult bootstrap.log for further diagnostics.
Command exited with code 1

你可以在https://ci.appveyor.com/project/srbcheema1/vcf-demo/build/1.0.32找到appveyor的日志

我的 CMakeLists.txt 是这样的:

cmake_minimum_required (VERSION 2.8.9)
project (reader-demo CXX C)
set (CMAKE_BUILD_TYPE  "Release" CACHE STRING "Choose the type of build" FORCE)
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set(Boost_USE_STATIC_LIBS ON)
add_executable(reader uncompress.cpp)

如何在 appveyor 中使用 boost 库?

【问题讨论】:

    标签: boost appveyor


    【解决方案1】:

    无需手动安装最新版本的 boost。它是already there 并已预编译。只需确保将正确的路径传递给构建配置,以使用 boost 标头和适当的链接器标志。对于 cmake 构建,这将是

    cmake -DBOOST_ROOT=C:\Libraries\boost_1_67_0 path\to\your\source
    

    【讨论】:

    • @libgr 但我无法从那里构建它ci.appveyor.com/project/srbcheema2/win-demo
    • 不需要构建它。它是预编译的。我也更新了答案。
    • @libgr 似乎它们没有预编译。因为我在那里找不到目录C:\Libraries\boost_1_67_0\stage\lib。如果它们是预编译的,请告诉我libboost_iostreams-vc141-mt-s-x32-1_67.lib 文件的位置。你可以在ci.appveyor.com/project/srbcheema2/win-demo/build/1.0.11看到错误
    • 感谢@libgr 我得到了那些库。它们位于lib32-msvc-14.1 目录而不是stage\lib
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-10-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-08
    相关资源
    最近更新 更多