2014-09-25 14:48 GMT+04:00 David Coppa <dco...@openbsd.org>:
>
> Hi all,
>
> An update on the "infamous" cmake segfault:
>
> ---8<---
>
> Core was generated by `cmake'.
> Program terminated with signal 11, Segmentation fault.
>
> #0  0x0000032f500b0484 in strlen (str=0x32ec339fff8 "????????" <Address 
> 0x32ec33a0000 out of bounds>) at /usr/src/lib/libc/string/strlen.c:39
> 39              for (s = str; *s; ++s)
> (gdb) bt
> #0  0x0000032f500b0484 in strlen (str=0x32ec339fff8 "????????" <Address 
> 0x32ec33a0000 out of bounds>) at /usr/src/lib/libc/string/strlen.c:39
> #1  0x0000032e6d7c1920 in basic_string (this=0x7f7fffff6768, 
> __s=0x32ec339fff8 "????????" <Address 0x32ec33a0000 out of bounds>, 
> __a=@0x7f7fffff6777)
>     at char_traits.h:258
> #2  0x0000032c600e8a23 in cmTarget::GetLinkClosure (this=0x32f5500e028, 
> config=0x32ec339fff8 "????????" <Address 0x32ec33a0000 out of bounds>,
>     head=0x32f5500e028) at 
> /usr/ports/pobj/cmake-3.0.2/cmake-3.0.2/Source/cmTarget.cxx:2972
> #3  0x0000032c601e91ba in cmComputeLinkInformation::GetRPath 
> (this=0x32e9b3e4800, runtimeDirs=@0x7f7fffff6ab0, for_install=false)
>     at 
> /usr/ports/pobj/cmake-3.0.2/cmake-3.0.2/Source/cmComputeLinkInformation.cxx:1982
> #4  0x0000032c60063e47 in cmLocalGenerator::OutputLinkLibraries 
> (this=0x32eef94c000, linkLibraries=@0x32ef9052a28, 
> frameworkPath=@0x7f7fffff7398,
>     linkPath=@0x7f7fffff7390, tgt=@0x32e7da6f600, relink=false) at 
> /usr/ports/pobj/cmake-3.0.2/cmake-3.0.2/Source/cmLocalGenerator.cxx:1879
> #5  0x0000032c6006130e in cmLocalGenerator::GetTargetFlags 
> (this=0x32eef94c000, linkLibs=@0x32ef9052a28, flags=@0x32f044e6128, 
> linkFlags=@0x32f08c61c68,
>     frameworkPath=@0x7f7fffff7398, linkPath=@0x7f7fffff7390, 
> target=0x32e7da6f600)
>     at 
> /usr/ports/pobj/cmake-3.0.2/cmake-3.0.2/Source/cmLocalGenerator.cxx:1697
> #6  0x0000032c60148610 in cmNinjaNormalTargetGenerator::WriteLinkStatement 
> (this=0x32e69a52600)
>     at 
> /usr/ports/pobj/cmake-3.0.2/cmake-3.0.2/Source/cmNinjaNormalTargetGenerator.cxx:468
> #7  0x0000032c6014cf01 in cmNinjaNormalTargetGenerator::Generate 
> (this=0x32e69a52600)
>     at 
> /usr/ports/pobj/cmake-3.0.2/cmake-3.0.2/Source/cmNinjaNormalTargetGenerator.cxx:96
> #8  0x0000032c6013d78f in cmLocalNinjaGenerator::Generate (this=0x32eef94c000)
>     at 
> /usr/ports/pobj/cmake-3.0.2/cmake-3.0.2/Source/cmLocalNinjaGenerator.cxx:81
> #9  0x0000032c60253c8a in cmGlobalGenerator::Generate (this=0x32f2f2e9000) at 
> /usr/ports/pobj/cmake-3.0.2/cmake-3.0.2/Source/cmGlobalGenerator.cxx:1243
> #10 0x0000032c601375d3 in cmGlobalNinjaGenerator::Generate 
> (this=0x32f2f2e9000)
>     at 
> /usr/ports/pobj/cmake-3.0.2/cmake-3.0.2/Source/cmGlobalNinjaGenerator.cxx:515
> #11 0x0000032c60117983 in cmake::Generate (this=0x7f7fffff7950) at 
> /usr/ports/pobj/cmake-3.0.2/cmake-3.0.2/Source/cmake.cxx:1715
> #12 0x0000032c60120f4e in cmake::Run (this=0x7f7fffff7950, 
> args=@0x7f7fffff7e10, noconfigure=false)
>     at /usr/ports/pobj/cmake-3.0.2/cmake-3.0.2/Source/cmake.cxx:1695
> #13 0x0000032c600258e1 in do_cmake (ac=29, av=0x32f15b51100) at 
> /usr/ports/pobj/cmake-3.0.2/cmake-3.0.2/Source/cmakemain.cxx:317
> #14 0x0000032c600261a9 in main (ac=29, av=0x32f15b51100) at 
> /usr/ports/pobj/cmake-3.0.2/cmake-3.0.2/Source/cmakemain.cxx:183
>
> ---8<---
>
> Good news first: this bug has already been fixed upstream.
>
> Bad news: the fix is not trivial. They went through a major overhaul[1]
> of the string api. Backporting this work using local patches would
> be a PITA.
>
> [1] 
> http://www.cmake.org/gitweb?p=cmake.git&a=search&h=HEAD&st=commit&s=stringapi
>
> Here're some additional infos with the help of my silly std::cout
> debugging...
>
> "config" should contain the value of CMAKE_BUILD_TYPE, i.e. it can
> be empty or "Debug", "Release", "RelWithDebInfo", "MinSizeRel".
>
> With cmake-3.0.x, you can see it's filled with all sort of garbage:
>
> $ grep ^DEBUGGING *.log | grep -vi \=\=\release | grep -v config\ \=\=\$
> kdelibs-4.13.3.log:DEBUGGING config ==:
> kdelibs-4.13.3.log:DEBUGGING config ==:
> kdelibs-4.13.3.log:DEBUGGING config ==:
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==:
> kdelibs-4.13.3.log:DEBUGGING config ==:
> kdelibs-4.13.3.log:DEBUGGING config ==:
> kdelibs-4.13.3.log:DEBUGGING config ==:
> kdelibs-4.13.3.log:DEBUGGING config ==.a
> kdelibs-4.13.3.log:DEBUGGING config ==.a
> kdelibs-4.13.3.log:DEBUGGING config ==.a
> kdelibs-4.13.3.log:DEBUGGING config ==.a
> kdelibs-4.13.3.log:DEBUGGING config ==.a
> kdelibs-4.13.3.log:DEBUGGING config ==.a
> kdelibs-4.13.3.log:DEBUGGING config ==.a
> kdelibs-4.13.3.log:DEBUGGING config ==/lib
> kdelibs-4.13.3.log:DEBUGGING config ==/lib
> kdelibs-4.13.3.log:DEBUGGING config ==/lib
> kdelibs-4.13.3.log:DEBUGGING config ==/lib
> kdelibs-4.13.3.log:DEBUGGING config ==/lib
> kdelibs-4.13.3.log:DEBUGGING config ==/lib
> kdelibs-4.13.3.log:DEBUGGING config ==/lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==????????
> kdelibs-4.13.3.log:DEBUGGING config ==????????
> kdelibs-4.13.3.log:DEBUGGING config ==????????
> kdelibs-4.13.3.log:DEBUGGING config ==????????
> kdelibs-4.13.3.log:DEBUGGING config ==????????
> kdelibs-4.13.3.log:DEBUGGING config ==????????
> kdelibs-4.13.3.log:DEBUGGING config ==????????
> kdelibs-4.13.3.log:DEBUGGING config ==.a
> kdelibs-4.13.3.log:DEBUGGING config ==.a
> kdelibs-4.13.3.log:DEBUGGING config ==.a
> kdelibs-4.13.3.log:DEBUGGING config ==.a
> kdelibs-4.13.3.log:DEBUGGING config ==.a
> kdelibs-4.13.3.log:DEBUGGING config ==.a
> kdelibs-4.13.3.log:DEBUGGING config ==.a
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==.a
> kdelibs-4.13.3.log:DEBUGGING config ==.a
> kdelibs-4.13.3.log:DEBUGGING config ==.a
> kdelibs-4.13.3.log:DEBUGGING config ==.a
> kdelibs-4.13.3.log:DEBUGGING config ==.a
> kdelibs-4.13.3.log:DEBUGGING config ==.a
> kdelibs-4.13.3.log:DEBUGGING config ==.a
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==.so
> kdelibs-4.13.3.log:DEBUGGING config ==.so
> kdelibs-4.13.3.log:DEBUGGING config ==.so
> kdelibs-4.13.3.log:DEBUGGING config ==.so
> kdelibs-4.13.3.log:DEBUGGING config ==.so
> kdelibs-4.13.3.log:DEBUGGING config ==.so
> kdelibs-4.13.3.log:DEBUGGING config ==.so
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==lib
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==CXX
> kdelibs-4.13.3.log:DEBUGGING config ==-l
> kdelibs-4.13.3.log:DEBUGGING config ==-l
> kdelibs-4.13.3.log:DEBUGGING config ==-l
> kdelibs-4.13.3.log:DEBUGGING config ==-l
> kdelibs-4.13.3.log:DEBUGGING config ==-l
> kdelibs-4.13.3.log:DEBUGGING config ==-l
> kdelibs-4.13.3.log:DEBUGGING config ==-l
> kdelibs-4.13.3.log:DEBUGGING config ==.so
> kdelibs-4.13.3.log:DEBUGGING config ==.so
> kdelibs-4.13.3.log:DEBUGGING config ==.so
> kdelibs-4.13.3.log:DEBUGGING config ==.so
> kdelibs-4.13.3.log:DEBUGGING config ==.so
> kdelibs-4.13.3.log:DEBUGGING config ==.so
> kdelibs-4.13.3.log:DEBUGGING config ==.so
> kdelibs-4.13.3.log:DEBUGGING config ==estdc++
> kdelibs-4.13.3.log:DEBUGGING config ==estdc++
> kdelibs-4.13.3.log:DEBUGGING config ==estdc++
> kdelibs-4.13.3.log:DEBUGGING config ==/lib32
> kdelibs-4.13.3.log:DEBUGGING config ==/lib32
> kdelibs-4.13.3.log:DEBUGGING config ==/lib32
> kdelibs-4.13.3.log:DEBUGGING config ==c
> kdelibs-4.13.3.log:DEBUGGING config ==c
> kdelibs-4.13.3.log:DEBUGGING config ==c
> kdelibs-4.13.3.log:DEBUGGING config ==.so
> kdelibs-4.13.3.log:DEBUGGING config ==.so
> kdelibs-4.13.3.log:DEBUGGING config ==.so
>
> Newer CMake does it right:
>
> $ grep ^DEBUGGING *.log | grep -vi \=\=\release | grep -v config\ \=\=\$
> $
>
> And, indeed, it survived w/o segfaults to:
>
> $ for i in `jot 200` ; do make clean configure 2>&1 | 
> /usr/ports/infrastructure/bin/portslogger /usr/ports/x11/kde4/libs/log${i} ; 
> done
>
> CMake 3.1 (the one with the improved string handling) is scheduled
> for release on 2014-11-01.
>
> Are you ok with just waiting?

Yes, I am ok to wait. Not sure about people doing bulk builds, though;
I can easily suppose they already hate CMake more than autocrap now...

Can we try CMake 3.1 beta as of now? Given that most CMake development
nowadays, as I can see, happen in Windows and cross-platform lands,
there should not be more regression than win we'll gain by stable
builds.

> Or should I ask upstream for possible workarounds that can be easily
> applied to cmake-3.0.x?

Will we lose something in case of asking rather than not doing so? :)

> Btw, I think I'm going to write a report on CMake's MantisBT, to
> let them know...

Feel free to add me to CC list there, too. ;) And thank you a lot for
taking care.

Reply via email to