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

Joshua Grauman jnfo-c at grauman.com
Thu Jan 24 07:08:37 CET 2013


Hello all,

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). I'm 
wondering now if there is some sort of mismatch between xcode/clang 
version used to compile Qt5 and the version I'm using to compile my apps 
(maybe mine is too new?). Running otool -L on the Qt5 libs and my program 
shows they were compiled for different versions of libstdc++ 
(compatibility version 7.0.0 for both, but current version 52.0.0 for Qt5 
and 56.0.0 for my program). Could that cause a segfault in the readLine() 
function?

Does anyone one have any other ideas of what I would need to do to get my 
programs to run properly under the latest Mountain Lion / XCode and the 
standard Qt5 for Mac libs? Basically I'm asking if I'm missing something 
obvious in terms of library/compile versions or steps to port an app to 
Qt5 under Mac. Other than what I did to port my app to Qt5 under Linux, 
all I did was run qmake and xcodebuild to build it on Mac, and I don't 
know if there is something else I'm supposed to do.

Another related question. Is Qt5 going forward always going to use clang 
for Mac OSX, or should I also expect to see Qt5 prebuilt for gcc on Mac at 
some point as well?

Thanks!



More information about the Interest mailing list