Install Qt 4.8.7 on a Mac running OS X 10.11 (El Capitan)



  • Hello!

    I tried to install Qt 4.8.7 on a Mac running OS X 10.11 (El Capitan).

    During the installation I got the message:
    "This package is incompatible with this version of OS X and may fail to install."

    I selected "Install Anyway".

    At the end I got the message "The installation failed." and Qt is not usable.

    I know that Qt 4 is replaced by Qt 5 but I have some projects using Phonon which cannot be compiled with Qt 5.

    Does anybody have a workaround for this?

    Thanks for your help!


  • Lifetime Qt Champion

    Hi,

    The only way I see currently is to compile Qt yourself



  • @SGaist

    This could be a solution.

    Unfortunately I am not so familiar with the OS X tool chain.

    I was glad that everything is covered by Qt and QtCreator so that I could use my Windows code with slight modifications on the Mac.

    The only solution for me is to compile these projects on a second OS X installation (running 10.10).

    If anybody has a better idea I would be glad to hear it.

    Thanks!


  • Lifetime Qt Champion

    It really boils down to:

    ./configure
    make -jX where X is twice the number of core you have available
    sudo make install
    


  • @SGaist

    Thanks, this really sounds easy.

    But even for this my knowledge of OS X seems not to be sufficient....

    I extracted "qt-everywhere-opensource-src-4.8.7" into /tmp.
    Then I started the terminal (bash) and changed into this directory.

    When I enter "./configure" I get the message:

    -bash: ./configure: /bin/sh^M: bad interpreter: No such file or directory

    Are there other requirements besides the installation of Xcode?



  • Compiling Qt is the only way I know of to get a working version of 4.X.X running on this OS.

    You need to install the command line tools. You can access this from XCode or you can do a separate download.

    When running 'configure' you can pass quite a number of parameters to define what you want. I suspect you don't want the examples compiled since you have been using this for a while. Run './configure -help' first to see your options. Option '-prefix' is one I always supply for example (sets the installation location).



  • @laseranichris said:

    ....
    When I enter "./configure" I get the message:

    -bash: ./configure: /bin/sh^M: bad interpreter: No such file or directory

    Are there other requirements besides the installation of Xcode?

    Downloading and using the unix .tar.gz instead of the windows .zip archive would fix that problem.

    Also, if you are compiling with the latest Xcode and you need Qt's openssl support, you will need to setup your own openssl since the openssl headers are not part of the SDK anymore..



  • Hi!

    This was my mistake: I really took the Windows sources....
    Sorry about this!

    Using the right sources I can build Qt 4.8.7 on a Mac with OS X 10.10.5 and Xcode 7.1.

    But the build still fails on OS X 10.11.1 and Xcode 7.1.
    Even when I specify a different directory using "-prefix".

    I decided for me that it is the best soultion to have a second installation running OS X 10.10 and use the Qt installer.

    Thank you for you comments.


  • Lifetime Qt Champion

    What errors do you get ?



  • @SGaist

    These are the errors I get:

    painting/qpaintengine_mac.cpp:345:19: error: use of undeclared identifier 'CMGetProfileByAVID'
    CMError err = CMGetProfileByAVID((CMDisplayIDType)displayID, &displayProfile);
    ^
    painting/qpaintengine_mac.cpp:348:9: error: use of undeclared identifier 'CMCloseProfile'
    CMCloseProfile(displayProfile);
    ^



  • @SGaist said:

    make -jX where X is twice the number of core you have available

    Why twice?


  • Lifetime Qt Champion

    Ok, so it's an API that's not available anymore on El Capitan. You can use the patch homebrew is using to compile Qt.

    So keeps all cores busy, if you need them for something else, just use less cores than what you have available.



  • I'm encountering the same problem as laseranichris, then I tried the patch. But then I got another error:
    ...
    Undefined symbols for architecture x86_64:
    "Phonon::ObjectDescriptionModel<(Phonon::ObjectDescriptionType)0>::qt_metacast(char const*)", referenced from:
    vtable for Phonon::ObjectDescriptionModel<(Phonon::ObjectDescriptionType)0> in window.o
    "Phonon::ObjectDescriptionModel<(Phonon::ObjectDescriptionType)0>::metaObject() const", referenced from:
    vtable for Phonon::ObjectDescriptionModel<(Phonon::ObjectDescriptionType)0> in window.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    ...

    How can I fix this? Thank you very much!


  • Lifetime Qt Champion

    Did you restart your build from scratch ?



  • @DoHuuVi

    just configure with "-nomake examples"



  • @SGaist : yes, I retried from scratch but still encountered the error.

    I'm trying with nomake example.



  • @SGaist
    Hi,
    I have tried to compile Qt 4.8.7 on Mac OS X 10.11(El Capitan)
    After make -j1
    I got
    3 warnings and 2 errors generated.
    make[2]: *** [.obj/debug-shared/qpaintengine_mac.o] Error 1
    make[1]: *** [debug-all] Error 2
    make: *** [sub-gui-make_default-ordered] Error 2


  • Lifetime Qt Champion

    Did you apply the patch I linked to ?



  • @SGaist
    Thanks so much for your reply.
    I didn't try the patch. I am new to this, and could you please tell me more detail about how to apply it?


  • Qt Champions 2016

    @FresaYuan
    Hi
    I think you just need to change the
    src/gui/painting/qpaintengine_mac.cpp
    file
    All in red are deleted and this line is inserted:
    CGColorSpaceRef colorSpace = CGDisplayCopyColorSpace(displayID);

    in the function
    QCoreGraphicsPaintEngine::macDisplayColorSpace

    There is a tool to apply patches but in this case
    "1 file changed, 1 insertion(+), 7 deletions(-)"
    Seems ok to apply by hand.



  • This post is deleted!


  • @mrjj
    Thanks a lot. After change the file, when input "sudo make -j1 install"
    It runs almost half an hour. And end up with errors like this
    make[3]: *** No rule to make target ../../WebCore/debug/libwebcored.a', needed by../../../../../../lib/QtWebKit.framework/QtWebKit_debug'. Stop.
    make[2]: *** [debug-install] Error 2
    make[1]: *** [sub-WebKit-qt-QtWebKit-pro-install_subtargets-ordered] Error 2
    make: *** [sub-webkit-install_subtargets-ordered] Error 2


  • Lifetime Qt Champion

    If you don't need webkit then disable its build. Also don't build as root.



  • @SGaist brew install qt4 works
    Thanks a lot for your reply



  • Hello,
    Would it be possible to share the build of qt.4.8.7 for El Capitan?

    thanks.



  • brew install qt4
    they have done all dirty works for you


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.