# Fail to complie nginx with google-perftools

**URL:** <https://www.ruby-forum.com/t/fail-to-complie-nginx-with-google-perftools/210278>\
**Category:** NGINX\
**Created:** [August 4, 2011, 3:03am UTC](https://www.ruby-forum.com/t/fail-to-complie-nginx-with-google-perftools/210278 "2011-08-04T03:03:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [August 4, 2011, 3:03am UTC](https://www.ruby-forum.com/t/fail-to-complie-nginx-with-google-perftools/210278/1 "2011-08-04T03:03:44Z")

</div>

I compile nginx with google-perftools 1.8.1

```
./configure --with-cc-opt=-ltcmalloc
make

```

It fail in 1.0.2 ~ 1.1.0 :  
objs/src/core/ngx\_shmtx.o: In function `ngx_shmtx_unlock': /root/nginx-1.1.0/src/core/ngx_shmtx.c:170: undefined reference to`sem\_post’  
objs/src/core/ngx\_shmtx.o: In function `ngx_shmtx_lock': /root/nginx-1.1.0/src/core/ngx_shmtx.c:115: undefined reference to`sem\_wait’  
objs/src/core/ngx\_shmtx.o: In function `ngx_shmtx_destory': /root/nginx-1.1.0/src/core/ngx_shmtx.c:46: undefined reference to`sem\_destroy’  
objs/src/core/ngx\_shmtx.o: In function `ngx_shmtx_create': /root/nginx-1.1.0/src/core/ngx_shmtx.c:27: undefined reference to`sem\_init’

---

<div class="post-metadata">

**Author:** ![Wendal\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/e19b73/32.png) [@Wendal\_C](https://www.ruby-forum.com/u/Wendal_C)\
**Post date:** [August 4, 2011, 3:40am UTC](https://www.ruby-forum.com/t/fail-to-complie-nginx-with-google-perftools/210278/2 "2011-08-04T03:40:12Z")

</div>

Hello!

On Thu, Aug 04, 2011 at 09:03:01AM +0800, Wendal C. wrote:

> I compile nginx with google-perftools 1.8.1
> 
> ```
> ./configure --with-cc-opt=-ltcmalloc
> 
> ```

You’ve passed “-ltcmalloc” as compiler flag, while it’s linker  
one. The only effect that it confuses ./configure which does  
compile and link in one step while doing tests.

If you want to build nginx with tcmalloc library linked, use

```
./configure --with-ld-opt=-ltcmalloc

```

instead.

Maxim D.

---

<div class="post-metadata">

**Author:** ![Wendal\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/e19b73/32.png) [@Wendal\_C](https://www.ruby-forum.com/u/Wendal_C)\
**Post date:** [August 4, 2011, 6:00am UTC](https://www.ruby-forum.com/t/fail-to-complie-nginx-with-google-perftools/210278/3 "2011-08-04T06:00:44Z")

</div>

It works!!

Thank you

2011/8/4 Maxim D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
