[CMake] XCode generator hangs when writing build config.

David Cole david.cole at kitware.com
Wed Jan 4 19:56:54 EST 2012


On Wed, Jan 4, 2012 at 1:14 PM, David Cole <david.cole at kitware.com> wrote:
> On Wed, Jan 4, 2012 at 12:36 PM, Axel Roebel <axel.roebel at ircam.fr> wrote:
>> 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
>
> Wow. Nice, quick work.
>
> Thanks for the patch. I'll get it applied and pushed to our 'next'
> branch so this can get into the next release...
>
>
> Thanks,
> David

Hmmm. I've downloaded the source from SourceForge, but do not
reproduce the problem here simply by running cmake to
configure/generate. You must be setting the flags explicitly somehow?
(By hand, or with a script?)

Can you tell me exactly how to reproduce the problem so that I can
verify the fix works?

The ExtractFlags method was modified in this commit to remove
conflicting -g flags when multiple -g flags occur...

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cb22afc0

It's relatively recent and first appeared in 2.8.6 -- I want to make
sure that whatever fix goes in now also honors the intent of that
commit, which fixed http://public.kitware.com/Bug/view.php?id=12377


Thanks,
David


More information about the CMake mailing list