Thursday, March 19, 2009

Compile MySQL - Error: shared library "lthread.[35]" does not exist

Error: shared library "lthread.[35]" does not exist

作者: 星夜如雨
今天心血來潮(颱風天無聊)!
正在把把測試機的 mysql 更新到新版重編卻碰到了下面這個 Error

/bin/cat /usr/ports/devel/linuxthreads/pkg-message
Please see the README.FreeBSD file in the work directory for
instructions on how to compile with linuxthreads, and for other
issues and problems.
===> Registering installation for linuxthreads-2.2.3_23
===> Returning to build of mysql-server-5.0.67
Error: shared library "lthread.[35]" does not exist
*** Error code 1

Stop in /usr/ports/databases/mysql50-server.

一般習慣 FreeBSD 用 ports 安裝 MySQL 時會加的兩個參數 WITH_LINUXTHREADS=yes BUILD_STATIC=yes
資料中寫到

從FreeBSD5.x以後的版本下不用LINUXTHREAD啦,用libthr可以得到更好的性能,但是要編譯成動態模式,因此安裝的時候不要再帶這兩個選項了

在6.x上用這兩個選項還是可以安裝的,7.0開始就不行了


配置線程庫為libthr.so:
# ee /etc/libmap.conf

[mysqld]
libpthread.so.2 libthr.so.2
libpthread.so libthr.so

重啟MySQL。檢查

# ldd /usr/local/libexec/mysqld
/usr/local/libexec/mysqld:
libz.so.4 => /lib/libz.so.4 (0x48662000)
libwrap.so.5 => /usr/lib/libwrap.so.5 (0x48674000)
libcrypt.so.4 => /lib/libcrypt.so.4 (0x4867b000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x48694000)
libm.so.5 => /lib/libm.so.5 (0x48780000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x48798000)
libthr.so.3 => /lib/libthr.so.3 (0x487a2000)
libc.so.7 => /lib/libc.so.7 (0x487b4000)
可以看到:libthr.so.3 => /lib/libthr.so.3 (0x487a2000)

代表OK了!


補充
kernel打開SCHED_ULE/PREEMPTION 可得更好效能

No comments: