Copyq: The last several releases for macOS never work.

Created on 27 Nov 2016  路  16Comments  路  Source: hluk/CopyQ

$ ./copyq
dyld: Library not loaded: /usr/local/Cellar/qt5/5.7.0/lib/QtWidgets.framework/Versions/5/QtWidgets
  Referenced from: /Applications/CopyQ.app/Contents/Frameworks/QtSvg.framework/Versions/5/QtSvg
  Reason: image not found
Trace/BPT trap: 5
$ showdeps copyq
copyq:
    /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon
    /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa
    @rpath/QtWidgets.framework/Versions/5/QtWidgets
    @rpath/QtNetwork.framework/Versions/5/QtNetwork
    @rpath/QtSvg.framework/Versions/5/QtSvg
    @rpath/QtXml.framework/Versions/5/QtXml
    @rpath/QtScript.framework/Versions/5/QtScript
    @rpath/QtMacExtras.framework/Versions/5/QtMacExtras
    @rpath/QtGui.framework/Versions/5/QtGui
    @rpath/QtCore.framework/Versions/5/QtCore
    /usr/lib/libc++.1.dylib
    /usr/lib/libSystem.B.dylib
    /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
    /System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics
    /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
    /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
    /usr/lib/libobjc.A.dylib
$ showdeps /Applications/CopyQ.app/Contents/Frameworks/QtSvg.framework/Versions/5/QtSvg
/Applications/CopyQ.app/Contents/Frameworks/QtSvg.framework/Versions/5/QtSvg:
    @executable_path/../Frameworks/QtSvg.framework/Versions/5/QtSvg
    /usr/local/Cellar/qt5/5.7.0/lib/QtWidgets.framework/Versions/5/QtWidgets
    /usr/local/Cellar/qt5/5.7.0/lib/QtGui.framework/Versions/5/QtGui
    /usr/local/Cellar/qt5/5.7.0/lib/QtCore.framework/Versions/5/QtCore
    /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration
    /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
    /usr/lib/libz.1.dylib
    /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL
    /System/Library/Frameworks/AGL.framework/Versions/A/AGL
    /usr/lib/libc++.1.dylib
    /usr/lib/libSystem.B.dylib

Obviously, the copyq binary itself is properly patched for the shared library names, but those libraries it links are forgotten.

macOS

Most helpful comment

OK, next try: CopyQ.dmg
(Package was created after library paths have been fixed.)

All 16 comments

I think the developer was patching the binary probably using install_name_tool manually, which is very likely to cause this image not found error.
The recommended way for package distribution is using macdeployqt against the compiled app bundle.

My procedure of building CopyQ:

git clone https://github.com/hluk/CopyQ.git
cd CopyQ
mkdir build
cd build
qmake CONFIG+=release ..
make -j2
make package_plugins
make package_translations
macdeployqt copyq.app

The build is working fine regardless whether Qt libraries are installed.

Thanks for the detailed description!

I've updated the build scripts (8d2095d23b2986c4ed38f05327659420253421ba) and created beta release for this: copyq.dmg

Can you check if the new package works?

Sorry, not working. Still the same error:

$ ./copyq
dyld: Library not loaded: /usr/local/Cellar/qt5/5.7.0/lib/QtWidgets.framework/Versions/5/QtWidgets
  Referenced from: /Users/leon/Downloads/copyq.app/Contents/Frameworks/QtSvg.framework/Versions/5/QtSvg
  Reason: image not found
Abort trap: 6

The Qt libraries still yet correctly patched

$ otool -L /Users/leon/Downloads/copyq.app/Contents/Frameworks/QtSvg.framework/Versions/5/QtSvg
/Users/leon/Downloads/copyq.app/Contents/Frameworks/QtSvg.framework/Versions/5/QtSvg:
    @executable_path/../Frameworks/QtSvg.framework/Versions/5/QtSvg (compatibility version 5.7.0, current version 5.7.0)
    /usr/local/Cellar/qt5/5.7.0/lib/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.7.0, current version 5.7.0)
    /usr/local/Cellar/qt5/5.7.0/lib/QtGui.framework/Versions/5/QtGui (compatibility version 5.7.0, current version 5.7.0)
    /usr/local/Cellar/qt5/5.7.0/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.7.0, current version 5.7.0)
    /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
    /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 307.4.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)

Is there way to apply the command on all the libraries in "copyq.app"?

Qt also contains some image plugins, usually stored somewhere in imageformats/ directory - this is needed for image items in CopyQ to be displayed properly. Do you know if that's included in the package?

This seems like bug in macdeployqt. Also documentation says that imageformats are always deployed - so that's good but I still need patched version of macdeployqt or use different utility.

Unfortunately this is difficult for me to test since I can only use Travis CI to build the app and create dmg.

@meoow
I can't pass compile with your instruction. Any changes in master branch?

error: use of undeclared
identifier 'QtInfoMsg'
case QtInfoMsg:
^

Im using 10.11. Quick hack comment out the case could get it compile. But when I show the GUI, it crashes.

I think I already fixed this issue (in git branch "osx-build-fix"), unfortunately OSX servers for Travis CI are currently very slow or not working at all so I don't know when I will be able to create dmg package.

OK, here is the new package: CopyQ.dmg

It seems it doesn't work yet:

(~/Applications/CopyQ.app/Contents) $ ./MacOS/copyq
dyld: Library not loaded: /usr/local/Cellar/qt5/5.7.0/lib/QtWidgets.framework/Versions/5/QtWidgets
  Referenced from: /Users/jialong.liu/Applications/CopyQ.app/Contents/Frameworks/QtSvg.framework/Versions/5/QtSvg
  Reason: image not found
zsh: abort      ./MacOS/copyq

Not all the references have been corrected, though the first one has.
```
(~/Applications/CopyQ.app/Contents) $ otool -L Frameworks/QtWidgets.framework/Versions/5/QtWidgets
Frameworks/QtWidgets.framework/Versions/5/QtWidgets:
@executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.7.0, current version 5.7.0)
/usr/local/Cellar/qt5/5.7.0/lib/QtGui.framework/Versions/5/QtGui (compatibility version 5.7.0, current version 5.7.0)
/usr/local/Cellar/qt5/5.7.0/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.7.0, current version 5.7.0)
/System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1504.59.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 157.0.0)
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 307.4.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 48.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1348.15.0)
/System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics (compatibility version 64.0.0, current version 1070.6.0)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1349.0.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)

Actually Travis CI output suggest that dependencies are OK. Here are the important bits.

+/usr/local/Cellar/qt5/5.7.0/bin/macdeployqt CopyQ.app -verbose=2 -dmg
    ...
+otool -L CopyQ.app/Contents/Frameworks/QtSvg.framework/Versions/5/QtSvg
CopyQ.app/Contents/Frameworks/QtSvg.framework/Versions/5/QtSvg:
    @executable_path/../Frameworks/QtSvg.framework/Versions/5/QtSvg (compatibility version 5.7.0, current version 5.7.0)
    /usr/local/Cellar/qt5/5.7.0/lib/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.7.0, current version 5.7.0)
    /usr/local/Cellar/qt5/5.7.0/lib/QtGui.framework/Versions/5/QtGui (compatibility version 5.7.0, current version 5.7.0)
    /usr/local/Cellar/qt5/5.7.0/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.7.0, current version 5.7.0)
    ...
+python macdeployqtfix/macdeployqtfix.py --no-log-file --verbose CopyQ.app/Contents/MacOS/copyq /usr/local/Cellar/qt5/5.7.0
    ...
+otool -L CopyQ.app/Contents/Frameworks/QtSvg.framework/Versions/5/QtSvg
CopyQ.app/Contents/Frameworks/QtSvg.framework/Versions/5/QtSvg:
    @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore (compatibility version 5.7.0, current version 5.7.0)
    @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.7.0, current version 5.7.0)
    @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui (compatibility version 5.7.0, current version 5.7.0)
    @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore (compatibility version 5.7.0, current version 5.7.0)
    ...

The first command also generates CopyQ.dmg package. Maybe the package itself is not fixed only the CopyQ.app/.

Can anyone verify this?

OK, next try: CopyQ.dmg
(Package was created after library paths have been fixed.)

It works! Thanks a lot!

Here is new package for 2.8.1. If it doesn't work please reopen this issue.

v2.8.1 works for me. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SmileyStiles picture SmileyStiles  路  3Comments

aksr picture aksr  路  9Comments

lepalmtree picture lepalmtree  路  7Comments

bsucker98 picture bsucker98  路  4Comments

pacid picture pacid  路  3Comments