[Interest] Porting to Qt5/macx-xcode Mountain Lion

Andreas Pakulat apaku at gmx.de
Thu Jan 24 19:36:02 CET 2013


Hi,

On Thu, Jan 24, 2013 at 6:11 PM, Joshua Grauman <jnfo-c at grauman.com> wrote:
>> On Thu, Jan 24, 2013 at 7:08 AM, Joshua Grauman <jnfo-c at grauman.com>
>> wrote:
>>>
>>> First a disclaimer, I know very little about Mac OS specifics. I only
>>> have
>>> a Mac to build my app for it.
>>>
>>> I am porting two apps to Mac OS Mountain Lion and Qt5. The apps have run
>>> fine on quite a few of the Qt4 series versions in Windows/Linux/Mac (Snow
>>> Leopard). They both run fine in Qt5/Linux. I just installed the latest
>>> Mountain Lion version with latest XCode. I've gotten them to compile by
>>> running:
>>>
>>> qmake -spec macx-xcode project.pro
>>> xcodebuild
>>>
>>> But two completely different programs both segfault on a simple line:
>>>
>>>    QFile file("file");
>>>    if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
>>>      exit(0);
>>>    QTextStream in(&file);
>>>    in.setCodec("UTF-8");
>>>    while(!in.atEnd())
>>>    {
>>>      QString line = in.readLine(); //segfault here
>>>    ...
>>>
>>> At first I thought it was new Mac OS sandboxing stupidity limiting my
>>> file
>>> acces, but I have have been able to get that line to run fine in a
>>> minimal
>>> example (so I'm guessing that's not it, but I'm still not positive).
>>
>>
>> Where's your backtrace? A backtrace should be able to tell you at
>> least where exactly it segfaults (possibly within Qt code). And make
>> sure you have Qt built with debugging symbols, otherwise the backtrace
>> won't be very useful.
>>
> Sorry, you're right that I should have included this for completeness.
>
> Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
> 0   QtCore                              0x0000000100d6bb0b
> QTextStreamPrivate::fillReadBuffer(long long) + 299
> 1   QtCore                              0x0000000100d6c26f
> QTextStreamPrivate::scan(QChar const**, int*, int,
> QTextStreamPrivate::TokenDelimiter) + 143
> 2   QtCore                              0x0000000100d6d5dd
> QTextStream::readLine(long long) + 125
> 3   com.yourcompany.trainer             0x0000000100005e59 main + 2825
> 4   com.yourcompany.trainer             0x00000001000028d4 start + 52

Hmm, unfortunately thats not enough, its apparently crashing within
fillReadBuffer, but the line is not available. Presumably this is
because you didn't configure Qt with -debug and hence only minimal
debug information are available. So re-configuring and rebuilding Qt
would most probably give a more helpful information.

That being said I can only think of two cases for this crash: a) a bug
in Qt which you should report with a minimal example at
http://bugreports.qt-project.org, b) the file you're reading is not
actually UTF-8 and that trips up the qtextstream at some point.

Andreas



More information about the Interest mailing list