Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Oct 2013 12:22:04 +0200
From:      Tijl Coosemans <tijl@FreeBSD.org>
To:        Shane Ambler <FreeBSD@ShaneWare.Biz>
Cc:        FreeBSD-ports <freebsd-ports@freebsd.org>
Subject:   Re: Need some help debugging c++ code for 10.0
Message-ID:  <20131018122204.5ec6ce9f@kalimero.tijl.coosemans.org>
In-Reply-To: <20131008160329.729e5518@kalimero.tijl.coosemans.org>
References:  <5252BA55.5070806@ShaneWare.Biz> <20131008160329.729e5518@kalimero.tijl.coosemans.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 8 Oct 2013 16:03:29 +0200 Tijl Coosemans wrote:
> On Tue, 08 Oct 2013 00:12:45 +1030 Shane Ambler wrote:
>> 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.
> 
> There's a third __GNUC__ case in that header.  Unlike the first two
> it's ifNdef though so you need to change it into something like:
> 
> #if !defined(__GNUC__) || defined(_LIBCPP_VERSION)

Have you managed to get this working?  I just noticed opencolorio is
a dependency of Calligra (KDE office suite) which would be nice to have
in FreeBSD 10.0.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20131018122204.5ec6ce9f>