[cmake-developers] Weird build error against libc++ on OS X 10.7 (cutting at 1024 characters)

Ben Boeckel ben.boeckel at kitware.com
Tue Jun 24 15:09:16 EDT 2014


On Tue, Jun 24, 2014 at 14:21:37 -0400, Brad King wrote:
> On 06/24/2014 08:31 AM, Mojca Miklavec wrote:
> > /path/to/cmake-3.0.0/Bootstrap.cmk/cmake -E cmake_link_script
> > CMakeFiles/CMakeLib.dir/link.txt --verbose=1
> > 
> > isn't outputting the whole command, but cutting it in the middle instead.
> 
> The lines are read here:
> 
>  http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmcmd.cxx;hb=v3.0.0#l988
> 
> using the GetLineFromStream helper:
> 
>  http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/kwsys/SystemTools.cxx;hb=v3.0.0#l4157
> 
> Note the buffer size is 1024.  Something must go wrong with the
> stream state to make it look like EOL or EOF to this code.

The proper way to read lines from a file using iostream is:

    std::string line;
    while (std::getline(istr, line)) {
        // use line
    }

Unfortunately, it looks like there's unavoidable extra logic in there.
Maybe we could do:

    #ifdef BROKEN_STREAMS
    // crutch code
    #else
    // sanity
    #endif

--Ben



More information about the cmake-developers mailing list