Can not load default MySQL library - Mac OS X lazarus / 16-Databases ---------------------------------------------------------------------- pierre_rs · 2008-10-05 20:54 Hi, I have SQLDBLaz 1.0.1 installed in Lazarus IDE. I started a new project and drop a TMySQL50Connection's component (from SQLdb tab on Components Pallet) into a form. When trying to click/set TMySQL50Connection's component 'Connected' Property (to True), I got this message: Error Can not load default MySQL library ("limysqlclient.dylib.15" or "libmysqlclient.dylib"). Check your installation. I read earlier posts but nothing works. Any help will be greatly appreciated. Mac OS X 10.5.5 2Ghz intel core 2 duo MySQL 5.0.67 (working and accessible) FPC 2.2.2 Lazarus 0.9.27 svn revision 16875 Thanks. ---------------------------------------------------------------------- Jaco · 2008-10-11 09:57 Hi, Is your problem solved? If so, would appreciate to get details, since I am struggling with the same issue. Thanks, Jaco ---------------------------------------------------------------------- Phil · 2008-10-11 15:09 Quote from: "pierre_rs" Error Can not load default MySQL library ("limysqlclient.dylib.15" or "libmysqlclient.dylib"). Check your installation. Look in FPC's mysql.inc. It's using LoadLibrary to attempt to load one of those files - neither attempt is successful in your case. Look at FPC's rtl.pdf for LoadLibrary. No assumptions are made about the location of the library and if an absolute path is not specified the results are platform dependent. mysql.inc does not specify an absolute path so you need to figure our where OS X is looking for the .dylib. Try putting it in various places like in the app's bundle (.app/Contents/MacOS). Thanks. -Phil ---------------------------------------------------------------------- pierre_rs · 2008-10-12 23:09 Quote from: "jvoorham"Hi, Is your problem solved? If so, would appreciate to get details, since I am struggling with the same issue. Thanks, Jaco Jaco, No, not yet. I'm trying but the error persists. I tried even in Mac OS X Tiger Server (PPC) with no luck. By the way, there's a Apple's document about dynamic libraries on Mac OS X: -http://developer.apple.com/DOCUMENTATION/DeveloperTools/Conceptual/Dy namicLibraries/Articles/DynamicLibraryUsageGuidelines.html - Thanks! ---------------------------------------------------------------------- pierre_rs · 2008-10-12 23:40 Quote from: "Phil"Quote from: "pierre_rs" Error Can not load default MySQL library ("limysqlclient.dylib.15" or "libmysqlclient.dylib"). Check your installation. Look in FPC's mysql.inc. It's using LoadLibrary to attempt to load one of those files - neither attempt is successful in your case. Look at FPC's rtl.pdf for LoadLibrary. No assumptions are made about the location of the library and if an absolute path is not specified the results are platform dependent. mysql.inc does not specify an absolute path so you need to figure our where OS X is looking for the .dylib. Try putting it in various places like in the app's bundle (.app/Contents/MacOS). Thanks. -Phil Phil, Thanks for your help. I tried do change '/usr/local/share/fpcsrc/packages/mysql/src/mysql.inc' - {$ELSEIF DEFINED(mysql41)}  mysqlvlib = '/usr/lib/mysql/libmysqlclient.a'; {$ELSE} -  and recompile Lazarus IDE (via menu Tools-Build Lazarus) but again the error message was the same (when trying to put TMySQL50Connection's component 'Connected' Property = True). I tried to put symbolic links in some places (/usr/lib /usr/local/lib /usr/local/dylibs .app/Contents/MacOS) with no luck. I'll keep on trying. There must be a way. Thanks!!! ---------------------------------------------------------------------- Jaco · 2008-11-30 18:58 Pierre/Phil, The Apple developer link in the messaqe of 05oct08 resulted in a solution (finally !). The path to the libmysqlclient.dylib should be present in the environmental variable LD_LIBRARY_PATH, which can be set in the file environment.plist, Thanks for the help guys. Jaco ---------------------------------------------------------------------- pierre_rs · 2008-12-02 00:16 Quote from: "jvoorham"Pierre/Phil, The Apple developer link in the messaqe of 05oct08 resulted in a solution (finally !). The path to the libmysqlclient.dylib should be present in the environmental variable LD_LIBRARY_PATH, which can be set in the file environment.plist, Thanks for the help guys. Jaco Jaco, Thanks for you good news! So I understood, that I have to create a  "~/.MacOSX/environment.plist". Could you post the contents of your "environment.plist", so I could use it as an example? Thanks! ---------------------------------------------------------------------- Jaco · 2008-12-02 07:20 Here it is.    LD_LIBRARY_PATH    /usr/local/mysql/lib ---------------------------------------------------------------------- Phil · 2008-12-03 00:09 Quote from: "jvoorham"Pierre/Phil, The Apple developer link in the messaqe of 05oct08 resulted in a solution (finally !). The path to the libmysqlclient.dylib should be present in the environmental variable LD_LIBRARY_PATH, which can be set in the file environment.plist, Thanks for the help guys. Jaco Here's a quote from the man pages for the OS X linker (ld): "ld searches for libraries first in any directories specified with -L options, then in any directories specified in the colon separated set of paths in the  environment  variable LD_LIBRARY_PATH, then the standard directories /lib, /usr/lib, and /usr/local/lib." It would seem that before you start modifying the LD_LIBRARY_PATH, you should test to see whether putting the library in one of the standard directories or specifying the expected library path with the -L switch. Thanks. -Phil