Page 1 of 1

how to install mysql header files and mysql client library

PostPosted: 03. June 2005 11:49
by catalin
Hello,

I run XAMPP ( MySql 4.0.20 ) on Linux Red Hat 9.0 and I need to install mysql header files and mysql client library to be able and compile a mysql client ( written in C )

How should I do it ?

thank you, Catalin

PostPosted: 03. June 2005 11:52
by Wiedmann
There is a XAMPP devel-package on the download site.

PostPosted: 03. June 2005 17:25
by catalin
I have installed the devel-package but it seems something is still missing.

I'm trying to compile a mysql client like this:

>gcc -c -I/lampp_dir/include/mysql myclient.c ( this looks to be working fine, myclient.o is created )
>gcc -o myclient myclient.o -L/lampp_dir/lib/mysql -lmysqlclient ( this fails: it tells me lmysqlclient does not exist and if I use only >gcc -o myclient myclient.o -L/lampp_dir/lib/mysql it does not recognize any of the mysql functions )

please help me solve this one, because I have nowhere else to turn

also I use xampp 1.4.9 and xampp-devel 1.4.13, but I don't this there is any problem because of this

thank you, Catalin

PostPosted: 03. June 2005 18:18
by catalin
My bad for the previous post, seems I had to reboot first :)

Now I compile my client just fine, but I get a curious error when running it:
error while loading shared libraries: libmysqlclient.so.12: cannot open shared object file: No such file or directory

this is the compile command I use:
gcc -I/opt/lampp/include/mysql /opt/load.c -o /opt/load -lmysqlclient -L/opt/lampp/lib/mysql

and file libmysqlclient.so.12 does exist here:
/opt/lampp/lib/mysql/libmysqlclient.so.12 ( it is a shortcut, link )

do you think this is because I use different versions for xampp and xampp-devel or is it something else ?

thank you

PostPosted: 03. June 2005 18:31
by Wiedmann
do you think this is because I use different versions for xampp and xampp-devel or is it something else ?

Why do you not use the correct devel-package for your XAMPP?
Now I compile my client just fine, but I get a curious error when running it:
error while loading shared libraries: libmysqlclient.so.12: cannot open shared object file: No such file or directory
...
and file libmysqlclient.so.12 does exist here:
/opt/lampp/lib/mysql/libmysqlclient.so.12 ( it is a shortcut, link )

/opt/lampp/lib/ I think this path is not in your shared library search path.

Or you can/should use the rpath option during linking.

PostPosted: 03. June 2005 20:22
by catalin
Wiedmann wrote:Why do you not use the correct devel-package for your XAMPP?

I was using xampp 1.4.9 and today I just picked in a hurry ( without thinking too much ) the latest devel-package.. Is it possible to install an older version of devel on top of my current one ?

Wiedmann wrote:Or you can/should use the rpath option during linking.

I understand, but can you please tell me how to use rpath in my case. First time I'm compiling a file like this and even after looking into ld command explanations I can't get it right.

let's say myclient.c is my file
> gcc -c -I/opt/lampp/include/mysql myclient.c

what command should I use after this

thank you for your patience and promt replies Wiedmann

PostPosted: 05. June 2005 18:14
by catalin
I found this interesting writing about Shared Library Search Paths:
http://www.eyrie.org/~eagle/notes/rpath.html

once again, thank you for your help
Xampp looks to be great product so far

Catalin