首页 > 开发 > php > 正文

编译mcrypt出错,mhash怎么都对不上(已解决)

2017-09-06 15:07:40  来源:网友分享

想自己编译安装php的mcrypt扩展

# libmcrypttar zxf libmcrypt-2.5.8.tar.gzcd libmcrypt-2.5.8./configure --prefix=/home/felix021/lamp/libmcrypt/makemake install# mhashtar jxf mhash-0.9.9.9.tar.bz2cd mhash-0.9.9.9./configure --prefix=/home/felix021/lamp/mhash/makemake install# mcryptLD_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

configure不通过,提示:

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,依然是这个错误。

查了一下mhash_keygen这个函数,在0.8.15/8中是
int mhash_keygen(xxx,xxx,xxx)
在 0.9.9.9 中是

#if defined(PROTOTYPES)mutils_error mhash_keygen(keygenid algorithm, ....)#elsemutils_error mhash_keygen();#endif

(mutils_error是typedef的uint32)

而mcrypt的configure里头12114行用来测试的是

char mhash_keygen ();

即使把char改成 mutils_error 也还是不行。

求解。

解决方案

问题解决了,StackOverflow上面的大牛指出,在编译mcrypt之前需要在LDFLAGS中给出-L和-I

export LD_LIBRARY_PATH=/home/felix021/lamp/libmcrypt/lib:/home/felix021/lamp/mhash/libexport 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

参见 http://stackoverflow.com/questions/63...