Problem solved by Shawn Chin in Answer 1. And what drives me crazy is that to compile mcrypt extension, only libmcrypt is enough, there is no need to compile mhash and mcrypt :(
我想为 php(RHEL5.1,Intel i5 650)编译 mcrypt 扩展,这是我的程序
# libmcrypt
tar zxf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure --prefix=/home/felix021/lamp/libmcrypt/
make
make install
# mhash
tar jxf mhash-0.9.9.9.tar.bz2
cd mhash-0.9.9.9
./configure --prefix=/home/felix021/lamp/mhash/
make
make install
# mcrypt
LD_LIBRARY_PATH=/home/felix021/lamp/libmcrypt/lib:/home/felix021/lamp/mhash/lib
./configure --prefix=/home/felix021/lamp/mcrypt/ \
--with-libmcrypt-prefix=/home/felix021/lamp/libmcrypt
配置失败提示:
checking for mhash_keygen in -lmhash... no
configure: error: "You need at least libmhash 0.8.15 to compile this program. \
http://mhash.sf.net/"
于是我下载了mhash0.8.18和mhash0.8.15,但是还是出现同样的错误。
我在 0.8.15/8 中查找了“mhash_keygen”:
int mhash_keygen(xxx,xxx,xxx)
它在 0.9.9.9 中:
#if defined(PROTOTYPES)
mutils_error mhash_keygen(keygenid algorithm, ....)
#else
mutils_error mhash_keygen();
#endif
//typedef uint32 mutils_error
但是,mcrypt-2.6.8/configure +12114,它是:
char mhash_keygen ();
我在配置中将“char”更改为“mutils_error”,错误仍然出现。
我还能做些什么......?
感谢阅读我的 loooooooong 问题。
最佳答案
我在 RHEL5 机器上回溯了您的步骤,但确实遇到了同样的错误。
从 config.log
看,似乎找不到 libmhash
。
configure:12093: checking for mhash_keygen in -lmhash
configure:12128: gcc -o conftest -g -O2 conftest.c -lmhash >&5
/usr/bin/ld: cannot find -lmhash
collect2: ld returned 1 exit status
应该有一个更简洁的方法来做到这一点,但我设法通过提供 lib
和 include
来配置和编译 mcrypt mhash 的目录,通过额外的 CFLAGS
和 LDFLAGS
。
# mcrypt
export LD_LIBRARY_PATH=/home/felix021/lamp/libmcrypt/lib:/home/felix021/lamp/mhash/lib
export LDFLAGS="-L/home/felix021/lamp/mhash/lib/ -I/home/felix021/lamp/mhash/include/"
export CFLAGS="-I/home/felix021/lamp/mhash/include/"
./configure --prefix=/home/felix021/lamp/mcrypt/ \
--with-libmcrypt-prefix=/home/felix021/lamp/libmcrypt
关于php - 无法编译 mcrypt(配置失败 : mhash_keygen in -lmhash. .. 否),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6383492/