php - 无法编译 mcrypt(配置失败 : mhash_keygen in -lmhash. .. 否)

标签 php linux mcrypt

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

应该有一个更简洁的方法来做到这一点,但我设法通过提供 libinclude 来配置和编译 mcrypt mhash 的目录,通过额外的 CFLAGSLDFLAGS

# 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/

相关文章:

javascript - JS 对象到 PHP,然后通过 PDO INSERT

php - Docker-php-ext-install mcrypt 缺少文件夹

php - 如何让 MCrypt 和 PHP 在 CentOS 上协同工作

php - 混淆了 JavaScript 和 PHP 的时区

php - 如何使用 Instagram 的 API 获取媒体 ID

c - 如何为 mmap() 禁用写时复制和按需填零

linux - 查找文件并移动其文件夹

php - 为什么用 PHP 加密的东西与用 Ruby 加密的相同字符串不匹配?

php - 如何使用netsuite php工具包删除地址簿中的客户地址

linux - 用于检查远程服务器进程的 Perl 脚本