[CMake] -rdynamic causing problems for compiler checks

Magnus Therning magnus at therning.org
Tue Mar 19 05:44:28 EDT 2013


I'm using CMake (2.8.10.2) in an embedded project, which so far has
worked great.  However, now I'm trying out a newer version of the
compiler and I'm running into issues with '-rdynamic' when CMake
checks the compiler.  The issue I see is this:

~~~~
-- Check for working C compiler:
/opt/rt-tools/compilers/arm-eabi/bin/arm-eabi-gcc -- broken
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61
(message):
  The C compiler "/opt/rt-tools/compilers/arm-eabi/bin/arm-eabi-gcc" is not
  able to compile a simple test program.

  It fails with the following output:

   Change Dir: /home/semth/HBwork/floydi/floyd-build/floyd-ninja/CMakeFiles/CMakeTmp



  Run Build Command:/usr/bin/make "cmTryCompileExec1091315603/fast"

  /usr/bin/make -f CMakeFiles/cmTryCompileExec1091315603.dir/build.make
  CMakeFiles/cmTryCompileExec1091315603.dir/build

  make[1]: Entering directory
  `/home/semth/HBwork/floydi/floyd-build/floyd-ninja/CMakeFiles/CMakeTmp'

  /usr/bin/cmake -E cmake_progress_report
  /home/semth/HBwork/floydi/floyd-build/floyd-ninja/CMakeFiles/CMakeTmp/CMakeFiles
  1

  Building C object
  CMakeFiles/cmTryCompileExec1091315603.dir/testCCompiler.c.o

  /opt/rt-tools/compilers/arm-eabi/bin/arm-eabi-gcc -o
  CMakeFiles/cmTryCompileExec1091315603.dir/testCCompiler.c.o -c
  /home/semth/HBwork/floydi/floyd-build/floyd-ninja/CMakeFiles/CMakeTmp/testCCompiler.c


  Linking C executable cmTryCompileExec1091315603

  /usr/bin/cmake -E cmake_link_script
  CMakeFiles/cmTryCompileExec1091315603.dir/link.txt --verbose=1

  /opt/rt-tools/compilers/arm-eabi/bin/arm-eabi-gcc
  CMakeFiles/cmTryCompileExec1091315603.dir/testCCompiler.c.o -o
  cmTryCompileExec1091315603 -rdynamic

  arm-eabi-gcc: error: unrecognized option '-rdynamic'
~~~~

I have the following lines in my tool chain file:

~~~~
set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "" )
set( CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "" )
~~~~

which does remove the '-rdynamic' argument when compiling the
*project*, however they don't seem remove the flag on the *compiler
check*.  I found an old issue that seems related,
http://www.cmake.org/Bug/view.php?id=9985, it's been closed for years.

Is there some way to remove the flag on compiler checks, or is my only
option to disable compiler checks alltogether?

/M

-- 
Magnus Therning                      OpenPGP: 0xAB4DFBA4
email: magnus at therning.org   jabber: magnus at therning.org
twitter: magthe               http://therning.org/magnus


More information about the CMake mailing list