整合编译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的时候结果出错。
引用
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"就可以了。
不过,最后我没选择整合编译的方法。。。

你可能感兴趣的:(sql,mysql,centos,socket,Google)