cmake's ctest throws std::length_error during png build, blocking building (powerpc64, 10.1-STABLE)

Mark Millard markmi at dsl-only.net
Fri Jan 30 07:16:28 UTC 2015


Later below I give how I found the issue. But first I show a short way to reproduce the problem without building a port that uses ctest:

root at FBSDG5M1:/usr/home/markmi # ctest --version
terminate called after throwing an instance of 'std::length_error'
  what():  vector::reserve
Abort (core dumped)


Context basics for the ctest crash:

root at FBSDG5M1:/usr/home/markmi # freebsd-version -ku; uname -a
10.1-RELEASE-p4
10.1-STABLE
FreeBSD FBSDG5M1 10.1-RELEASE-p4 FreeBSD 10.1-RELEASE-p4 #1 r277195M: Mon Jan 26 23:32:28 PST 2015     root at FBSDG5M1:/usr/obj/usr/home/markmi/src_10_1_releng/sys/GENERIC64vtsc  powerpc

The 10.1-STABLE world build is from -r277483 .

/usr/ports/ "Last Changed Rev" was -r378052 (so recent).

root at FBSDG5M1:/usr/home/markmi # more /etc/make.conf
WRKDIRPREFIX=/usr/obj/portswork
WITH_DEBUG=
MALLOC_PRODUCTION=
root at FBSDG5M1:/usr/home/markmi # more /etc/src.conf
#WITH_DEBUG_FILES=
#WITHOUT_CLANG=

root at FBSDG5M1:/usr/home/markmi # cmake --version
cmake version 3.1.1



Problem:

Later below I give how I found the issue. But first I show a short way to reproduce the problem without building a port that uses ctest:

root at FBSDG5M1:/usr/home/markmi # ctest --version
terminate called after throwing an instance of 'std::length_error'
  what():  vector::reserve
Abort (core dumped)



From the portmaster -r png I got the following failure, which turns out to be in cmake's ctest:

root at FBSDG5M1:/usr/home/markmi # portmaster -r --no-confirm png
...
[100%] Building C object CMakeFiles/pngstest.dir/contrib/libtests/pngstest.o
Linking C executable pngtest
[100%] Built target pngtest
Linking C executable pngstest
[100%] Built target pngstest
Linking C executable pngvalid
[100%] Built target pngvalid
...
Running tests...
terminate called after throwing an instance of 'std::length_error'
  what():  vector::reserve
Abort trap (core dumped)
*** [test] Error code 134
...

Below is the traceback. It shows a huge vector::reserve size (#8...::reserve (this=0xffffffffffffae08, __n=5497010905810357313) at vector.tcc:72).

root at FBSDG5M1:/var/crash # gdb `which ctest` ctest.5708.core
...
(gdb) bt
#0  0x0000000050d19168 in .__sys_thr_kill () from /lib/libc.so.7
#1  0x0000000050d1907c in .__raise () from /lib/libc.so.7
#2  0x0000000050d17658 in .abort () from /lib/libc.so.7
#3  0x00000000514cbae0 in ._ZN9__gnu_cxx27__verbose_terminate_handlerEv () from /usr/lib/libsupc++.so.1
#4  0x00000000514d11d8 in ._ZSt14set_unexpectedPFvvE () from /usr/lib/libsupc++.so.1
#5  0x00000000514d1230 in ._ZSt9terminatev () from /usr/lib/libsupc++.so.1
#6  0x00000000514d10dc in .__cxa_throw () from /usr/lib/libsupc++.so.1
#7  0x0000000050ab6e54 in ._ZSt20__throw_length_errorPKc () from /usr/lib/libstdc++.so.6
#8  0x0000000010246528 in std::vector<cmsys::_Hashtable_node<std::pair<std::string const, cmDefinitions::Def> >*, std::allocator<cmsys::_Hashtable_node<std::pair<std::string const, cmDefinitions::Def> >*> >::reserve (this=0xffffffffffffae08, 
    __n=5497010905810357313) at vector.tcc:72
#9  0x0000000010474710 in cmsys::hashtable<std::pair<std::string const, cmDefinitions::Def>, std::string, cmsys::hash<std::string>, cmsys::hash_select1st<std::string const, cmDefinitions::Def>, std::equal_to<std::string>, std::allocator<char> >::_M_initialize_buckets (this=0xffffffffffffae00, __n=100) at hashtable.hxx:797
#10 0x0000000010474838 in hashtable (this=0xffffffffffffae00, __n=100, __hf=@0xffffffffffffabb2, __eql=@0xffffffffffffabb1, 
    __a=@0xffffffffffffabb0) at hashtable.hxx:545
#11 0x000000001047490c in hash_map (this=0xffffffffffffae00) at hash_map.hxx:113
#12 0x00000000104728f8 in cmDefinitions (this=0xffffffffffffadf8, parent=0x0)
    at /usr/obj/portswork/usr/ports/devel/cmake/work/cmake-3.1.1/Source/cmDefinitions.cxx:19
#13 0x000000001020dbcc in cmMakefile (this=0x51cb1800)
    at /usr/obj/portswork/usr/ports/devel/cmake/work/cmake-3.1.1/Source/cmMakefile.cxx:56
#14 0x00000000101efa98 in cmLocalGenerator::SetGlobalGenerator (this=0x51c3f480, gg=0xffffffffffffbe38)
    at /usr/obj/portswork/usr/ports/devel/cmake/work/cmake-3.1.1/Source/cmLocalGenerator.cxx:244
#15 0x00000000101874b0 in cmGlobalGenerator::CreateLocalGenerator (this=0xffffffffffffbe38)
    at /usr/obj/portswork/usr/ports/devel/cmake/work/cmake-3.1.1/Source/cmGlobalGenerator.cxx:1906
#16 0x00000000100224dc in cmCTest::Initialize (this=0xffffffffffffcc50, 
    binary_dir=0x51c890f8 "/usr/obj/portswork/usr/ports/graphics/png/work/libpng-1.6.16", command=0x0)
    at /usr/obj/portswork/usr/ports/devel/cmake/work/cmake-3.1.1/Source/cmCTest.cxx:511
#17 0x000000001002c704 in cmCTest::Run (this=0xffffffffffffcc50, args=@0xffffffffffffc880, output=0xffffffffffffc898)
    at /usr/obj/portswork/usr/ports/devel/cmake/work/cmake-3.1.1/Source/cmCTest.cxx:2474
#18 0x0000000010010c10 in main (argc=2, argv=0x51c1a040)
    at /usr/obj/portswork/usr/ports/devel/cmake/work/cmake-3.1.1/Source/ctest.cxx:192
#19 0x000000001000fc8c in ._start ()
#20 0x000000005074c770 in .text () from /libexec/ld-elf.so.1




More context:

$ freebsd-version -ku; uname -a
10.1-RELEASE-p4
10.1-STABLE
FreeBSD FBSDG5M1 10.1-RELEASE-p4 FreeBSD 10.1-RELEASE-p4 #1 r277195M: Mon Jan 26 23:32:28 PST 2015     root at FBSDG5M1:/usr/obj/usr/home/markmi/src_10_1_releng/sys/GENERIC64vtsc  powerpc

For the buildworld context:

$ svnlite info /usr/src
Path: /usr/src
Working Copy Root Path: /usr/src
URL: https://svn0.us-west.freebsd.org/base/stable/10
Relative URL: ^/stable/10
Repository Root: https://svn0.us-west.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 277483
Node Kind: directory
Schedule: normal
Last Changed Author: smh
Last Changed Rev: 277483
Last Changed Date: 2015-01-21 01:45:48 -0800 (Wed, 21 Jan 2015)

For the ports:

$ svnlite info /usr/ports
Path: /usr/ports
Working Copy Root Path: /usr/ports
URL: https://svn0.us-west.freebsd.org/ports/head
Relative URL: ^/head
Repository Root: https://svn0.us-west.freebsd.org/ports
Repository UUID: 35697150-7ecd-e111-bb59-0022644237b5
Revision: 378053
Node Kind: directory
Schedule: normal
Last Changed Author: danilo
Last Changed Rev: 378052
Last Changed Date: 2015-01-28 01:33:23 -0800 (Wed, 28 Jan 2015)

For the kernel context (not so relevant here but for completeness):

$ svnlite info ~markmi/src_10_1_releng/
Path: /home/markmi/src_10_1_releng
Working Copy Root Path: /home/markmi/src_10_1_releng
URL: https://svn0.us-west.freebsd.org/base/releng/10.1
Relative URL: ^/releng/10.1
Repository Root: https://svn0.us-west.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 277195
Node Kind: directory
Schedule: normal
Last Changed Author: delphij
Last Changed Rev: 277195
Last Changed Date: 2015-01-14 13:27:46 -0800 (Wed, 14 Jan 2015)

$ svnlite status ~markmi/src_10_1_releng/
M       /home/markmi/src_10_1_releng/sys/ddb/db_main.c
M       /home/markmi/src_10_1_releng/sys/ddb/db_script.c
M       /home/markmi/src_10_1_releng/sys/powerpc/ofw/ofw_machdep.c
M       /home/markmi/src_10_1_releng/sys/powerpc/ofw/ofwcall64.S
M       /home/markmi/src_10_1_releng/sys/powerpc/powermac/powermac_thermal.c

===
Mark Millard
markmi at dsl-only.net



More information about the freebsd-ports mailing list