Library not loaded: /usr/local/Cellar/openssl/1.0.2k/lib/libcrypto.1.0.0.dylib
I just upgrade from Qt 5.4.2 to 5.7.1. When I try to package run the application, I get the following message error message:
Termination Reason: DYLD, [0x1] Library missing Application Specific Information: dyld: launch, loading dependent libraries Dyld Error Message: Library not loaded: /usr/local/Cellar/openssl/1.0.2k/lib/libcrypto.1.0.0.dylib Referenced from: /Applications/MyApp/MyApp.app/Contents/Frameworks/libssl.1.0.0.dylib Reason: image not found
Do I need to add some libraries with 5.7.1 which was not the case in 5.4.2?
How are you packaging your application ?
@IshM From what I see you don't have openssl installed. Your app is looking for it in /usr/local/Cellar which is a homebrew thing.
You can try
brew install opensslbut you should probably deal with the fact that your application is using external libs. Especially ones that need homebrew to install.
@ambershark The correct way in this case would be to bundle the dependencies correctly as well as fix their search paths.
@IshM Well putting them in your bundle library section and setting the paths with otool would work and is how it's normally done.
However, the licensing of openssl needs to be reviewed. You may not be allowed to distribute binaries like that.
To add to @ambershark, macdeployqt is the tool to help deployment of macOS applications.
@SGaist @ambershark This is what I added to my project file and it seems to work now
mac: LIBS += -framework AppKit /usr/local/opt/openssl/lib/libssl.a /usr/local/opt/openssl/lib/libcrypto.a -framework IOKit -framework CoreAudio -framework Carbon
Is this way correct?
@IshM Well yes, that will work since you are linking them statically so you don't need to distribute the libraries any more.
However, be warned that you have the same licensing issues. If your app is not open source you will need to check into the license requirements for linking to a binary openssl like that or it could cost you a lot of money.
AFAIK, that's the reference.
@IshM That looks easy to satisfy. It's not under any GPL/LGPL which are not easy to satisfy.
Just follow that license and you should be fine. :)
I seem to have found a solution.
I try to:
$ cd MyApp.app/Contents/Frameworks $ otool -L libssl.1.0.0.dylib libssl.1.0.0.dylib: @executable_path/../Frameworks/libssl.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/local/Cellar/openssl/1.0.2n/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2) $ install_name_tool -change /usr/local/Cellar/openssl/1.0.2n/lib/libcrypto.1.0.0.dylib @executable_path/../Frameworks/libcrypto.1.0.0.dylib libssl.1.0.0.dylib