使用 cmake 和 travis 提升 1.67 静态库

     2023-02-23     218

关键词:

【中文标题】使用 cmake 和 travis 提升 1.67 静态库【英文标题】:Boost 1.67 static library with cmake and travis 【发布时间】:2019-03-23 14:29:57 【问题描述】:

大家好。 我尝试使用 cmake 构建我的 c++ 项目并在 travis-ci 中提升 1.67。 以下是源文件。

在我的 linux 计算机上安装了源代码的 cmake 3.13.4 和源代码的 boost-1.67,所有库(静态和动态)都在目录“/usr/local/lib/”中,一切正常.但在 travis-ci 中,我每次都会看到这条消息:

Unable to find the requested Boost libraries.
  Boost version: 1.67.0
  Boost include path: /usr/include
  Could not find the following static Boost libraries:
          boost_program_options
  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.

yml 文件:

language: cpp
dist: xenial
sudo: false
os: linux


matrix:
  include:
    - env: COMPILER=g++-8 BUILD=Debug STANDARD=14
      compiler: gcc
      addons:
        apt:
          update: true
          sources:
            - sourceline: 'ppa:mhier/libboost-latest'
            - ubuntu-toolchain-r-test
          packages:
            - g++-8
            - boost1.67
    - env: COMPILER=g++-8 BUILD=Release STANDARD=14
      compiler: gcc
      addons:
        apt:
          update: true
          sources:
            - sourceline: 'ppa:mhier/libboost-latest'
            - ubuntu-toolchain-r-test
          packages:
            - g++-8
            - boost1.67

before_script:
  - wget https://cmake.org/files/v3.13/cmake-3.13.4-Linux-x86_64.sh
  - sudo sh cmake-3.13.4-Linux-x86_64.sh -- --skip-license --prefix=/usr

script:
  - cmake .
  - cmake --build .
  - cmake --build . --target package

制作:

cmake_minimum_required(VERSION 3.10)  
project(hcch VERSION 0.1.$VERSION_BUILD)

set(BOOST_ROOT /usr/include/boost/)

# For my linux
#set(BOOST_LIBRARYDIR /usr/local/lib)

# For travis-ci host
set(BOOST_LIBRARYDIR /usr/lib/x86_64-linux-gnu)

set(Boost_USE_STATIC_LIBS ON)
include_directories ($Boost_INCLUDE_DIRS)
link_directories ($Boost_LIBRARY_DIRS)

find_package(Boost 1.67 COMPONENTS program_options REQUIRED)
find_package(LLVM REQUIRED CONFIG)

configure_file (
        "$PROJECT_SOURCE_DIR/version.h.in"
        "$PROJECT_BINARY_DIR/version.h"
)

set(CMAKE_CXX_STANDARD 14)

add_executable(hcch hcch.cpp SourcesCreator.cpp SourcesCreator.h)

set_target_properties(hcch PROPERTIES
        CXX_STANDARD 14
        CXX_STANDARD_REQUIRED ON
        COMPILE_OPTIONS -Wpedantic -Wall -Wextra
        )

TARGET_LINK_LIBRARIES( hcch $BOOST_LIBRARYDIR/libboost_program_options.a )

也许静态库不是从 ppa:mhier/libboost-latest 安装的? 如果有人遇到,请告诉我如何解决。

这是我的项目https://github.com/angelskieglazki/hcch 问候,最大

【问题讨论】:

【参考方案1】:

我可以确认,从 ppa:mhier/libboost-latest 构建的 libboost 目前不构建静态库,仅共享。

如果您必须使用比 libboost-all-dev 提供的版本更高的 Boost 版本,那么您将需要从源代码编译 boost,尽管您将面临超时的风险。这方面的说明可以在Boost's best practice handbook 中找到。

【讨论】:

CMake 找不到提升。

...描述】:我不熟悉CMake。我正在尝试编译一个库GTSAM4.0。使用CMake。此处提供编译说明:https://bitbucket.org/gtborg/gtsam/src/c82fe1fde2fc988b6bde5e4798b66129bbb5da19/INSTALL?fileviewer=fil 查看详情

使用 Travis、AWS Elasticbeanstalk 和 Docker 构建失败

】使用Travis、AWSElasticbeanstalk和Docker构建失败【英文标题】:FailureinbuildusingTravis,AWSElasticbeanstalkandDocker【发布时间】:2020-10-1319:37:17【问题描述】:我在使用GitHub作为存储库构建我的React项目时遇到一个问题,Travis作为CI,AWSElastic... 查看详情

是否有使用 opencv 和 travis ci 的 c++ 示例项目?

】是否有使用opencv和travisci的c++示例项目?【英文标题】:Isthereanexampleprojectinc++thatusesopencvandtravisci?【发布时间】:2012-10-2414:58:57【问题描述】:我使用Github作为源代码控制工具,我想使用travis-ci插件进行CI。我没有找到任何这... 查看详情

在 CI (Travis/Jenkins) 环境中使用 xcodebuild (Xcode 8) 和自动签名

】在CI(Travis/Jenkins)环境中使用xcodebuild(Xcode8)和自动签名【英文标题】:Usexcodebuild(Xcode8)andautomaticsigninginCI(Travis/Jenkins)environments【发布时间】:2017-01-2220:40:41【问题描述】:随着Xcode8的发布,Apple引入了一种管理签名配置的新方法... 查看详情

cmake 在自定义位置或库存位置找不到提升

】cmake在自定义位置或库存位置找不到提升【英文标题】:cmakecannotfindboostinacustomlocationorstocklocation【发布时间】:2018-09-0818:24:59【问题描述】:这个问题是之前在SO上出现过的问题。比如这个问题:Cmakedoesn\'tfindBoost但是那里和其... 查看详情

如何在 Travis 中使用 Clickhouse

】如何在Travis中使用Clickhouse【英文标题】:HowtouseClickhousewithTravis【发布时间】:2020-07-3021:22:30【问题描述】:我想将travis添加到我的存储库,我使用clickhouse作为数据库,通常我可以添加postgresql和其他类似的,services:-postgresql所... 查看详情

Travis.ci 配置和执行 npm 脚本

...行yarninstall时安装了适当的模块,并且我正在安装与本地使用的相同版本的纱线。问题是当我尝试执行package.json脚本对象中定义的脚本时,在Travis中运 查看详情

CMake:找不到提升

】CMake:找不到提升【英文标题】:CMake:CouldNOTfindBoost【发布时间】:2014-09-1515:48:47【问题描述】:我正在尝试安装gtsam,但遇到了一些问题。我将boost安装到c:/programfiles/boost/boost_1_56_0并将以下内容添加到我的CMakeLists.text中:set(BO... 查看详情

Travis 和 React Native。 Parallels 为 Android 和 ios 构建

...avis很陌生。我有一个ReactNative应用程序。实际上,我正在使用Travis以顺序方式部署这两个平台。我想知道是否可以为ios和android并行构建以使 查看详情

本地构建工作正常时没有这样的文件或目录

...ine【发布时间】:2018-03-0422:08:50【问题描述】:在更改为CMake和TravisCI构建环境时,我在TravisCI上启用了编译。即使CMake项目在我的电脑上正确编译,Travis还是以2退出:Infileincludedfrom/home/travis/build/Codes 查看详情

travis.ci 上的 Android 构建变体

...发布时间】:2014-08-2519:36:28【问题描述】:我目前有一个使用gradle并与具有不同productFlavors和buildTypes的travis.ci集成的Android项目。然后在travis.ci上执行“connectedCheck”任务时,它会尝试打包所有构建变体(所有风格和类型的组合) 查看详情

Travis-CI 在我的项目中使用 xcodebuild 构建/链接问题

】Travis-CI在我的项目中使用xcodebuild构建/链接问题【英文标题】:Travis-CIbuild/linkissueusingxcodebuildonmyproject【发布时间】:2018-12-1317:35:23【问题描述】:问题/说明我正在尝试使用Travis-CIxcodebuild机制来构建/链接和测试我的一个GithubSw... 查看详情

CMake,JNI 提升读取 json 文件 - Android

】CMake,JNI提升读取json文件-Android【英文标题】:CMake,JNIboostreadjsonfile-Android【发布时间】:2021-12-0805:46:12【问题描述】:用boost::property_tree::json_parser::read_json打开文件的正确方法是什么当前树:boost::property_tree::ptreeconfig;boost::prope... 查看详情

使用 travis 的 pypi deploy 构建***

】使用travis的pypideploy构建***【英文标题】:Buildingwheelswithtravis\'pypideploy【发布时间】:2015-12-1118:45:05【问题描述】:我尝试了travis-cipypi部署,如下所示:https://travis-ci.org/Simplistix/testfixtures/jobs/80429422相关的.travis.yaml位是:deploy:p... 查看详情

我可以在 .travis.yml 中使用安全的 Travis 环境变量上传到 PyPI 吗?

】我可以在.travis.yml中使用安全的Travis环境变量上传到PyPI吗?【英文标题】:CanIusesecureTravisenvvariablesin.travis.ymltouploadtoPyPI?【发布时间】:2018-12-1819:49:38【问题描述】:我正在尝试让Travis使用以下配置上传到PyPIdeploy:provider:pypiuser... 查看详情

cmake的安装和使用

1、Cmake的安装下载https://cmake.org/download/我下载的是3.14.0,如下:安装加压下载文件到安装路径 添加环境变量:E: 查看详情

cmake安装和使用(代码片段)

...环境变量:D:cmake-3.9.0-win64-x64inLinuxsudoapt-getinstallcmakeCMake使用方 查看详情

使用 CMake 创建和使用库

】使用CMake创建和使用库【英文标题】:CreatingandusingalibrarywithCMake【发布时间】:2015-03-2723:32:38【问题描述】:我正在尝试学习CMake,但我无法掌握可用的教程。假设我的项目具有以下结构,并且我想通过其CMakeLists文件使my_lib可... 查看详情