[CMake] XCode generator hangs when writing build config.

Axel Roebel axel.roebel at ircam.fr
Wed Jan 4 12:36:28 EST 2012


On 4/1/12 5:05 PM, David Cole wrote:
> What project are you running through CMake? Is it available for us to
> try to reproduce here?

It is the SDIF/EASDIF_SDIF project that is on sourceforge.
http://sourceforge.net/projects/sdif/files/Easdif/

> I've not heard of anything like this...

Thanks for the feedback. So I took the cmake sources and compiled in
debug mode to see what is the problem. In my opinion there is a bug in

 cmGlobalXCodeGenerator::CreateBuildSettings

in function ExtractFlag(const char* flag, std::string& flags)

In my case I loop endlessly in

 std::string gflag = this->ExtractFlag("-g", flags);

while I have these flags

-DGCC_HAS_VISIBILITY -fvisibility=hidden -fstrict-aliasing
-maccumulate-outgoing-args     -DNDEBUG -DNDEBUG -funroll-loops -Wall
-Wno-switch -Wno-unused-function -finline-limit=5000 --param
large-function-insns=5000 --param large-function-growth=500 --param
inline-unit-growth=100 -fPIC

You see the -g is not there but something is found here

inline-unit-growth=100 -fPIC

and as the function is implemented
it does not handle this case correctly.

I suggest the following fix for the ExtractfFlag function
that ensures that a flag that is found will never be refound even
if it is nor removed (see FIX section below). The fix works for me.

std::string cmGlobalXCodeGenerator::ExtractFlag(const char* flag,
                                                std::string& flags)
{
  std::string retFlag;
  std::string::size_type pos = flags.rfind(flag);
  bool saved = false;

  while(pos != flags.npos)
    {
    if(pos == 0 || flags[pos-1]==' ')
      {
      while(pos < flags.size() && flags[pos] != ' ')
        {
        if(!saved)
          {
          retFlag += flags[pos];
          }
        flags[pos] = ' ';
        pos++;
        }
      }
    saved = true;
    // FIX IS HERE
    // original version
    // pos = flags.rfind(flag);
    // corrected version
    if(pos)
      pos = flags.rfind(flag, pos-1);
    else
      pos = flags.npos;
    // END OF FIX
    }
  return retFlag;
}

Cheers
Axel

> Can you use Activity Monitor to inspect the process and grab a sample
> showing a call stack of what's happening when it's "hung"?
> 
> Does CMake have any child processes that run during the configure of
> this project? (i.e. -- do you call execute_process with anything)
> 
> What else did you upgrade at the same time? :-)
> 
> 
> Thx,
> David
> 
> 
> 
> On Wed, Jan 4, 2012 at 10:08 AM, Axel Roebel <axel.roebel at ircam.fr> wrote:
>> Hello
>>
>> I just upgraded from 2.8.1 to 2.8.6 to be able to use the recently added
>> generator expressions in add_custom_command. Unfortunately, whenever I
>> try to generate a project for Xcode (Mac OSX 10.6.8, Xcode 3.2.6) the
>> project generator (command line as well as gui) hangs in the last phase
>> when it writes the project files. Is Xcode 3.2.6 no longer supported, or
>> does anybody have an idea what might be the problem?
>>
>> I used cmake that comes from macports repository, but after that failed
>> I tried version 2.8.7 from the cmake download page, but that gave the
>> same  result (None).
>>
>> Cheers
>> Axel
>>
>> --
>> Axel Roebel
>> Head of the Analysis/Synthesis Team, IRCAM
>> Phone: ++33-1-4478 4845 | Fax: ++33-1-4478 1540
>> --
>>
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
> 


-- 
Axel Roebel
Head of the Analysis/Synthesis Team, IRCAM
Phone: ++33-1-4478 4845 | Fax: ++33-1-4478 1540


More information about the CMake mailing list