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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,559,883
Community Members
 
Community Events
185
Community Groups

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
AUG Leaders

Atlassian Community Events