---
title: "安装googlepreftools与nginx问题"
author: "ssxxjjii"
date: "2011-11-03T11:07:51Z"
tags: []
categories: ["开源软件"]
slug: "googlepreftools-nginx"
draft: false
lastmod: "2011-11-03T11:07:51Z"
id: 1233177
url: "https://tdcq.iteye.com/blog/1233177"
---

prefix指定路径方式安装googlepreftools后再次安装nginx 时启用googlepreftools功能时候报找不到googlepreftools lib包。。

异常：

./configure: error: the Google perftool module requires the Google perftools  
library. You can either do not enable the module or install the library.

问题原因是：nginx在使用googlepreftools插件时候conf中默认使用了usr/local安装路径。没有采用变量形式。故我们自定义安装路径的googlepreftools。nginx在安装时候会找不到其位置。解决办法要么googlepreftools默认安装 。要么修改 nginx tar包中的这个文件  
nginx/auto/lib/google-perftools/conf，把其中的“/usr/local" 全部替换成你的google-perftools的路径，比如：/opt/google-perftools

再次安装 nginx成功 ！

./configure --user=shi\_nginx --group=shi\_nginx --with-http\_ssl\_module --with-http\_flv\_module --with-http\_gzip\_static\_module --with-http\_stub\_status\_module --with-google\_perftools\_module --prefix=/opt/nginx-1.0.8

 

make 

make install

make clean

 

\-------------------------------------------

我修改后的conf文件【/root/nginx-1.0.8/auto/lib/google-perftools、conf】

 

```
# Copyright (C) Igor Sysoev


    ngx_feature="Google perftools"
    ngx_feature_name=
    ngx_feature_run=no
    ngx_feature_incs=
    ngx_feature_path=
    ngx_feature_libs="-lprofiler"
    ngx_feature_test="ProfilerStop()"
    . auto/feature


if [ $ngx_found = no ]; then

    # FreeBSD port

    ngx_feature="Google perftools in /opt/googleperftools/"

    if [ $NGX_RPATH = YES ]; then
        ngx_feature_libs="-R/opt/googleperftools/lib -L/opt/googleperftools/lib -lprofiler"
    else
        ngx_feature_libs="-L/opt/googleperftools/lib -lprofiler"
    fi

    . auto/feature
fi


if [ $ngx_found = yes ]; then
    CORE_LIBS="$CORE_LIBS $ngx_feature_libs"

else

cat << END

$0: error: the Google perftool module requires the Google perftools
library. You can either do not enable the module or install the library.

END

    exit 1
fi
```