Problem with tdbc::mysql on Mojave

63 views
Skip to first unread message

rhobart

unread,
Dec 18, 2019, 9:34:56 AM12/18/19
to
I have search and tried for a day in solving this problem and do not know how to fix this.
I was wanting to convert a php script using mysql for reporting. Thought I would give tcl a try and now just wanting to understand why I can't make it work.
Here is what I have:
Mojave with the latest xcode.
Versions of tcl.tk in kits as well as a fresh install of macports and porting tcl.tk .
In all instances , from kits , kits precompiled, kits I have compiled it is the same problem.
Mac started out as Sierra and updated to Mojave.

Here is an example of the problem.
rjhobart:bin me$ ./tclsh8.6
% join $auto_path \n
/Users/me/developer/scripts/tcl/kbskit-master/Darwin/lib/tcl8.6
/Users/me/developer/scripts/tcl/kbskit-master/Darwin/lib
% package require tdbc::mysql
dlopen(libmysql.dylib.15, 6): image not found

And there is the problem. On my system there is no such image but I have libmysqlclient.20.dylib

Additional checks:
% package require tdbc::sqlite3
1.1.0
% package versions TclOO
1.1.0
% package versions tdbc::mysql
1.1.0
% package require tdbc::postgres
1.1.0

Any ideas would be greatly appreciated.

rhobart

unread,
Dec 18, 2019, 9:41:03 AM12/18/19
to
I should have also added that in lib directory under tdbcmysql1.1.0 there is a filed called libtdbcmysql1.1.0.dylib
Shouldn't that be the image that I need?

Brad Lanam

unread,
Dec 18, 2019, 10:48:45 AM12/18/19
to
That's the tdbc::mysql code, and it looks like it is being loaded ok.
What you need is: libmysql.dylib

Assuming you used macports to install mysql (or mariadb), and assuming
libmysql is in /opt/local/lib, try:
export DYLD_FALLBACK_LIBRARY_PATH=/opt/local/lib
./tclsh8.6

Also check the version of libmysql that is installed by macports.
If there is a version mismatch, you can install the appropriate version
via macports, or create a symlink in /opt/local/lib.

> > dlopen(libmysql.dylib.15, 6): image not found

I'm not sure why it has libmysql.dylib.15 instead of libmysql.15.dylib.
You may need to create a symlink to match this odd path name.

rhobart

unread,
Dec 18, 2019, 1:00:25 PM12/18/19
to
Thank you your insight!
This gives me at least a starting point.
I believe after searching google, macports port site and oracle site; that this library may have been deprecated.
It appears to me that the newest connector is libmysqlclient.dylib
https://dev.mysql.com/downloads/c-api/
The libmysql.dylib is not in my /opt/local/lib and cannot find a macports port for it.
I see a lot of discussion of the windows dll version however.
My mysql install was from oracles dmg package.
My mysql version is 5.7.19.
The file (libmysql.dylib) is not in that in installed /lib either.
libmysqlclient.dylib and libmysqld.a are some of the files in the installed /lib
Perhaps a symlink to match the name of libmysqlclient would work but I think its a c++ library.

Brad Lanam

unread,
Dec 18, 2019, 1:07:17 PM12/18/19
to
On Wednesday, December 18, 2019 at 10:00:25 AM UTC-8, rhobart wrote:
> Thank you your insight!
> This gives me at least a starting point.
> I believe after searching google, macports port site and oracle site; that this library may have been deprecated.
> It appears to me that the newest connector is libmysqlclient.dylib
> https://dev.mysql.com/downloads/c-api/
> The libmysql.dylib is not in my /opt/local/lib and cannot find a macports port for it.
> I see a lot of discussion of the windows dll version however.
> My mysql install was from oracles dmg package.
> My mysql version is 5.7.19.
> The file (libmysql.dylib) is not in that in installed /lib either.
> libmysqlclient.dylib and libmysqld.a are some of the files in the installed /lib
> Perhaps a symlink to match the name of libmysqlclient would work but I think its a c++ library.

Yes, I think it has been named libmysqlclient for quite a while now.
So my guess would be that the tdbc::mysql package is rather out of date.

rhobart

unread,
Dec 19, 2019, 11:01:22 AM12/19/19
to
This worked as per your suggestion. Thank you!!!
sudo ln -s /usr/local/mysql/lib/libmysqlclient.dylib /opt/local/lib/libmysql.dylib.15

rhobart/popple

unread,
Sep 20, 2022, 4:48:23 PMSep 20
to
I have now moved to an M1 chip using Monterey and still had the same problem and fix using the symlink. However had to use create the directory /usr/local/lib and used below link :
sudo ln -s /usr/local/mysql/lib/libmysqlclient.dylib /usr/local/lib/libmariadb.dylib

for some reason I did not have to include the .15 part at the end such as libmariadb.dylib.15 as the error reported.

This worked using Oracle community edition mysql 8 and fresh installs of tcl and libraries using macports.

On problem however in this example:
tdbc::mysql::connection create mysqlDB -database somedatabase etc.......
puts "Mysql: [mysqlDB configure]" it throws Unknown system variable 'TX_ISOLATION'
I tried finding this var in mysql workbench and cannot find it.
Statement and queries so far are working.

On a different mac using Monterey that call works as expected without error. Using Intel and mysql 5.7.19


Harald Oehlmann

unread,
Sep 21, 2022, 2:21:48 AMSep 21
to
For tdbc::mysql, the current trunk has a lot of load fixes. Be sure to:
- use the current trunk
- post any observation as a ticket in the tdbc::mysql fossil repository.

Thanks,
Harald

Reply all
Reply to author
Forward
0 new messages