# Compile MySql with Nginx

**URL:** <https://www.ruby-forum.com/t/compile-mysql-with-nginx/206336>\
**Category:** NGINX\
**Created:** [April 28, 2011, 12:53pm UTC](https://www.ruby-forum.com/t/compile-mysql-with-nginx/206336 "2011-04-28T12:53:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [April 28, 2011, 12:53pm UTC](https://www.ruby-forum.com/t/compile-mysql-with-nginx/206336/1 "2011-04-28T12:53:34Z")

</div>

Hello Everyone,

Tough I have moderate C programming skills, I.m kindy new to linux&nginx  
development, so please excuse any nub questions…

Im having a problem linking mysql client libraries with nginx, libraries  
are there and were installed with yum on my centos 5.0

my config line looks like that  
CORE\_LIBS=“$CORE\_LIBS -L/usr/lib/mysql -lmysqlclient”

all libs looks fine on the path

[root@localhost mysql]# cd /usr/lib/mysql  
[root@localhost mysql]# ll  
total 8268  
-rw-r–r-- 1 root root 1498 Mar 30 19:13 libdbug.a  
-rw-r–r-- 1 root root 50704 Mar 30 19:13 libheap.a  
-rw-r–r-- 1 root root 378224 Mar 30 19:13 libmyisam.a  
-rw-r–r-- 1 root root 30730 Mar 30 19:13 libmyisammrg.a  
-rw-r–r-- 1 root root 1640064 Mar 30 19:13 libmysqlclient.a  
-rw-r–r-- 1 root root 1652652 Mar 30 19:13 libmysqlclient\_r.a  
lrwxrwxrwx 1 root root 26 Apr 27 11:21 libmysqlclient\_r.so →   
libmysqlclient\_r.so.15.0.0  
lrwxrwxrwx 1 root root 26 Apr 15 14:20 libmysqlclient\_r.so.15 →   
libmysqlclient\_r.so.15.0.0  
-rwxr-xr-x 1 root root 1462820 Mar 30 19:13 libmysqlclient\_r.so.15.0.0  
lrwxrwxrwx 1 root root 24 Apr 27 11:21 libmysqlclient.so →   
libmysqlclient.so.15.0.0  
lrwxrwxrwx 1 root root 24 Apr 15 14:20 libmysqlclient.so.15 →   
libmysqlclient.so.15.0.0  
-rwxr-xr-x 1 root root 1451932 Mar 30 19:13 libmysqlclient.so.15.0.0  
-rw-r–r-- 1 root root 1368506 Mar 30 19:13 libmystrings.a  
-rw-r–r-- 1 root root 330274 Mar 30 19:13 libmysys.a  
-rw-r–r-- 1 root root 14312 Mar 30 19:13 libvio.a  
-rwxr-xr-x 1 root root 13169 Mar 30 19:01 mysqlbug  
-rwxr-xr-x 1 root root 6215 Mar 30 19:01 mysql\_config

but when I try to compile nginx with my module I get the following  
error  
…  
objs/ngx\_modules.o   
-lpcre -lssl -lcrypto -ldl -lzl -lmysqlclient  
/usr/bin/ld: cannot find -lmysqlclient  
collect2: ld returned 1 exit status  
make[1]: \*\*\* [objs/nginx] Error 1  
make[1]: Leaving directory `/opt/nginx-1.0.0’  
make: \*\*\* [build] Error 2

Any ideas whats going on here?

cheers,  
Arley

Posted at Nginx Forum:

> **[Compile MySql with Nginx](https://forum.nginx.org/read.php?2,194220,194220#msg-194220)**
>
> Hello Everyone, Tough I have moderate C programming skills, I.m kindy new to linux&nginx development, so please excuse any nub questions... Im having a problem linking mysql client libraries with nginx, libraries are there and were installed with...

---

<div class="post-metadata">

**Author:** ![arleybls](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c77e96/32.png) [@arleybls](https://www.ruby-forum.com/u/arleybls)\
**Post date:** [April 29, 2011, 11:03am UTC](https://www.ruby-forum.com/t/compile-mysql-with-nginx/206336/2 "2011-04-29T11:03:38Z")

</div>

From: arleybls [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> Im having a problem linking mysql client libraries with nginx, libraries  
> are there and were installed with yum on my centos 5.0  
> my config line looks like that  
> CORE\_LIBS=“$CORE\_LIBS -L/usr/lib/mysql -lmysqlclient”

Random thought:  
What do you have in /etc/ld.so.conf.d/mysql-\* ?

JD

---

<div class="post-metadata">

**Author:** ![arleybls](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c77e96/32.png) [@arleybls](https://www.ruby-forum.com/u/arleybls)\
**Post date:** [April 29, 2011, 12:00pm UTC](https://www.ruby-forum.com/t/compile-mysql-with-nginx/206336/3 "2011-04-29T12:00:29Z")

</div>

Hello JD,

Thanks for the feedback.

At the begging I was using the library directly from the mysql website,  
for that matter I indeed created amysal-client.cong file on  
etc/ld.so.conf.d/ and appended the /usr/local/lib to it (didnt work).  
Couple of tries later, installed the package yum mysal-devel and it  
created a sencond file point to its lib version, so basically right now  
this is what I have:

[root@localhost ld.so.conf.d]# more mysql-i386.conf  
/usr/lib/mysql  
[root@localhost ld.so.conf.d]# more mysql-client.conf  
/usr/local/lib

each dir refers to a different version of the libs, I removed  
mysql-client and gave it a shot, no dice, stills fail…

Cheers,  
Arley

Posted at Nginx Forum:

> **[Re: Compile MySql with Nginx](https://forum.nginx.org/read.php?2,194220,194421#msg-194421)**
>
> Hello Everyone, Tough I have moderate C programming skills, I.m kindy new to linux&nginx development, so please excuse any nub questions... Im having a problem linking mysql client libraries with nginx, libraries are there and were installed with...

---

<div class="post-metadata">

**Author:** ![arleybls](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c77e96/32.png) [@arleybls](https://www.ruby-forum.com/u/arleybls)\
**Post date:** [April 29, 2011, 1:06pm UTC](https://www.ruby-forum.com/t/compile-mysql-with-nginx/206336/4 "2011-04-29T13:06:35Z")

</div>

Nope, 32bit

Linux localhost.localdomain 2.6.18-238.5.1.el5.centos.plus #1 SMP Mon  
Apr 4 18:35:33 EDT 2011 i686 i686 i386 GNU/Linux

☹

Posted at Nginx Forum:

> **[Re: Compile MySql with Nginx](https://forum.nginx.org/read.php?2,194220,194436#msg-194436)**
>
> Hello Everyone, Tough I have moderate C programming skills, I.m kindy new to linux&nginx development, so please excuse any nub questions... Im having a problem linking mysql client libraries with nginx, libraries are there and were installed with...

---

<div class="post-metadata">

**Author:** ![arleybls](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c77e96/32.png) [@arleybls](https://www.ruby-forum.com/u/arleybls)\
**Post date:** [April 29, 2011, 7:10pm UTC](https://www.ruby-forum.com/t/compile-mysql-with-nginx/206336/5 "2011-04-29T19:10:54Z")

</div>

Ok, definitly there’s something wrong going on here on the  
makefile(!?)…

I did a quick helloworld.c and compiled along with the very same library  
with sucess:

* * *

[root@localhost C tmp]# ll  
total 4  
-rwxr–r-- 1 root root 53 Apr 29 05:09 main.c  
[root@localhost C tmp]# gcc main.c -L/usr/lib/mysql -lmysqlclient -o  
hellowithlib  
main.c: In function âmainâ:  
main.c:3: warning: incompatible implicit declaration of built-in  
function âprintfâ  
[root@localhost C tmp]# ll  
total 12  
-rwxr-xr-x 1 root root 5160 Apr 29 05:10 hellowithlib  
-rwxr–r-- 1 root root 53 Apr 29 05:09 main.c  
[root@localhost C tmp]# ./hellowithlib

Hello word!!

---

<div class="post-metadata">

**Author:** ![arleybls](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c77e96/32.png) [@arleybls](https://www.ruby-forum.com/u/arleybls)\
**Post date:** [April 29, 2011, 12:48pm UTC](https://www.ruby-forum.com/t/compile-mysql-with-nginx/206336/6 "2011-04-29T12:48:40Z")

</div>

From: arleybls [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> [root@localhost ld.so.conf.d]# more mysql-i386.conf  
> /usr/lib/mysql  
> [root@localhost ld.so.conf.d]# more mysql-client.conf  
> /usr/local/lib  
> each dir refers to a different version of the libs, I removed  
> mysql-client and gave it a shot, no dice, stills fail…

64bits machine by any chance…?

JD
