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

Cannot Build on OS X



  • I am new to C and C++ programming, but have used Perl and Java. I want to start using a GUI in C++, Perl, and Python and I'd like to use Qt.

    I'm having trouble building Qt 5.1.1 on my iMac, running OS X 10.8.4. At one point I installed MacPorts, decided it was messing with too much and stopped using it. Everything in the /opt directory tree is from MacPorts, but I've gone through and removed all references, such as attempts to change $PATH in bash and so on. However, since only MacPorts was using /opt, I left that directory tree there. (This matters in a few paragraphs.)

    I downloaded Qt from this URL (http://download.qt-project.org/official_releases/qt/5.1/5.1.1/single/qt-everywhere-opensource-src-5.1.1.tar.gz) and unpacked it, then, according to the README, from the directory the unpacked files were in, I did this:

    @./configure -prefix $PWD/qtbase -opensource -nomake tests@

    And then:

    @make -j 4@

    Then I ran into a slew of errors involving files in the tools directory as well as many errors in /opt. I don't know enough about the source code and C++ or C to do any debugging, so I renamed /opt to /optx so the files from MacPorts would be out of the way.

    Then I did this:

    @make clean
    ./configure -prefix $PWD/qtbase -opensource -nomake tests
    make -j 4@

    Both times I redirected output into a file and the file this time was MUCH larger (the first time, with /opt and MacPorts in place, the file was under 300k, the 2nd time, with /opt renamed and MacPorts out of the way, the file was 5.5M). But I'm still getting errors. At the tail end of the output, when avoiding MacPorts, I get:

    @/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -headerpad_max_install_names -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -mmacosx-version-min=10.6 -o imagegestures.app/Contents/MacOS/imagegestures .obj/debug-shared/imagewidget.o .obj/debug-shared/main.o .obj/debug-shared/mainwidget.o .obj/debug-shared/moc_imagewidget.o .obj/debug-shared/moc_mainwidget.o -F/var/root/PyInstall/qt-everywhere-opensource-src-5.1.1/qtbase/lib -framework QtWidgets -framework QtGui -framework QtCore -framework OpenGL -framework AGL
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -headerpad_max_install_names -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -mmacosx-version-min=10.6 -o localfortuneclient.app/Contents/MacOS/localfortuneclient .obj/debug-shared/client.o .obj/debug-shared/main.o .obj/debug-shared/moc_client.o -F/var/root/PyInstall/qt-everywhere-opensource-src-5.1.1/qtbase/lib -framework QtWidgets -framework QtGui -framework QtCore -framework QtNetwork -framework OpenGL -framework AGL
    make[1]: *** [sub-examples-make_first] Error 2
    make: *** [module-qtbase-make_first] Error 2@

    I've cleaned it up and retried and still get the same errors. I have the full output and can post the last few dozen lines if that helps.

    I can also post the errors I got with MacPorts libs available, but I suspect that's not important. I include that information in case I'm wrong.

    Is there something I can do to reconfigure or to get Qt to compile for me?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    The error log you are showing is missing the original error. You should rather run it with no -j option.

    As a side note, building inside the sources with -prefix $$PWD/qtbase sounds very fishy. You should do an out of source build and use -developer-build if you don't want to install the libraries once compiled.



  • Thanks, SGaist!

    I'll try this. I do want the libraries installed - I take it they'll go in /usr/lib or /usr/local/lib, right?

    Part of the reason I'm doing this is so I can also use them for Python and Perl, and Python needs them in place.

    The building inside the sources is from the README file with the source itself. I don't know enough to know the reasoning to it, but I'll see how it works without that on the config line.

    Can you suggest what I can search for to find the original error in the log? Just the word "error?" (or will there be too many libs handling errors to make that useful?).


  • Moderators

    SGaist and Tango - just FYI: in-source with $PWD/qtbase used to be endorsed as the official way of building Qt5 before 5.0 was released :) I've tried that many times and it works on all platforms.


  • Lifetime Qt Champion

    Thanks for the information ! Since there's out of source build possibility, I never came back to in-source build unless mandatory :)



  • Okay, I tried:

    @./configure -opensource -nomake tests 2>&1|tee ../QtConfigWIthErrors.txt
    make 2>&1|tee ../QtMakeWIthErrors.txt@

    It took something like 7 hours and at the end I got:

    @QT_PLUGIN_PATH=/private/var/root/PyInstall/qt-everywhere-opensource-src-5.1.1/qtbase/plugins:/private/var/root/PyInstall/qt-everywhere-opensource-src-5.1.1/qtsvg/plugins:/private/var/root/PyInstall/qt-everywhere-opensource-src-5.1.1/qtdeclarative/plugins:/private/var/root/PyInstall/qt-everywhere-opensource-src-5.1.1/qtmultimedia/plugins:/private/var/root/PyInstall/qt-everywhere-opensource-src-5.1.1/qtsensors/plugins:/private/var/root/PyInstall/qt-everywhere-opensource-src-5.1.1/qttools/plugins:/private/var/root/PyInstall/qt-everywhere-opensource-src-5.1.1/qtimageformats/plugins:/private/var/root/PyInstall/qt-everywhere-opensource-src-5.1.1/qtquick1/plugins DYLD_FRAMEWORK_PATH=/private/var/root/PyInstall/qt-everywhere-opensource-src-5.1.1/qtbase/lib${DYLD_FRAMEWORK_PATH:+:$DYLD_FRAMEWORK_PATH} /private/var/root/PyInstall/qt-everywhere-opensource-src-5.1.1/qttools/bin/lrelease qtxmlpatterns_uk.ts -qm qtxmlpatterns_uk.qm
    Updating 'qtxmlpatterns_uk.qm'...
    Generated 41 translation(s) (41 finished and 0 unfinished)
    Ignored 418 untranslated source text(s)
    cd qtdoc/ && ( test -e Makefile || /private/var/root/PyInstall/qt-everywhere-opensource-src-5.1.1/qtbase/bin/qmake /private/var/root/PyInstall/qt-everywhere-opensource-src-5.1.1/qtdoc/qtdoc.pro -o Makefile ) && make -f Makefile
    Project WARNING: No .qmake.cache is present. This significantly slows down qmake with this makespec.
    Project WARNING: Call 'cache()' in the top-level project file to rectify this problem.
    cd doc/ && ( test -e Makefile || /private/var/root/PyInstall/qt-everywhere-opensource-src-5.1.1/qtbase/bin/qmake /private/var/root/PyInstall/qt-everywhere-opensource-src-5.1.1/qtdoc/doc/doc.pro -o Makefile ) && make -f Makefile
    Project WARNING: No .qmake.cache is present. This significantly slows down qmake with this makespec.
    Project WARNING: Call 'cache()' in the top-level project file to rectify this problem.
    make[2]: Nothing to be done for `first'.@

    That doesn't look to me like it was successful, but I will be seeing what I can find. The output from this is 86MB, so any tip of what to look for to see if it died or for the original error or what I can check (such as what library names would be in /usr/lib or /usr/local/lib) would be a big help. I listed both directories and used grep to find any libraries with a "q" in the name and also used grep for today's date (Oct 21), but no files show up that match the date and the files with a "q" in the name are for mysql or something else.


  • Lifetime Qt Champion

    Once built that way, you need to call make install



  • So it does look like a successful build?

    Okay - I made a mistake. I thought I had read, in output from configure, to not run make install. I just double checked and it says to do it. My bad. Guess I got confused with all the other info.

    I'll have time to do that later this evening and I'll let you know what happens.



  • It looks like it's installed and in place. I even installed PyQt and it had no problems with my Qt installation.

    I do have a question, and I know I'm very new to C and C++, so this may be an obvious point I haven't found yet.

    Why does Qt install the libraries in its own tree in /usr/local/Qt<version info>/ instead of in /usr/lib or /usr/local/lib? I know there are also executables included in this tree, but why aren't the libraries put in with the rest of the libraries?


  • Moderators

    [quote author="Tango" date="1382421828"]Why does Qt install the libraries in its own tree in /usr/local/Qt<version info>/ instead of in /usr/lib or /usr/local/lib? I know there are also executables included in this tree, but why aren't the libraries put in with the rest of the libraries?[/quote]

    Most probably to allow you to have multiple versions of Qt installed in parallel.


Log in to reply