无法编译mcrypt(配置失败:-lmhash中的mhash_keygen ... no)

fel*_*021 3 php linux mcrypt

Shawn Chin在答案1中解决了问题.让我疯狂的是,编译mcrypt扩展,只有libmcrypt就足够了,没有必要编译mhash和mcrypt :(


我想为php编译mcrypt扩展(RHEL5.1,Intel i5 650),这是我的程序

# 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
Run Code Online (Sandbox Code Playgroud)

配置失败并注意到:

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/"
Run Code Online (Sandbox Code Playgroud)

所以我下载了mhash0.8.18和mhash0.8.15,但是发生了同样的错误.

我在0.8.15/8中查找了"mhash_keygen":

int mhash_keygen(xxx,xxx,xxx)
Run Code Online (Sandbox Code Playgroud)

它在0.9.9.9:

#if defined(PROTOTYPES)
mutils_error mhash_keygen(keygenid algorithm, ....)
#else
mutils_error mhash_keygen();
#endif
//typedef uint32 mutils_error
Run Code Online (Sandbox Code Playgroud)

但是,mcrypt-2.6.8/configure +12114,它是:

char mhash_keygen ();
Run Code Online (Sandbox Code Playgroud)

我在配置中将"char"更改为"mutils_error",错误仍然出现.

我还能做些什么......?

感谢您阅读我的loooooooong问题.

Sha*_*hin 5

我已经在RHEL5盒子上回溯了你的步骤,并且确实得到了同样的错误.

从at 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
Run Code Online (Sandbox Code Playgroud)

有应该是做一个更清洁的方式,但我设法mcrypt的配置和编译通过提供libinclude目录中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
Run Code Online (Sandbox Code Playgroud)