Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt4 with X11 on Mac OSX Lion/Snow Leopard



  • I have been trying to install the open source edition of Qt 4.8.2 from source and link to X11 without success. I am currently running OSX 10.7.4. My research group uses some analysis software that uses PyQt4. Most of our other analysis packages still use X11. Also, we have a mac server (running OSX 10.6.8) that we only log into using ssh, so we would like to have the forwarding capability of X11. I have been able to build from the qt source successfully by just running ./configure; make; make install. However, this links to the native Cocoa libraries as one would expect. I have searched for explanations on how to link to X11 instead with little success. I have tried to simply create a different mkspecs folder named linux-g++-mac as suggested in one post, but I get the following errors:
    /usr/local/qt-everywhere-opensource-src-4.8.2/src/corelib/io/qfile.cpp:1259: error: ‘::lseek64’ has not been declared
    /usr/local/qt-everywhere-opensource-src-4.8.2/src/corelib/io/qfile.cpp:1259: error: ‘off64_t’ was not declared in this scope

    I am aware that there is a fink package qt4-base-x11. I have worked on installing this, but it has been slow going trying to resolve all of the inconsistent dependencies in the dependencies of qt4-x11 (not qt4-x11 itself). I would prefer to simply install this directly from source if possible. I did try to use the fink info file as an example of the commands I should use to build from source which has gotten me the farthest along in the build. I ran the following perl commands to patch a few files as from the fink build:
    perl -pi -e 's,const char,char,g' config.tests/unix/iconv/.cpp
    perl -pi -e 's,CFG_MAC_XARCH=auto,CFG_MAC_XARCH=no,g' configure

    I then ran the following configure command:
    ./configure -x11 -platform darwin-g++ -xplatform darwin-g++ -arch x86_64 -confirm-license -verbose -no-separate-debug-info -L/usr/X11/lib -I/usr/X11/include -no-pch ; make; make install

    I have tried this both the XCode gcc and g++ and clang. I did not expect the clang build to work as I have seen other posts about issues with the clang compiler.

    The configure script runs through completely with almost no warnings. The only warnings I see are a set of warnings like the following:
    WARNING: Failure to find: generated/AuthenticationManagerMessageReceiver.cpp
    WARNING: Failure to find: generated/DownloadProxyMessageReceiver.cpp
    WARNING: Failure to find: generated/DrawingAreaMessageReceiver.cpp
    ...

    The only warnings that concerned me were:
    WARNING: /usr/local/qt-everywhere-opensource-src-4.8.2/src/plugins/platforms/cocoa/cocoa.pro:26: Unable to find file for inclusion ../fontdatabases/coretext/coretext.pri
    WARNING: /usr/local/qt-everywhere-opensource-src-4.8.2/src/plugins/platforms/cocoa/cocoa.pro:26: Unable to find file for inclusion ../fontdatabases/coretext/coretext.pri
    WARNING: /usr/local/qt-everywhere-opensource-src-4.8.2/src/plugins/platforms/cocoa/cocoa.pro:26: Unable to find file for inclusion ../fontdatabases/coretext/coretext.pri

    WARNING: /usr/local/qt-everywhere-opensource-src-4.8.2/src/plugins/s60/feedback/feedback.pro:16: Unable to find file for inclusion data_caging_paths
    WARNING: /usr/local/qt-everywhere-opensource-src-4.8.2/src/plugins/s60/feedback/feedback.pro:16: Unable to find file for inclusion data_caging_paths
    WARNING: /usr/local/qt-everywhere-opensource-src-4.8.2/src/plugins/s60/feedback/feedback.pro:16: Unable to find file for inclusion data_caging_paths

    When I ran the make command, there were a few warnings about a variable was defined but not used and one instance of
    <built-in>:0: warning: Mac OS X version 10.5 or later is needed for use of the new objc abi

    This warning came right before moc started to build.
    /usr/bin/ranlib: file: libbootstrap.a(qisciicodec.o) has no symbols
    /usr/bin/ranlib: file: libbootstrap.a(qtsciicodec.o) has no symbols
    /usr/bin/ranlib: file: libbootstrap.a(qfilesystemengine_mac.o) has no symbols
    ranlib libbootstrap.a
    ranlib: file: libbootstrap.a(qisciicodec.o) has no symbols
    ranlib: file: libbootstrap.a(qtsciicodec.o) has no symbols
    ranlib: file: libbootstrap.a(qfilesystemengine_mac.o) has no symbols

    However, the build crashes when creating the corelib library: libQtCore.dylib.4.8.2 with the error
    Undefined symbols for architecture x86_64:
    "QSettingsPrivate::create(QSettings::Format, QSettings::Scope, QString const&, QString const&)", referenced from:
    QSettings::setPath_helper(QSettings::Scope, QString const&, QString const&)in qsettings.o
    QSettings::QSettings(QObject*)in qsettings.o
    QSettings::QSettings(QSettings::Format, QSettings::Scope, QString const&, QString const&, QObject*)in qsettings.o
    QSettings::QSettings(QSettings::Format, QSettings::Scope, QString const&, QString const&, QObject*)in qsettings.o
    QSettings::QSettings(QSettings::Scope, QString const&, QString const&, QObject*)in qsettings.o
    QSettings::QSettings(QSettings::Scope, QString const&, QString const&, QObject*)in qsettings.o
    QSettings::QSettings(QString const&, QString const&, QObject*)in qsettings.o
    ...
    "QConfFileSettingsPrivate::readPlistFile(QString const&, QMap<QSettingsKey, QVariant>*) const", referenced from:
    QConfFileSettingsPrivate::syncConfFile(int) in qsettings.o
    "QConfFileSettingsPrivate::writePlistFile(QString const&, QMap<QSettingsKey, QVariant> const&) const", referenced from:
    QConfFileSettingsPrivate::syncConfFile(int) in qsettings.o
    ld: symbol(s) not found for architecture x86_64
    collect2: ld returned 1 exit status
    make: *** [../../lib/libQtCore.dylib.4.8.2] Error 1
    make: *** [release] Error 2
    make: *** [sub-corelib-make_default-ordered] Error 2

    qsettings appears to have compiled (as the .o file exists) and there were no warnings produced from that g++ command.

    Is it possible to compile Qt4 against X11 from source? Thank you for your time and help with this issue.


Log in to reply