ROOT 5.20 does not find MySQL library

Dear,

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,

Is /usr/local/mysql/lib a soft link to /usr/local/mysql-6.0.8-alpha-osx10.5-powerpc/lib ?

Philippe.

[quote=“pcanal”]Hi,

Is /usr/local/mysql/lib a soft link to /usr/local/mysql-6.0.8-alpha-osx10.5-powerpc/lib ?

Philippe.[/quote]

Yes, exactly. I forgot to precise. It has been created automatically during the mysql install

Hi,

Try loading the mysql library explicitly:root [] .L /usr/local/mysql/lib/libmysql.so // or .dylibbefore attempting any other operations.

Cheers,
Philippe.

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?

Cheers,
Jeff.

Hi,

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).

Cheers, Fons.

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?

Many thanks,
Jeff.

Hi,

on a 64-bit 10.5 Mac you will get by default macosx64, i.e. 64-bit version. To see the version of your libmysqlclient do:

(pb-d-128-141-66-41) [146] file /sw/lib/mysql/libmysqlclient.dylib
/sw/lib/mysql/libmysqlclient.dylib: Mach-O dynamically linked shared library i386

which shows I’ve a 32-bit version (which does not work with 64-bit ROOT). To build 32-bit ROOT to work with the mysql use:

./configure macosx (forces build of 32 bit ROOT)

Cheers, Fons.