Build with (official binary installer) Qt 5.6 on OS X not supported #7714

issue paveljanik opened this issue on March 18, 2016
  1. paveljanik commented at 10:33 AM on March 18, 2016: contributor

    Qt 5.6 was released a few days ago (http://blog.qt.io/blog/2016/03/16/qt-5-6-released/).

    configure --with-gui=qt5 on OS X (can't test other systems right now) fails with:

    checking for QT... no
    configure: error: Qt dependencies not found
    

    config.log contains:

    configure:22230: checking for QT
    configure:22237: $PKG_CONFIG --exists --print-errors "$qt5_modules"
    Package Qt5Core was not found in the pkg-config search path.
    Perhaps you should add the directory containing `Qt5Core.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'Qt5Core' found
    Package Qt5Gui was not found in the pkg-config search path.
    Perhaps you should add the directory containing `Qt5Gui.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'Qt5Gui' found
    

    Qt 5.6 contains only 2 *.pc files compared to 89 in e.g. 5.4:

    pavel$ find Qt/5.4 -name *.pc | wc -l
          89
    pavel$ find Qt5.6.0 -name *.pc
    Qt5.6.0/5.6/clang_64/lib/pkgconfig/Qt5OpenGLExtensions.pc
    Qt5.6.0/5.6/clang_64/lib/pkgconfig/Qt5UiTools.pc
    pavel$ 
    

    Relevant upstream change: https://codereview.qt-project.org/#/c/140954/

  2. jonasschnelli added the label GUI on Mar 18, 2016
  3. laanwj added the label Mac on Mar 18, 2016
  4. paveljanik commented at 9:47 PM on March 18, 2016: contributor

    Ready for some hackery?

    Qt installed from the offline installer, to /tmp/Qt5.6.0.

    # To save typing
    export QTDIR="/tmp/Qt5.6.0/5.6/clang_64/"
    
    # Prepare includes - HACK
    cd ${QTDIR}/include
    for fwk in `cd ../lib/; ls -1d *framework`; do FWK=`echo $fwk | sed 's#.framework##'`; ln -sf ../lib/$fwk/Versions/Current/Headers $FWK; done
    cd -
    
    # Use moc from Qt5.6.0, not the old one from the system, important!
    export PATH=${QTDIR}/bin/:$PATH
    
    # HACK - missing pkgconfig files in Qt5.6
    QT_CFLAGS="-I${QTDIR}/include -I${QTDIR}/include/QtWidgets -I${QTDIR}/include/QtCore -I${QTDIR}/include/QtGui -I${QTDIR}/include/QtNetwork" QT_LIBS="-F${QTDIR}/lib -framework QtCore -framework QtNetwork -framework QtGui -framework QtWidgets" ./configure --with-gui=qt5
    
    make
    
    # Fix rpath
    #
    # Without it:
    #
    #dyld: Library not loaded: [@rpath](/bitcoin-bitcoin/contributor/rpath/)/QtCore.framework/Versions/5/QtCore
    #  Referenced from: /private/tmp/bitcoin-master.qt/src/qt/./bitcoin-qt
    #  Reason: image not found
    # Trace/BPT trap: 5
    install_name_tool -add_rpath ${QTDIR}/lib src/qt/bitcoin-qt
    

    I'd be happy if someone replicates this.

  5. paveljanik commented at 9:53 PM on March 18, 2016: contributor

    Compare with #5728...

  6. theuni commented at 11:04 PM on March 18, 2016: member

    See here: https://github.com/Homebrew/homebrew/commit/620baaf10c957875d9d2b958343456f0d35d15fc

    Looks like this might not affect us with Homebrew, and Linux/Win builds aren't affected either. @paveljanik mind testing with an updated Homebrew?

  7. paveljanik commented at 5:57 AM on March 19, 2016: contributor

    I use Macports. And Qt from the binary installer, so I can't test it myself.

  8. fanquake commented at 6:23 AM on March 19, 2016: member

    I can confirm that Homebrew is unaffected. Just compiled master + Qt 5.6.0 with no issue. qt56

  9. paveljanik commented at 6:33 AM on March 19, 2016: contributor

    @fanquake great! Can you please upload all pkgconfig files somewhere?

  10. paveljanik renamed this:
    Build with Qt 5.6 not supported
    Build with (official binary installer) Qt 5.6 on OS X not supported
    on Mar 19, 2016
  11. paveljanik commented at 4:04 PM on March 31, 2016: contributor

    @fanquake ping

  12. jonasschnelli commented at 8:00 AM on April 1, 2016: contributor
  13. fanquake commented at 8:37 AM on April 1, 2016: member

    @paveljanik sorry for not following up. If you don't have enough info with what @jonasschnelli has provided, let me know and i'll upload my files.

  14. paveljanik commented at 4:50 PM on April 1, 2016: contributor

    @fanquake No problem, thank you. Files from @jonasschnelli are enough.

    So the new summary of problems, redone from clean installation of original binary Qt installer:

    1. four pkgconfig files are missing: Qt5Core.pc, Qt5Gui.pc, Qt5Network.pc and Qt5Widgets.pc. The problem is worked around in brew (https://github.com/Homebrew/homebrew/blob/master/Library/Formula/qt5.rb#L29).
    2. '# Prepare includes - HACK' needed. Again, worked around in brew already (https://github.com/Homebrew/homebrew/blob/master/Library/Formula/qt5.rb#L112).
    3. rpath problems (https://codereview.qt-project.org/#/c/138349). Original installer installs libraries with @rpath ID:
    $ otool -l QtNetwork | grep rpath/QtNetwork
             name [@rpath](/bitcoin-bitcoin/contributor/rpath/)/QtNetwork.framework/Versions/5/QtNetwork (offset 24)
    $
    

    This can be changed by:

    lib$ for fwk in *framework; do FWK=`echo $fwk | sed 's#.framework##'`; install_name_tool -id `pwd`/$fwk/$FWK $fwk/$FWK; done
    

    This can be fixed in the configure phase of Qt, with -no-rpath as already done in brew.

    To sum up: you can build with the original installer after these three steps...

  15. paveljanik closed this on Apr 1, 2016

  16. paveljanik commented at 5:57 PM on April 1, 2016: contributor

    Two more .pc files missing: Qt5Test.pc added. But there is no Qt5DBus.pc in Jonas' files. This results in this difference in the build log:

    -checking for QT_DBUS... yes
    +checking for QT_DBUS... no
    -checking whether to build GUI with support for D-Bus... yes
    +checking whether to build GUI with support for D-Bus... no
    

    Strange.

  17. paveljanik commented at 6:27 PM on April 1, 2016: contributor

    After adding Qt5DBus.pc (similar to the previous Qt version), the build is now complete.

  18. laanwj commented at 5:35 AM on April 2, 2016: member

    We should probably document this somewhere, for example paste @paveljanik 's summary into the OSX build doc, until this is fixed in upstream (and it looks like they broke it on purpose :poop:) I don't think you'll be the only one stumbling on this

  19. paveljanik commented at 5:43 AM on April 2, 2016: contributor

    I'll prepare something, probably in the form of contrib script to fix the local installation coming from the official installer with some documentation...

  20. paveljanik reopened this on Apr 2, 2016

  21. paveljanik commented at 4:57 PM on April 2, 2016: contributor

    It is not worth the effort to prepare script for this. See #7789 for small doc addition.

  22. paveljanik closed this on Apr 2, 2016

  23. danieleTrimarchi commented at 6:07 PM on December 24, 2016: none

    Hi,

    I have downloaded the Qt5.7 for macOsX and I have the problem discussed here: only Qt5UiTools.pc and Qt5OpenGLExtensions.pc in my $(QTROOT)/5.7/clang_64/lib/pkgconfig.

    The links provided by paveljanik on April, the 1st appear to be broken, is this still the path to fix the local installation of Qt coming from the official installer?

    Can you guys assist with this and point me to the location of the patches?

    Thanks, Daniele

  24. paveljanik commented at 9:28 PM on December 26, 2016: contributor
  25. paveljanik commented at 10:37 AM on December 27, 2016: contributor

    OK, I have tested with 5.7.1:

    1. add include links:
    cd include
    for fwk in `cd ../lib/; ls -1d *framework`; do FWK=`echo $fwk | sed 's#.framework##'`; ln -sf ../lib/$fwk/Versions/Current/Headers $FWK; done
    
    1. fix rpath:
    cd lib
    for fwk in *framework; do FWK=`echo $fwk | sed 's#.framework##'`; install_name_tool -id `pwd`/$fwk/$FWK $fwk/$FWK; done
    
    1. add pkgconfig files: http://tmp.janik.cz/Bitcoin/qt5.7.1-addedpkgconfig.tar.gz

    It works afterwards... Can you test it?

  26. danieleTrimarchi commented at 3:34 PM on December 27, 2016: none

    Hi paveljanik,

    this is great, thanks a lot!

    I have downloaded the Qt5.7 distribution from Homebrew, and patched it with the instruction and files you have provided.

    I can now build (with Scons, btw) and run several examples.

    I am only wondering: you gave me access to a tmp directory with the package configuration (*.pc) files. Why aren't these already in the Homebrew , or even the standard Qt distribution?

    How did you generate these files?

    Also, is Qt aware of this problem? I am really surprised that they have not corrected it in the first place, if this appears to have been around for (at least) the last two releases.

    Thanks, Daniele

    2016-12-27 11:37 GMT+01:00 paveljanik notifications@github.com:

    OK, I have tested with 5.7.1:

    1. add include links:

    cd include for fwk in cd ../lib/; ls -1d *framework; do FWK=echo $fwk | sed 's#.framework##'; ln -sf ../lib/$fwk/Versions/Current/Headers $FWK; done

    1. fix rpath:

    cd lib for fwk in *framework; do FWK=echo $fwk | sed 's#.framework##'; install_name_tool -id pwd/$fwk/$FWK $fwk/$FWK; done

    1. add pkgconfig files: http://tmp.janik.cz/Bitcoin/ qt5.7.1-addedpkgconfig.tar.gz

    It works afterwards... Can you test it?

    — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bitcoin/bitcoin/issues/7714#issuecomment-269308460, or mute the thread https://github.com/notifications/unsubscribe-auth/AXnAwtrA7nUIhjfY0o4f-qSGmtzkU1_2ks5rMOqCgaJpZM4HzvQ4 .

  27. danieleTrimarchi commented at 1:39 PM on November 30, 2018: none

    Hi paveljanik, I am still trying to generate the .pc files for Qt : would you be able to help me with this? Thanks, Daniele

  28. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 18:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me