Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I skip cmake compiler tests or avoid "error: unrecognized option '-rdynamic'"

compilation options for cmake (on windows) for ARM target system but when I run configure it's starting compiler tests:

CMake Error at D:/Program Files/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):   The C compiler "D:/Program Files/yagarto/bin/arm-none-eabi-gcc.exe" is not   able to compile a simple test program.    It fails with the following output:     Change Dir: D:/merge/complex/build/CMakeFiles/CMakeTmp      Run Build Command:D:/PROGRA~1/YAGART~1/bin/make.exe "cmTryCompileExec/fast"    D:/PROGRA~1/YAGART~1/bin/make.exe -f   CMakeFiles/cmTryCompileExec.dir/build.make   CMakeFiles/cmTryCompileExec.dir/build    make.exe[1]: Entering directory   `D:/merge/complex/build/CMakeFiles/CMakeTmp'    "D:/Program Files/CMake 2.8/bin/cmake.exe" -E cmake_progress_report   D:/merge/complex/build/CMakeFiles/CMakeTmp/CMakeFiles 1    Building C object CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o    "D:/Program Files/yagarto/bin/arm-none-eabi-gcc.exe" -o   CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o -c   D:/merge/complex/build/CMakeFiles/CMakeTmp/testCCompiler.c    Linking C executable cmTryCompileExec    "D:/Program Files/yagarto/bin/arm-none-eabi-gcc.exe"   "CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o" -o cmTryCompileExec   -rdynamic     arm-none-eabi-gcc.exe: error: unrecognized option '-rdynamic'    make.exe[1]: *** [cmTryCompileExec] Error 1 

Using Yagatdo 4.6.* cross-compilation toolchain

How can I skip this tests or fix -rdynamic error that I am getting?

like image 838
cnd Avatar asked May 15 '12 10:05

cnd


People also ask

Does CMake need compiler?

At a minimum, using CMake requires a C compiler, that compiler's native build tools, and a CMake executable. CMake was written in C++, requires only a C++ compiler to build, and precompiled binaries are available for most systems.

How does CMake detect compiler?

Inspecting the Default Compiler. When CMake is invoked to read a configuration file, temporary files are generated, including a cache and a CMakeFiles directory containing information specific to the environment. CMake uses this information to select the most appropriate compiler for the project.

Which compiler is used by CMake?

Compilers. CMake supports an extensive list of compilers, including: Apple Clang, Clang, GNU GCC, MSVC, Oracle Developer Studio, and Intel C++ Compiler.


2 Answers

You can set CMAKE_<LANG>_COMPILER_WORKS to true to suppress further compiler checks for that language.

set(CMAKE_C_COMPILER_WORKS 1) 
like image 68
adiog Avatar answered Sep 22 '22 10:09

adiog


You can skip the compiler checks by adding NONE to your project call:

project(<projectname> NONE) 

but this can have pretty far-reaching effects. For full details, run

cmake --help-command project 

I'm not familiar with ARM, so this is probably not your best option here. I guess you'd be better to see if there's a way to fix the -rdynamic flag.

EDIT:

It looks like this was identified as a bug which is effectively still unresolved. The comments in the bug report mention adding the following lines as a workaround (presumably before your project call):

set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") 
like image 38
Fraser Avatar answered Sep 24 '22 10:09

Fraser