I'm on a c++ project and i have to set-up the jenkins slave. My project have 3 different directory (building scripts, Mylibrary, MyApplication), every directory is a git repository.
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')
}
}
This is my pipeline, when i try to compile Myapplication in stage Build daemon, gcc fails:
Building application 'release/HOST/octogtwd', version == '0.0.1', build config == 'release' g++ -o release/HOST/octogtwd release/HOST/configuration_handler.opp release/HOST/gtw_logger.opp release/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: impossibile trovare -loctopus collect2: error: ld returned 1 exit status make: *** [Makefile:74: release/HOST/octogtwd] Error 1
I've created the symlink to the library in the jenkins directory:
liboctopus-0.1.0.a
liboctopus.so
liboctopus.so.0
liboctopus.so.0.1.0
The project compile on the HOST machine (relative path work). Not on jenkins.
In this case, you need to split your Job into 3 Jobs (building scripts, Mylibrary, MyApplication), and use the copy-artifact plugin to copy the artifact from one job to another. Example:
node {
// setup env..
// copy the deployment unit from another Job...
step ([$class: 'CopyArtifact',
projectName: 'webapp_build',
filter: 'target/orders.war']);
// deploy 'target/orders.war' to an app host
}
I found this link .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.