From owner-freebsd-ports@FreeBSD.ORG Mon Oct 7 13:42:47 2013 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id CFCD5B4C for ; Mon, 7 Oct 2013 13:42:47 +0000 (UTC) (envelope-from FreeBSD@shaneware.biz) Received: from ipmail06.adl2.internode.on.net (ipmail06.adl2.internode.on.net [IPv6:2001:44b8:8060:ff02:300:1:2:6]) by mx1.freebsd.org (Postfix) with ESMTP id 643132497 for ; Mon, 7 Oct 2013 13:42:47 +0000 (UTC) Received: from ppp118-210-127-6.lns20.adl2.internode.on.net (HELO leader.local) ([118.210.127.6]) by ipmail06.adl2.internode.on.net with ESMTP; 08 Oct 2013 00:12:46 +1030 Message-ID: <5252BA55.5070806@ShaneWare.Biz> Date: Tue, 08 Oct 2013 00:12:45 +1030 From: Shane Ambler User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130516 Thunderbird/17.0.6 MIME-Version: 1.0 To: FreeBSD-ports Subject: Need some help debugging c++ code for 10.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2013 13:42:48 -0000 Hi there, I am the port maintainer for opencolorio, openimageio and openshadinglanguage. These build and run on 9.2 with clang 3.3 but I have an issue on 10.0. I don't have much programming experience and even less with c++ which all 3 use. After ocio and oiio are installed building osl generates oslc (the osl script compiler) and then runs it to pre-compile the included scripts. This step fails on 10.0 I am fairly sure that the issue is within the ustring class - full code can be viewed at github.com/OpenImageIO/oiio with src/include/ustring.h having some info about the class. The following is from src/libutil/ustring.cpp for ustrings constructor #if defined(__GNUC__) // We don't want the internal 'string str' to redundantly store the // chars, along with our own allocation. So we use our knowledge of // the internal structure of gcc strings to make it point to our chars! // Note that we've carefully structured the TableRep fields so they // mimic a GCC basic_string::_Rep. // // It turns out that the first field of a gcc std::string is a // pointer to the characters within the basic_string::_Rep. We // merely redirect that pointer, though for std::string to function // properly, the chars must be preceeded immediately in memory by // the rest of basic_string::_Rep, consisting of length, capacity // and refcount fields. And we have designed our TableRep to do // just that! So now we redirect the std::string's pointer to our // own characters and its mocked-up _Rep. // // See /usr/include/c++/VERSION/bits/basic_string.h for the details // of gcc's std::string implementation. *(const char **)&str = c_str(); DASSERT (str.c_str() == c_str()); #else // Not gcc -- just assign the internal string. This will result in // double allocation for the chars. If you care about that, do // something special for your platform, much like we did for gcc // above. (Windows users, I'm talking to you.) str = s; #endif When the osl build starts to precompile the bundled osl scripts oslc triggers the DASSERT (which is line 137) shown above. If I adjust the #if (and the matching destructor) so the non-gcc fallback is used, osl still fails just without the assert message. Running the osl compile step in gdb I get the following backtrace -- /usr/ports/graphics/openimageio/work/OpenImageIO-oiio-f9d8f1b/src/libutil/ustring.cpp:137: failed assertion 'str.c_str() == c_str()' Program received signal SIGABRT, Aborted. [Switching to Thread 819406400 (LWP 100230/oslc)] 0x000000080344998a in thr_kill () from /lib/libc.so.7 (gdb) bt #0 0x000000080344998a in thr_kill () from /lib/libc.so.7 #1 0x0000000803518259 in abort () from /lib/libc.so.7 #2 0x000000080196d120 in TableRep (this=0x81943c3d0, s=0x801bb50b8 "resolution", len=10) at /usr/ports/graphics/openimageio/work/OpenImageIO-oiio-f9d8f1b/src/libutil/ustring.cpp:137 #3 0x000000080196d607 in OpenImageIO::v1_2::ustring::make_unique (str=0x801bb50b8 "resolution") at /usr/ports/graphics/openimageio/work/OpenImageIO-oiio-f9d8f1b/src/libutil/ustring.cpp:196 #4 0x000000080110118f in ustring (this=0x801f21e20, str=0x801bb50b8 "resolution") at ustring.h:166 #5 0x000000080110114d in ustring (this=0x801f21e20, str=0x801bb50b8 "resolution") at ustring.h:167 #6 0x00000008019ae35b in __cxx_global_var_init16 () at /usr/ports/graphics/openimageio/work/OpenImageIO-oiio-f9d8f1b/src/libtexture/imagecache.cpp:80 #7 0x00000008019c8a39 in global constructors keyed to a () at /usr/ports/graphics/openimageio/work/OpenImageIO-oiio-f9d8f1b/src/libtexture/imagecache.cpp:229 #8 0x0000000801ba83b2 in __do_global_ctors_aux () from /usr/local/lib/libOpenImageIO.so.1.2 #9 0x00000008015a7d0e in _init () from /usr/local/lib/libOpenImageIO.so.1.2 #10 0x00007fffffffccc0 in ?? () #11 0x0000000800616701 in objlist_call_init () from /libexec/ld-elf.so.1 #12 0x0000000800615c97 in _rtld () from /libexec/ld-elf.so.1 #13 0x0000000800614089 in .text () from /libexec/ld-elf.so.1 #14 0x0000000000000000 in ?? () (gdb)