Forum > Databases

Cannot connect to MariaDB with ZConnection Component under macOS

(1/3) > >>

Hello all
after a while break I rediscovered Lazarus and try to port older Delphi projects (still from Windows) to Lazarus under macOS and modernize them.
I want to create a client for a MariaDB running on a QNAP NAS.
The DB is set up and I can access it with myPHPAdmin and mySQL Workbench ... so far so good.
I am using a Mac Pro (Intel macOS 12) and a MacBook (M1, macOS 13). I can also access a few other Macs (with Intel CPU) to test things.
Now what happens is this. For starters, I simply try to connect to MariaDB via a ZConnection component of ZEOS. On the Mac Pro, this works without any grumbling. Same project on the MacBook (same Lazarus environment, mySQL installed) and I always get the same error:
"libmysq|client.dylib found but could not be loaded. Check compile-target and library compatibility!. "
I am still in the IDE - nothing compiled. On Mac Pro it works - on all other Macs the error comes.  :oops:
The lib is available. I also copied it to the project folder and also referenced the lib directly with the "LibraryLocation" property. When trying it out, I tried different versions of the mySQLClient.dylib. Always the same error on all Macs except the Mac Pro!!! I can't find any help in the various wikis or forums. Does anyone here have any ideas?
I have attached a screenshot.
Thanks in advance!

Hello Tomki,

--- Quote from: Tomki on June 05, 2023, 01:28:05 pm ---"libmysq|client.dylib found but could not be loaded. Check compile-target and library compatibility!. "

--- End quote ---
Zeos will generate that exception if it can find the library but cannot load it for some reason. What happens if you do something like tis:

--- Code: ---procedure TestLibrayLoading;
  Handle: THandle:
  Handle := LoadLibrary(PChar('/Users/thomas/Documents/work/Pascal/sql-test/libmysqlclient.21.dylib'));
  if Handle = 0 then
    ShowMessage('Library loaded successfully.');
--- End code ---

Maybe this gives some more information on what happens. Also you might want to check if all dependencies of libmysqlclient.21.dylib are available. On Linux one can use ldd to check which other libraries are necessary.

Best regards,


Thanks Jan
I tried and attached you can see the result. But I swear: the file is there!

is the dylib just copied over, or is it compiled for M1 (ARM)?
What's YOUR Compile-Target in your Project?

Different question:
I did not only copy the libmysqlclient.21.dylib into the project directory, but all of the *.dylib files. Is there anything else which I need to do?
In a different scenario I pointed the LibraryLocation of the TZConnection component to the /usr/local/ folder in which the mySQL libs were placed at installation.
In this case it works! But I cannot make an application bundle, if it doesn't work if the lib location is different!?


[0] Message Index

[#] Next page

Go to full version