View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014790CMakeCMakepublic2014-03-06 08:522014-10-06 10:32
ReporterJan Rüegg 
Assigned ToBrad King 
PrioritynormalSeveritycrashReproducibilityalways
StatusclosedResolutionfixed 
PlatformAppleOSMac OSXOS Version10.8
Product VersionCMake 2.8.12.2 
Target VersionFixed in VersionCMake 3.0 
Summary0014790: CMake crashes with XCode generator
DescriptionThe following commit makes cmake segfault on our project:

93fc5a53a... Xcode: Fix storyboard view

Version 2.8.12 (before this commit) works fine when running cmake.

Version 2.8.12.2 (after this commit) segfaults...
Steps To ReproduceUnfortunately I cannot reproduce it with a simple project, there everything works fine. Running it through gdb I get the following output:


-- Configuring done
-- Generating done
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000030
0x00007fff8a45da26 in std::string::c_str ()
(gdb) bt
#0 0x00007fff8a45da26 in std::string::c_str ()
#1 0x000000010036c7dc in cmXCodeObject::GetString ()
0000002 0x00000001003583ab in cmGlobalXCodeGenerator::CreateXCodeTargets ()
0000003 0x00000001003697da in cmGlobalXCodeGenerator::CreateXCodeObjects ()
0000004 0x0000000100354ae3 in cmGlobalXCodeGenerator::OutputXCodeProject ()
0000005 0x000000010035378f in cmGlobalXCodeGenerator::Generate ()
0000006 0x000000010032f305 in cmake::Generate ()
0000007 0x000000010032cd52 in cmake::Run ()
0000008 0x0000000100003c0d in do_cmake ()
#9 0x00000001000022e3 in main ()

So it looks to be really related to the commit, that changes something in cmGlobalXCodeGenerator.cxx
TagsNo tags attached.
Attached Files? file icon ios.toolchain.cmake [^] (8,650 bytes) 2014-03-10 03:26

 Relationships

  Notes
(0035324)
Jan Rüegg (reporter)
2014-03-06 08:53

One more note: As mentioned in the title, without the -GXcode it works fine...
(0035326)
Brad King (manager)
2014-03-06 10:45

Thanks for tracking it down to that specific commit.

Some additional refactoring of that code has occurred since 2.8.12.2. Please test with 3.0.0-rc1:

 http://www.cmake.org/files/v3.0/ [^]
(0035329)
Ben Boeckel (developer)
2014-03-06 13:28

FWIW, the dev/string-apis branch (which just landed in next) changes GetString to return a string and its setters to take strings as parameters. The callsites have not been updated to not use c_str() if needed, so if 3.0-rc1 still has issues, please try 'next' as well to see if the problem still exists there. Thanks.
(0035352)
Jan Rüegg (reporter)
2014-03-10 03:26

With version 3.0.0-rc1 as well as next I don't even get to that point, and receive the error message:

CMake Error in :
  The CMAKE_C_COMPILER:

    gcc

  is not a full path and was not found in the PATH.



CMake Error in :
  The CMAKE_CXX_COMPILER:

    g++

  is not a full path and was not found in the PATH.



-- Configuring incomplete, errors occurred!

I am using the attached ios toolchain file, by the way, with cmake command similar to:

cmake -GXcode -DCMAKE_TOOLCHAIN_FILE=path/to/ios.toolchain.cmake ..
(0035390)
Brad King (manager)
2014-03-12 10:27

Re 0014790:0035352: CMake 3.0 introduces a requirement that CMAKE_<LANG>_COMPILER always be located as a full path to the compiler tool. However, it looks like the conversion to a full path is not done for the Xcode generator when the compiler is forced by CMakeForceCompiler. I've fixed that here:

 CMakeDetermine*Compiler: Factor out search for compiler in PATH
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6852fb80 [^]

 Xcode: Convert forced CMAKE_<LANG>_COMPILER to full path if possible
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8c9bfac3 [^]

and it will be in 3.0.0-rc2. You can build the current 'release' branch from Git by hand or download a nightly binary of the bleeding edge of development:

 http://www.cmake.org/files/dev/?C=M;O=D [^]

Of course that will only work when the compiler really is in the PATH. Otherwise the call to CMAKE_FORCE_<LANG>_COMPILER in the toolchain file will have to specify a full path.

Currenlty your toolchain file contains:

 # Force the compilers to gcc for iOS
 include (CMakeForceCompiler)
 CMAKE_FORCE_C_COMPILER (gcc gcc)
 CMAKE_FORCE_CXX_COMPILER (g++ g++)

This is incorrect. The second argument is supposed to be the id of the compiler:

 http://www.cmake.org/cmake/help/v3.0/variable/CMAKE_LANG_COMPILER_ID.html [^]

Perhaps something like:

 # Force the compilers to gcc for iOS
 include (CMakeForceCompiler)
 CMAKE_FORCE_C_COMPILER (gcc GNU)
 CMAKE_FORCE_CXX_COMPILER (g++ GNU)

or use a full path explicitly:

 # Force the compilers to gcc for iOS
 include (CMakeForceCompiler)
 CMAKE_FORCE_C_COMPILER (/usr/bin/gcc GNU)
 CMAKE_FORCE_CXX_COMPILER (/usr/bin/g++ GNU)
(0035410)
Jan Rüegg (reporter)
2014-03-14 12:59

Yes, it seems to be fixed in the the master as well as the next branch...

Thanks a lot for the help, also regarding the toolchain file.
(0035411)
Brad King (manager)
2014-03-14 14:01

Great, thanks for reporting back.
(0036944)
Robert Maynard (manager)
2014-10-06 10:32

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

 Issue History
Date Modified Username Field Change
2014-03-06 08:52 Jan Rüegg New Issue
2014-03-06 08:53 Jan Rüegg Note Added: 0035324
2014-03-06 10:45 Brad King Note Added: 0035326
2014-03-06 13:28 Ben Boeckel Note Added: 0035329
2014-03-10 03:26 Jan Rüegg Note Added: 0035352
2014-03-10 03:26 Jan Rüegg File Added: ios.toolchain.cmake
2014-03-12 10:27 Brad King Note Added: 0035390
2014-03-14 12:59 Jan Rüegg Note Added: 0035410
2014-03-14 14:01 Brad King Note Added: 0035411
2014-03-14 14:01 Brad King Assigned To => Brad King
2014-03-14 14:01 Brad King Status new => resolved
2014-03-14 14:01 Brad King Resolution open => fixed
2014-03-14 14:01 Brad King Fixed in Version => CMake 3.0
2014-10-06 10:32 Robert Maynard Note Added: 0036944
2014-10-06 10:32 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team