Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

cmake doesn't correctly run in a Bamboo script

Antonino Vespoli
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 20, 2020

I want to run an inline script that executes cmake command to generate the build files for my c/c++ unit tests. The Bamboo agent runs on a Windows 10 OS. I installed cygwin on the Agent's server to have cmake up and running. If I run cmake directly on prompt, on the Agent's server, everything works fine.
If I run the same command in my Bamboo script I get the following error:


I:\bamboo-agent-home\xml-data\build-dir\CIMX-XFU-JOB1>cmake . -Bbuild  
-- CMAKE_BINARY_DIR=/cygdrive/i/bamboo-agent-home/xml-data/build-dir/CIMX-XFU-JOB1/build
-- The C compiler identification is GNU 7.4.0
-- The CXX compiler identification is GNU 7.4.0
-- Check for working C compiler: /usr/bin/gcc.exe
-- Check for working C compiler: /usr/bin/gcc.exe -- broken
CMake Error at /usr/share/cmake-3.14.5/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler


  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /cygdrive/i/bamboo-agent-home/xml-data/build-dir/CIMX-XFU-JOB1/build/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/make.exe cmTC_7f576/fast
    /usr/bin/make -f CMakeFiles/cmTC_7f576.dir/build.make CMakeFiles/cmTC_7f576.dir/build
    make[1]: Entering directory '/cygdrive/i/bamboo-agent-home/xml-data/build-dir/CIMX-XFU-JOB1/build/CMakeFiles/CMakeTmp'
    Building C object CMakeFiles/cmTC_7f576.dir/testCCompiler.c.o
    /usr/bin/gcc.exe    -o CMakeFiles/cmTC_7f576.dir/testCCompiler.c.o   -c /cygdrive/i/bamboo-agent-home/xml-data/build-dir/CIMX-XFU-JOB1/build/CMakeFiles/CMakeTmp/testCCompiler.c
    C:/cygwin64/lib/gcc/x86_64-pc-cygwin/7.4.0/cc1.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory
    make[1]: *** [CMakeFiles/cmTC_7f576.dir/build.make:66: CMakeFiles/cmTC_7f576.dir/testCCompiler.c.o] Error 1
    make[1]: Leaving directory '/cygdrive/i/bamboo-agent-home/xml-data/build-dir/CIMX-XFU-JOB1/build/CMakeFiles/CMakeTmp'
    make: *** [Makefile:121: cmTC_7f576/fast] Error 2

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:34 (project)

-- Configuring incomplete, errors occurred!
See also "/cygdrive/i/bamboo-agent-home/xml-data/build-dir/CIMX-XFU-JOB1/build/CMakeFiles/CMakeOutput.log".
See also "/cygdrive/i/bamboo-agent-home/xml-data/build-dir/CIMX-XFU-JOB1/build/CMakeFiles/CMakeError.log".

CMake tries to compile a simple C application in order to test the gcc compiler, but it fails. I tried to compile the same application using gcc and it works. It seems there is a problem between cmake and Bamboo.

In the Bamboo script, I include the path to cygwin(C:\cygwin64\bin) into the environment variable PATH

Any idea on what can cause the issue?


1 answer

1 accepted

0 votes
Answer accepted
Antonino Vespoli
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 22, 2020

I found out the problem. Bamboo allows to overwrite environmental variables for a specific testing plan. I redefined PATH adding the path to the Cygwin executables, doing so, CMake can access all the libraries and the executables needed. CMake before generating the build files tests that the C compiler works running a small test application. CMake generates a Makefile that builds and executes this test application. For reasons I still don't understand, the Makefile doesn't have visibility of my redefinition of the environment variable PATH, but it reads Bamboo's original version of PATH. In order to solve the problem, I had to change Bamboo's environment variable PATH.

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events