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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

cmake doesn't correctly run in a Bamboo script

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

    "/usr/bin/gcc.exe"

  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

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
TAGS
Community showcase
Published in Bamboo

Bamboo 7.2 is here!

I'm happy to announce that Bamboo 7.2 has been released and it’s overflowing with awesome new features. This will be the last major Server release before the launch of Bamboo DC. Bamboo logs We...

481 views 5 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you