Hi,
I’m trying to get an executable to access a MySQL database. I’ve seen that ROOT has some classes to IO into this kind of DB. Below here there’s an “Hello World” attempt that I’m not able to run without errors (on Yosemite and with ROOT 6.02/02). I’ve put together different suggestions to write the Makefile so I’m not sure this is the best way to set it up.
This first attempt wants to create a new table but I think it crashes at the very beginning.
[code]Error in TMacOSXSystem::FindDynamicLibrary: RMySQL[.so | .dll | .dylib | .sl | .dl | .a] does not exist in /Applications/ROOT/root-v6-02-02/lib:/Applications/ROOT/root-v6-02-02/lib::.:/Applications/ROOT/root-v6-02-02/lib::/usr/local/lib:/usr/X11R6/lib:/usr/lib:/lib:/lib/x86_64-linux-gnu:/usr/local/lib64:/usr/lib64:/lib64:
the runtime system of ROOT is not able to dynamically load the library you need for TMySQLServer libRMySQL.so.
Some questions to get near the solution:
How did you compile ROOT?
Is the shared library available in $ROOTSYS? (it looks like in your case it is /Applications/ROOT/root-v6-02-02/lib)
Does the following line show the same error on the root prompt?
Hi Danilo. Thanks a lot for your reply. My answers below.
[quote=“dpiparo”]Hi,
the runtime system of ROOT is not able to dynamically load the library you need for TMySQLServer libRMySQL.so.
Some questions to get near the solution:
How did you compile ROOT?[/quote]
sudo ./configure macosx64 --all
sudo make -j 2
[quote=“dpiparo”]
Is the shared library available in $ROOTSYS? (it looks like in your case it is /Applications/ROOT/root-v6-02-02/lib)[/quote]
Nope:
ll $ROOTSYS/lib/libRM*
ls: /Applications/ROOT/root-v6-02-02/lib/libRM*: No such file or directory
I’m not a MacOS X expert -> for Linux you can find some hints in [url=https://root-forum.cern.ch/t/root-and-mysql-without-installing-mysql/12014/2 old thread[/url].
You need to configure and build your ROOT completely from scratch again.
Right after the “configure” step (before running “make”), see the newly created “config.log” file and make sure that you see “mysql” in the list “Result: Enabled support for …” (almost in the end of this file).
BTW. For your “TestMySQL”, I think you will need:
LDFLAGS = root-config --glibs -lRMySQL
I already have it from XAMPP.
I’m trying to understand how to give to ./configure all the paths needed to locate include files and libraries (hoping that this makes sense).
sudo ./configure macosx64 --enable-mysql --with-mysql-incdir=/Applications/XAMPP/xamppfiles/include --with-mysql-libdir=/Applications/XAMPP/xamppfiles/lib | grep mysql
INFO: --enable-mysql: already enabled by default.
Checking for mysql_config … not found
Checking for mysql.h … /Applications/XAMPP/xamppfiles/include
Checking for libmysqlclient_r, libmysqlclient, or mysqlclient … no
Unable to find any JVMs matching version “(null)”.
No Java runtime present, try --request to install.
1 - How can I specify where mysql_config is? I tried:
export MYSQL=/Applications/XAMPP/xamppfiles/bin
but nothing changed
2 - ./configure doesn’t find the client’s libs but they are all there:
ls /Applications/XAMPP/xamppfiles/lib/libmysqlclient*
/Applications/XAMPP/xamppfiles/lib/libmysqlclient.18.dylib /Applications/XAMPP/xamppfiles/lib/libmysqlclient_r.18.dylib
/Applications/XAMPP/xamppfiles/lib/libmysqlclient.a /Applications/XAMPP/xamppfiles/lib/libmysqlclient_r.a
/Applications/XAMPP/xamppfiles/lib/libmysqlclient.dylib /Applications/XAMPP/xamppfiles/lib/libmysqlclient_r.dylib
Well, you could try to find the place where the “mysql_config” script is present:
find /Applications/XAMPP -name mysql_config -print
If you really have the “mysql_config” script in “/Applications/XAMPP/xamppfiles/bin” then, before running “configure”, try to:
export PATH="/Applications/XAMPP/xamppfiles/bin:${PATH}"
Danilo …
your option seems to work; after installing brew and its mysql formula, configure finds all the stuff (I’ve not compiled it). The problem with this solution is that during the installation I get:
A “/etc/my.cnf” from another install may interfere with a Homebrew-built
I’d like to avoid conflicts with XAMPP because I’m already using its mysql.
Wile …
With your suggestion (that doesn’t create any conflict) I move a step forward but something is still missing:
sudo ./configure macosx64 --all | grep mysql
Checking for mysql_config … /Applications/XAMPP/xamppfiles/bin/mysql_config
Checking for libmysqlclient version >= 3.23.* … ok
Checking for mysql.h … no
How can I pass to configure the path to mysql.h?
sudo ./configure macosx64 --with-mysql-incdir=/Applications/XAMPP/xamppfiles/include --with-mysql-libdir=/Applications/XAMPP/xamppfiles/lib | grep mysql
Password:
Checking for mysql_config … not found
Checking for mysql.h … /Applications/XAMPP/xamppfiles/include
Checking for libmysqlclient_r, libmysqlclient, or mysqlclient … no
Unable to find any JVMs matching version “(null)”.
No Java runtime present, try --request to install.
Well, it a bug in ROOT’s “configure” script.
When parsing the output of your “mysql_config --cflags”, it will happily take “mysqlincdir=/Applications/XAMPP/xamppfiles/include/ncurses”.
Another step forward. The library now exists but ROOT (and the exe that I’m creating) can’t load it:
ll /Applications/ROOT/root-v6-02-02Compiled/lib/ | grep MySQL
-rw-r–r-- 1 root admin 220B Jan 19 10:05 libRMySQL.rootmap
-rwxr-xr-x 1 root admin 90K Jan 19 10:05 libRMySQL.so
-rw-r–r-- 1 root admin 370B Jan 19 10:05 libRMySQL_rdict.pcm
./TestMySQL.v0.0
cling::DynamicLibraryManager::loadLibrary(): dlopen(/Applications/ROOT/root-v6-02-02Compiled/lib/libRMySQL.so, 9): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Applications/ROOT/root-v6-02-02Compiled/lib/libRMySQL.so
Reason: image not found
Error in TInterpreter::TCling::AutoLoad: failure loading library libRMySQL.so for TMySQLServer
cling::DynamicLibraryManager::loadLibrary(): dlopen(/Applications/ROOT/root-v6-02-02Compiled/lib/libRMySQL.so, 9): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Applications/ROOT/root-v6-02-02Compiled/lib/libRMySQL.so
Reason: image not found
*** Break *** segmentation violation
Generating stack trace…
0x0000000000000001 in
root -l
root [0] gSystem->Load("/Applications/ROOT/root-v6-02-02Compiled/lib/libRMySQL. (*** TAB to check if ROOT finds it ***)
libRMySQL.rootmap libRMySQL.so
root [0] gSystem->Load("/Applications/ROOT/root-v6-02-02Compiled/lib/libRMySQL.so");
cling::DynamicLibraryManager::loadLibrary(): dlopen(/Applications/ROOT/root-v6-02-02Compiled/lib/libRMySQL.so, 9): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Applications/ROOT/root-v6-02-02Compiled/lib/libRMySQL.so
Reason: image not found