Jenkins C ++构建链

时间:2019-01-17 16:41:24

标签: c++ jenkins gcc

我在一个c ++项目上,我必须设置jenkins slave。我的项目有3个不同的目录(构建脚本,Mylibrary,MyApplication),每个目录都是一个git存储库。

node {
stage ('Checkout'){
checkout([$class: 'GitSCM', 
    branches: [[name: '*/devel_dimant']], 
    doGenerateSubmoduleConfigurations: false, 
    extensions: [[$class: 'RelativeTargetDirectory', 
        relativeTargetDir: 'build_scripts']], 
    submoduleCfg: [], 
    userRemoteConfigs: [[url: 'file:///home/antonio/Projects/Azalea/rc_octo_cmn_build']]
    ])
checkout([$class: 'GitSCM', 
    branches: [[name: '*/devel_dimant']], 
    doGenerateSubmoduleConfigurations: false, 
    extensions: [[$class: 'RelativeTargetDirectory', 
        relativeTargetDir: 'liboctopus']], 
    submoduleCfg: [], 
    userRemoteConfigs: [[url: 'file:///home/antonio/Projects/Azalea/rc_octo_cmn_core']]
    ])
checkout([$class: 'GitSCM', 
    branches: [[name: '*/devel_dimant']], 
    doGenerateSubmoduleConfigurations: false, 
    extensions: [[$class: 'RelativeTargetDirectory', 
        relativeTargetDir: 'gateway_daemon']], 
    submoduleCfg: [], 
    userRemoteConfigs: [[url: 'file:///home/antonio/Projects/Azalea/rc_gtw_octogtwd']]
    ])    
}
stage ('Build liboctopus'){
    dir("liboctopus"){
        sh ('./../build_scripts/octo_build.sh')

    }
    dir('liboctopus/release/HOST'){
        sh('ls')
    }
}
stage ('Build gateway_daemon'){
    dir("gateway_daemon"){
        sh ('./../build_scripts/octo_build.sh')
    }
}    

这是我的管道,当我尝试在Build守护程序阶段编译Myapplication时,gcc失败:

  
    

正在构建应用程序'release / HOST / octogtwd',版本=='0.0.1',构建配置=='release'     g ++ -o发行版/ HOST / octogtwd发行版/HOST/configuration_handler.opp发行版/HOST/gtw_logger.opp发行版/HOST/main.opp -Wl,-rpath = / opt / OctopusIoT / lib -pthread -rdynamic -Wl,-pie -L ../ liboctopus / release / HOST -lrt -lpthread -lsystemd -loctopus -ljson-c     / usr / bin / ld:不可能的trovare -loctopus     collect2:错误:ld返回1退出状态     make:*** [Makefile:74:release / HOST / octogtwd]错误1

  

我已经在jenkins目录中创建了指向该库的符号链接:

liboctopus-0.1.0.a
liboctopus.so
liboctopus.so.0
liboctopus.so.0.1.0

项目在HOST机器上编译(相对路径工作)。不在詹金斯身上。

1 个答案:

答案 0 :(得分:0)

在这种情况下,您需要将Job分成3个Job(构建脚本,Mylibrary,MyApplication),然后使用copy-artifact plugin将工件从一个作业复制到另一个作业。 示例:

js := "some text to simply show one way I've tried" + encodedjs.ReadEncodedJS()

我找到了这个link