|
|
Home » Developing U++ » Mac OS » missing libmysqlclient.dylib [SOLVED]
missing libmysqlclient.dylib [SOLVED] [message #53001] |
Sat, 01 February 2020 16:31 |
|
forlano
Messages: 1185 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
Hello,
I have compiled and packaged my app in a dmg file. I used the Mysql library and on my mac it works perfectly.
When the dmg file is installed on another mac the program cannot run because of missing libmysqlclient.dylib .
The installation of this library seems to be tricky because depends upon then operative system and one needs to create a symbolik link. Now I am fighting with a user of mine to install correctly such lib.
I wonder if we can statically link libmysqlclient or if make sense to include it in my package.
Thanks,
Luigi
EDIT: it seems that my application look for the libmysqlclient.dylib in the same place where it existed at compile time. So when the app is moved on another computer in which the libmysqlclient.dylib is somewhere else the app refuse to work ( http://lessons.livecode.com/m/4071/l/15029-linking-an-osx-ex ternal-bundle-with-a-dylib-library).
The problem can be fixed with Xcode modifying the path and pointing it to a folder coming with the app itself. The procedure make little sense to me because I do not use Xcode.
So the possibility to link statically libmysqlclient.a should be the easiest solution.
I have added in main package configuration a new linker option to -lmysqllib. It compiles but the executable dimension remain the same instead to increase of 8 Mb... so it seems the static link is not performed ...still inquiring
EDIT2: no success in statically linking libmysqlclient
[Updated on: Wed, 26 February 2020 16:55] Report message to a moderator
|
|
|
Re: missing libmysqlclient.dylib [message #53098 is a reply to message #53001] |
Wed, 26 February 2020 16:53 |
|
forlano
Messages: 1185 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
Solved!
It seems that the app try to get the library from where was at compile time. So the user needs to install the library and be lucky to put it in the right place.
The best option is to put the dylib with your app, but on mac this is a bit tricky.
Here is a list of dylib used by my program:
otool -L ./VegaVR.app/Contents/MacOS/VegaVR
./VegaVR.app/Contents/MacOS/VegaVR:
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1673.126.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 23.0.0)
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 162.0.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0)
/usr/local/opt/mysql/lib/libmysqlclient.21.dylib (compatibility version 21.0.0, current version 21.0.0) <--- LOOK THIS
/usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 800.7.0)
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1894.10.126)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1673.126.0)
/System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics (compatibility version 64.0.0, current version 1348.12.4)
/System/Library/Frameworks/CoreText.framework/Versions/A/CoreText (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
I need to deploy libmysqlclient.21.dylib. I copied it in the same folder of the executable app. Then you need to run a black magic tool that perform some operation on your executable and address it to the correct path (my exe is named VegaVR)
install_name_tool -change /usr/local/opt/mysql/lib/libmysqlclient.21.dylib "@executable_path/libmysqlclient.21.dylib" ./VegaVR.app/Contents/MacOS/VegaVR
Here is the dylib list after this task:
otool -L ./VegaVR.app/Contents/MacOS/VegaVR
./VegaVR.app/Contents/MacOS/VegaVR:
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1673.126.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 23.0.0)
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 162.0.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0)
@executable_path/libmysqlclient.21.dylib (compatibility version 21.0.0, current version 21.0.0) <-- LOOK HERE
/usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 800.7.0)
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1894.10.126)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1673.126.0)
/System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics (compatibility version 64.0.0, current version 1348.12.4)
/System/Library/Frameworks/CoreText.framework/Versions/A/CoreText (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
As you see, the wanted dylib is now searched in the executable path. This procedure has been tested with another computer.
Luigi
[Updated on: Wed, 26 February 2020 16:53] Report message to a moderator
|
|
|
|
Goto Forum:
Current Time: Thu Apr 18 03:57:03 CEST 2024
Total time taken to generate the page: 0.03298 seconds
|
|
|