Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I am using Slackware 14.1 x64 and when I want to run a program that is using mysql.h over C

I read the following error:

bash-4.2$ /home/normal/Proyectos/a.out 
/home/normal/Proyectos/a.out: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory

The program was compiled by:

$ gcc -L/usr/local/mysql/lib -lmysqlclient ctemp.c

What can I do?

share|improve this question

closed as unclear what you're asking by Braiam, roaima, mdpc, PersianGulf, cuonglm Jun 5 at 1:24

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

2  
What's the output of ldd /home/normal/Proyectos/a.out? –  Braiam Jun 4 at 21:16
    
What is the output of find /usr/lib64 -name "libmysqlclient.so*"? –  Mohammad Etemaddar Jun 4 at 21:20
    
@MohammadEtemaddar Here is: root@- /h/n/Proyectos# ldd /home/normal/Proyectos/a.out linux-vdso.so.1 (0x00007fff991ff000) libmysqlclient.so.18 => not found libc.so.6 => /lib64/libc.so.6 (0x00007fbe8a66a000) /lib64/ld-linux-x86-64.so.2 (0x00007fbe8aa74000) –  user2356536 Jun 4 at 21:22
1  
@user2356536 I think it is safe to say that isn't the best way. :-) Do a system install of mysqlclient, not a local one. And don't ever copy stuff from /usr/local into your system. –  Faheem Mitha Jun 4 at 22:53
1  
@user2356536 You can leave libmysqlclient.so in /usr/local/mysql/lib. The trick is to either pass -Wl,-rpath=/usr/local/mysql/lib to the linker, or add /usr/local/mysql/lib to /etc/ld.so.conf and run ldconfig. –  lcd047 Jun 5 at 4:55

Browse other questions tagged or ask your own question.