整合编译mysql和tcmalloc失败的原因

google-perftools里的tcmalloc比glibc的malloc的分配效率和性能要搞多了,所以经常用来优化。

据说,对mysql大并发下有效的提高性能。。

 

环境 centos 5.3 mysql 5.1.30

 

我编译mysql 的参数是

 

./configure --prefix=/usr/local/mysql --without-debug --with-unix-socket-path=/usr/local/mysql/mysql.sock --with-mysqld-ldflags="-all-static -ltcmalloc" --with-client-ldflags=-all-static --with-extra-charsets=utf8 --with-pthread --enable-thread-safe-client --enable-profiling --enable-assembler CFLAGS="-O3"CXX=g++ CXXFLAGS="-O3"

 

make的时候结果出错。
./configure --prefix=/usr/local/mysql --without-debug --with-unix-socket-path=/usr/local/mysql/mysql.sock --with-client-ldflags=-all-static --enable-assembler --with-extra-charsets=utf8 --with-pthread --enable-thread-safe-client --enable-profiling --enable-assembler CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3" CXX=g++ --with-mysqld-ldflags="-all-static -ltcmalloc"
mysqld.o: In function `set_ports()':
mysqld.cc.text+0x84b): warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/local/lib/libtcmalloc.a(stacktrace.o): In function `GetStackTrace(void**, int, int)':
/home/willko/tools/google-perftools-1.0/src/stacktrace_libunwind-inl.h:65: undefined reference to `_ULx86_64_init_local'
/home/willko/tools/google-perftools-1.0/src/stacktrace_libunwind-inl.h:78: undefined reference to `_ULx86_64_step'
/home/willko/tools/google-perftools-1.0/src/stacktrace_libunwind-inl.h:70: undefined reference to `_ULx86_64_get_reg'
/home/willko/tools/google-perftools-1.0/src/stacktrace_libunwind-inl.h:78: undefined reference to `_ULx86_64_step'
/usr/local/lib/libtcmalloc.a(stacktrace.o): In function `GetStackFrames(void**, int*, int, int)':
/home/willko/tools/google-perftools-1.0/src/stacktrace_libunwind-inl.h:126: undefined reference to `_ULx86_64_init_local'
/home/willko/tools/google-perftools-1.0/src/stacktrace_libunwind-inl.h:130: undefined reference to `_ULx86_64_step'
/home/willko/tools/google-perftools-1.0/src/stacktrace_libunwind-inl.h:130: undefined reference to `_ULx86_64_get_reg'
/home/willko/tools/google-perftools-1.0/src/stacktrace_libunwind-inl.h:139: undefined reference to `_ULx86_64_step'
/home/willko/tools/google-perftools-1.0/src/stacktrace_libunwind-inl.h:139: undefined reference to `_ULx86_64_get_reg'
/home/willko/tools/google-perftools-1.0/src/stacktrace_libunwind-inl.h:137: undefined reference to `_ULx86_64_get_reg'
collect2: ld returned 1 exit status
make[3]: *** [mysqld] Error 1
make[3]: Leaving directory `/home/willko/tools/mysql-5.1.30/sql'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/willko/tools/mysql-5.1.30/sql'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/willko/tools/mysql-5.1.30/sql'
make: *** [all-recursive] Error 1
把--with-mysqld-ldflags="-all-static -ltcmalloc" 改成 --with-mysqld-ldflags="-all-static -ltcmalloc -lunwind"
make 一样出错,只是少了错误。。
原来,mysql的静态模式下是不支持外挂的。
所以必须去掉静态,也就是--with-mysqld-ldflags="-ltcmalloc -lunwind"就可以了。
不过,最后我没选择整合编译的方法。。。

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值