(SOLVED) Deploy application on MAC OS
-
Hi,
i have a problem trying to deploy my Qt5 app on Mac.First of all some information about the app. It uses Qt 5.2.x + sqlite + another statically linked lib.
Everything runs fine on the developer machine.I wrote a script to make deployment easier. This script copies the .app directory of the app to another place and
then manually copies the database folder into myApp.app/Contents + the libqca.2.dylib into the Frameworks folder.when i run otool -L i see (as expected) that all the libs are showing to the $QTDIR/lib
@ /development/Qt/5.2.1/5.2.1/clang_64/lib/libqca.2.dylib (compatibility version 2.0.0, current version 2.1.0)
/development/Qt/5.2.1/5.2.1/clang_64/lib/QtWebKitWidgets.framework/Versions/5/QtWebKitWidgets (compatibility version 5.2.0, current version 5.2.1)
/development/Qt/5.2.1/5.2.1/clang_64/lib/QtQuick.framework/Versions/5/QtQuick (compatibility version 5.2.0, current version 5.2.1)
/development/Qt/5.2.1/5.2.1/clang_64/lib/QtQml.framework/Versions/5/QtQml (compatibility version 5.2.0, current version 5.2.1)CUT OUT OTHER QT LIBS HERE
/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/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)@then after running macdeployt
the same otool -L looks like that:
@ @executable_path/../Frameworks/libqca.2.dylib (compatibility version 2.0.0, current version 2.1.0)
@executable_path/../Frameworks/QtWebKitWidgets.framework/Versions/5/QtWebKitWidgets (compatibility version 5.2.0, current version 5.2.1)
@executable_path/../Frameworks/QtQuick.framework/Versions/5/QtQuick (compatibility version 5.2.0, current version 5.2.1)
@executable_path/../Frameworks/QtQml.framework/Versions/5/QtQml (compatibility version 5.2.0, current version 5.2.1)CUT OUT OTHER QT LIBS HERE
/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/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)@So it seems everything has been fixed correctly by macdeployqt.
But when i copy the bundle to a non developer machine and start my app. It comes up..connects to sqlite...
but when accessing the first method from the external libqca it crashes.@Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000VM Regions Near 0:
-->
__TEXT 0000000100000000-00000001003c7000 [ 3868K] r-x/rwx SM=COW /Users/USER/*/MyApp.app/Contents/MacOS/eLogbookThread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libqca.2.dylib 0x00000001004c6f79 QCA::PublicKey::verifyMessage(QCA::MemoryRegion const&, QByteArray const&, QCA::SignatureAlgorithm, QCA::SignatureFormat) + 105
1 com.yourcompany.eLogbook 0x00000001001a94fc EasyLicer::RequestKey::verify(EasyLicer::ActivationKey const&, EasyLicer::LicensorPubKey const&) + 300@
The console output is:
@10/05/14 22:52:23,984 ReportCrash[5549]: Attempting to read data: Called memoryAtAddress: 0x10465b690, which is in an unmappable portion of [0x0 -> 0xffffffffffffffff] in PID# 5548.@@Very strange. Problem seems to be with the libqca.2.dylib library.
But when i move the libqca.2.dylib away for testing, the app does not start and complains about missing exactly this lib.This is the second day i try to get rid of thid stuff. Maybe somebody has a hint or can help me. Would be really cool.
Greetings
Nando -
Hi,
Did you also put in there libqca dependencies ?
-
Hi.
[quote author="SGaist" date="1399759706"]Hi,Did you also put in there libqca dependencies ?[/quote]
i think so.
when i call otool -L on the libqca which is in Frameworks of the bundel i get:@otool -L ../Frameworks/libqca.2.dylib
../Frameworks/libqca.2.dylib:
@executable_path/../Frameworks/libqca.2.dylib (compatibility version 2.0.0, current version 2.1.0)
@executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore (compatibility version 5.2.0, current version 5.2.1)
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 157.0.0)
/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 55471.14.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 855.14.0)
@ -
And that's the right thing to do, these are system libraries that should not be put in the bundle.
I don't remember, does qca also use plugins ?
-
[quote author="SGaist" date="1399761472"]And that's the right thing to do, these are system libraries that should not be put in the bundle.
I don't remember, does qca also use plugins ?[/quote]
yes it uses the crypto plugin. i put the crypto plugin folder
into the PlugIns folder beside the other plugins.The content of the crypto folder is :
@-rwxr-xr-x 1 nando staff 61380 May 11 00:41 libqca-cyrus-sasl.so
-rwxr-xr-x 1 nando staff 113644 May 11 00:41 libqca-cyrus-sasl_debug.so
-rwxr-xr-x 1 nando staff 38748 May 11 00:41 libqca-logger.so
-rwxr-xr-x 1 nando staff 79840 May 11 00:41 libqca-logger_debug.so
-rwxr-xr-x 1 nando staff 366724 May 11 00:41 libqca-ossl.so
-rwxr-xr-x 1 nando staff 648420 May 11 00:41 libqca-ossl_debug.so
-rwxr-xr-x 1 nando staff 126024 May 11 00:41 libqca-softstore.so
-rwxr-xr-x 1 nando staff 251168 May 11 00:41 libqca-softstore_debug.so@Do i also need to check all the .so libs with otool ?
For me it is not really clear what is the difference betweend these dylib and .so on mac..... -
Ahhh maby that is the point:
i checked the libqca-ossl.so and got:
@libqca-ossl.so:
/development/Qt/5.2.1/5.2.1/clang_64/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.2.0, current version 5.2.1)
/development/Qt/5.2.1/5.2.1/clang_64/lib/libqca.2.dylib (compatibility version 2.0.0, current version 2.1.0)
/usr/lib/libssl.0.9.8.dylib (compatibility version 0.9.8, current version 50.0.0)
/usr/lib/libcrypto.0.9.8.dylib (compatibility version 0.9.8, current version 50.0.0)
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 157.0.0)
/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 55471.14.1)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)@so here macdeploy did not the trick.... i will change that manually and then try again...
-
Hi,
that was the problem!!!!!!Thank you very much!
i fixed it by manually do:
@install_name_tool -change $QTDIR/lib/QtCore.framework/Versions/5/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore $TARGET_DIR/eLogbook.app/Contents/PlugIns/crypto/libqca-ossl.so
#install_name_tool -id @executable_path/../Frameworks/libqca.2.dylib $TARGET_DIR/eLogbook.app/Contents/PlugIns/crypto/libqca-ossl.so
install_name_tool -change $QTDIR/lib/libqca.2.dylib @executable_path/../Frameworks/libqca.2.dylib $TARGET_DIR/eLogbook.app/Contents/PlugIns/crypto/libqca-ossl.so@
-
Great !
You're welcome !
Happy coding :)