When I run some of private executable (C++ analyse tools from my working collaboration) which require the ROOT library (and more especially ROOT library which are related to the MySQL package) I got the following error message
[code]dyld: lazy symbol binding failed: Symbol not found: _mysql_init
Referenced from: /SCIENCE/ROOT/v5.20/lib/libRMySQL.so
Expected in: dynamic lookup
dyld: Symbol not found: _mysql_init
Referenced from: /SCIENCE/ROOT/v5.20/lib/libRMySQL.so
Expected in: dynamic lookup[/code]
It looks like the RootMySQL package is not able to find the path to the MySQL library. I tried for a long time to solve this problem without any success, therefore, I publish a topic here and hope someone can help me to found the solution (and sorry, I can not publish the source of my program since their are in private collaboration. I also do not have any other program with require the mysql library to be tested).
As to be noted that I use MySQL version 6.0.8 for OSX, build in 32 bit (more info about my configuration into my signature).
The PATH of the mysql library (/usr/local/mysql/lib on my computer) as been added to the LD_LIBRARY_PATH and to the DYLD_LIBRARY_PATH. So, I can not figure out why root can not find it. Especially that, when I build my software, I do not get any error related to the mysql. Even when I built ROOT, I did not had errors related to the mysql library.
For information, here the options I used to build root (also in 32 bit, I think).
I tried to build root again (in case the previous installation has problem), but this do not solve my problem.
Any help would be grateful, I really need to run this software.
Hi,
I’m experiencing a very similar problem to this one running on my mac with OSX 10.5.6 and ROOT version 5.18/00. I have the path to the mysql library in both my DYLD_ and LD_LIBRARY_PATH but still get the missing symbol error.
This solution of pre-loading the library solves the problem (actually I do .L /usr/local/mysql/lib/libmysqlclient.dylib)
Does anyone know why this library is not getting dynamically loaded? Is there a solution apart from explicitly loading the library?
did you build the binary yourself? If not you should rebuild it with the proper libmyslclient. Also do:
otool -L lib/libRMySQL.so
to see if libmysqlclient is in the list of libraries. It should be but might not be if the binary is build against a wrong version of libmysqlclient (64-bit binary against 32-bit libmysqlclient).
Hi,
I built root myself but used two versions of a dmg file for mysql:
First I tried:
mysql-5.0.51b-osx10.5-x86_64.dmg
but then tried the 32 bit version:
mysql-5.0.77-osx10.5-x86.dmg
Neither of these seem to work.
The mysqlclient library is indeed missing from my libRMySQL.so:
otool -L lib/libRMySQL.so
lib/libRMySQL.so:
/Users/hartnell/minos/root_5_18_00/root/lib/libRMySQL.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.3)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
Following your idea I found this in my root build log:
g++ -O2 -dynamiclib -single_module -undefined dynamic_lookup -install_name /Users/hartnell/minos/root_5_18_00/root/lib/libRMySQL.dylib -o lib/libRMySQL.dylib mysql/src/TMySQLResult.o mysql/src/TMySQLRow.o mysql/src/TMySQLServer.o mysql/src/TMySQLStatement.o mysql/src/G__MySQL.o -ldl -L/usr/local/mysql/lib -lmysqlclient -lz -lm
ld: warning in /usr/local/mysql/lib/libmysqlclient.dylib, file is not of required architecture
ln -fs libRMySQL.dylib lib/libRMySQL.so
==> lib/libRMySQL.dylib done
So, as you suspected my libmysqlclient.dylib is “not of required architecture”.
Do you know an easy way to test the architecture of libmysqlclient.dylib to see what it thinks it is? I have several versions I would like to quickly test (without having to re-build the whole of root every time)
Stupid question: but for macosx, is the default to build 32 bit root binaries/libraries?