View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013855CMakeModulespublic2013-01-17 17:392013-06-03 09:05
ReporterAndres Gomez 
Assigned To 
PriorityhighSeveritymajorReproducibilityalways
StatusclosedResolutionno change required 
PlatformLinux x86_64OSUbuntuOS Version12.10
Product VersionCMake 2.8.9 
Target VersionFixed in Version 
Summary0013855: Cross compilation with MinGW fails on initial GCC compilation test because mingw doesn't support the -rdynamic linking flag
DescriptionWhen configuring a simple program with CMake support it fails because CMake is not able to find a C compiler capable of compiling a simple test program.

The error happens because, as we try to crosscompile, the C compiler program found is MinGW (/usr/bin/i686-w64-mingw32-gcc), which doesn't support the Linking "-rdynamic" flag.
Steps To Reproduce$ cmake .
debug trycompile on
-- The C compiler identification is GNU 4.6.3
-- Check for working C compiler: /usr/bin/i686-w64-mingw32-gcc
-- Check for working C compiler: /usr/bin/i686-w64-mingw32-gcc -- broken
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "/usr/bin/i686-w64-mingw32-gcc" is not able to compile a
  simple test program.

  It fails with the following output:

   Change Dir: /home/tanty/swftools-jhbuild.git/checkout.dbg/openjpeg-2.0.0/CMakeFiles/CMakeTmp



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

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

  make[1]: Entering directory
  `/home/tanty/swftools-jhbuild.git/checkout.dbg/openjpeg-2.0.0/CMakeFiles/CMakeTmp'


  /usr/bin/cmake -E cmake_progress_report
  /home/tanty/swftools-jhbuild.git/checkout.dbg/openjpeg-2.0.0/CMakeFiles/CMakeTmp/CMakeFiles
  1

  Building C object










  CMakeFiles/cmTryCompileExec4018385851.dir/testCCompiler.c.o

  /usr/bin/i686-w64-mingw32-gcc -mms-bitfields -march=i686
  -I/home/tanty/swftools-jhbuild.git/mingw-target.dbg//include -D_WIN32=1
  -D__USE_MINGW_ANSIO_STDIO=1 -DWIN32=1 -DOPJ_STATIC=1 -g -O0 -o
  CMakeFiles/cmTryCompileExec4018385851.dir/testCCompiler.c.o -c


  /home/tanty/swftools-jhbuild.git/checkout.dbg/openjpeg-2.0.0/CMakeFiles/CMakeTmp/testCCompiler.c


  Linking C executable cmTryCompileExec4018385851

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

  /usr/bin/i686-w64-mingw32-gcc -mms-bitfields -march=i686
  -I/home/tanty/swftools-jhbuild.git/mingw-target.dbg//include -D_WIN32=1
  -D__USE_MINGW_ANSIO_STDIO=1 -DWIN32=1 -DOPJ_STATIC=1 -g -O0
  -L/home/tanty/swftools-jhbuild.git/mingw-target.dbg/lib64
  -L/home/tanty/swftools-jhbuild.git/mingw-target.dbg//lib -static
  CMakeFiles/cmTryCompileExec4018385851.dir/testCCompiler.c.o -o
  cmTryCompileExec4018385851 -rdynamic

  i686-w64-mingw32-gcc: error: unrecognized option '-rdynamic'

  make[1]: *** [cmTryCompileExec4018385851] Error 1

  make[1]: Leaving directory
  `/home/tanty/swftools-jhbuild.git/checkout.dbg/openjpeg-2.0.0/CMakeFiles/CMakeTmp'


  make: *** [cmTryCompileExec4018385851/fast] Error 2





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


-- Configuring incomplete, errors occurred!
TagsNo tags attached.
Attached Filespatch file icon No--rdynamic-flag-for-MINGW.patch [^] (678 bytes) 2013-01-17 17:43 [Show Content]

 Relationships

  Notes
(0032115)
Andres Gomez (reporter)
2013-01-17 17:43

The problem seems to be the CMAKE_SHARED_LIBRARY_LINK_C_FLAGS macro which is set to "-rdynamic" in the Modules/Platform/Linux-GNU.cmake file.

This patch sets that linking flag conditionally to the presence of MINGW.
(0032120)
Brad King (manager)
2013-01-18 09:13

The problem is that Linux-GNU is getting loaded when cross-compiling for Windows. When cross compiling the toolchain file should set CMAKE_SYSTEM_NAME to Windows so that Linux platform information is not loaded.
(0032123)
Andres Gomez (reporter)
2013-01-18 12:25

You are right, the problem is not using the proper toolchain file as described in:
http://www.cmake.org/Wiki/CmakeMingw [^]

This report is invalid, although it is interesting that CMake is not that helpful to make the developer aware about the need of this toolchain file.
(0033188)
Robert Maynard (manager)
2013-06-03 09:05

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2013-01-17 17:39 Andres Gomez New Issue
2013-01-17 17:43 Andres Gomez Note Added: 0032115
2013-01-17 17:43 Andres Gomez File Added: No--rdynamic-flag-for-MINGW.patch
2013-01-18 09:13 Brad King Note Added: 0032120
2013-01-18 12:25 Andres Gomez Note Added: 0032123
2013-01-18 13:18 Brad King Status new => resolved
2013-01-18 13:18 Brad King Resolution open => no change required
2013-06-03 09:05 Robert Maynard Note Added: 0033188
2013-06-03 09:05 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team