編譯 MySQL 的 “Linux thread not found” 問題

2010-08-09

今日安裝一台新 Server,系統是 RHEL 5,在編譯 MySQL 4.0.x 的時候出現問題: # ./configure –prefix=/opt/app/mysql4 checking “LinuxThreads”… “Not found” configure: error: This is a linux system and Linuxthreads was not found. On linux Linuxthreads should be used. Please install Linuxthreads (or a new glibc) and try again. See the Installation chapter in the Reference Manual for more information. 看來 MySQL 4.0 不支援新核心使用了 NTPL 這種新的線程,最後用了這個方法解決:

cp /usr/include/pthread.h /usr/include/pthread.h.bak
echo '/*Linuxthreads*/' >> /usr/include/pthread.h

然後重新編譯及加入 –with-pthread 及 –with-named-thread-lib 兩個參數:

./configure –with-pthread –with-named-thread-lib=-lpthread
make && make install

這樣就可以正常編譯及安裝 MySQL 4.0 了。