3

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 :(


I want to compile mcrypt extension for php (RHEL5.1, Intel i5 650), here is my procedure

# 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

configure failed with notice:

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

So I downloaded mhash0.8.18 and mhash0.8.15, but the same error occurred.

I looked up "mhash_keygen" in 0.8.15/8:

int mhash_keygen(xxx,xxx,xxx)

And it's in 0.9.9.9:

#if defined(PROTOTYPES)
mutils_error mhash_keygen(keygenid algorithm, ....)
#else
mutils_error mhash_keygen();
#endif
//typedef uint32 mutils_error

But, mcrypt-2.6.8/configure +12114, it's:

char mhash_keygen ();

I changed "char" to "mutils_error" in configure, the error still appears.

What can I do more....?

Thanks for reading my loooooooong question.

felix021
  • 1,936
  • 3
  • 16
  • 20
  • You still get the error that the version is not matching even you installed the needed versions of the libs? – hakre Jun 17 '11 at 09:03
  • @hakre yes, mhash-0.8.15.tar.gz doesn't solve the problem. – felix021 Jun 17 '11 at 10:45
  • Double-check that configure/make will take your library path(s) and not the system ones. As you already have the correct version, the error can not come up again if you reference the right libs. I think sometimes you need to register libs. Another thing what you can do is to symlink your version in the systems lib directory. I did this once for a game engine that was not supported by my distro: [Getting BennuGD on Fedora 13 to run.](http://hakre.wordpress.com/2011/04/22/getting-bennugd-on-fedora-13-to-run/), look for `ln -s libcrypto.so libcrypto.so.1.0.0` in specific. – hakre Jun 17 '11 at 12:06
  • Thanks, with -I and -L specified in LDFLAGS and CFLAGS, I can compile mcrypt now. – felix021 Jun 18 '11 at 03:14

1 Answers1

5

I've retraced your steps on an RHEL5 box, and did get the same error.

From at config.log, it looks like the libmhash could not be located.

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

There ought to be a cleaner way to do it, but I managed to get mcrypt configured and compiled by providing the lib and include directories for mhash via additional CFLAGS and 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
Shawn Chin
  • 84,080
  • 19
  • 162
  • 191
  • thanks, but it doesn't work :( ... (p.s. I think the --prefix you intended to give should be /home/felix021/lamp/*mhash*, not mcrypt) – felix021 Jun 17 '11 at 10:43
  • ah yes, will fix the typo. Are you still seeing the same error? – Shawn Chin Jun 17 '11 at 10:47
  • @Shawn Chin: unfortunately yes... mhash does not depend on libmcrypt, I compiled it successfully. The problem occurs everytime I run ./configure in mcrypt-2.6.8 – felix021 Jun 17 '11 at 10:50
  • Apologies for misunderstanding the problem. Answer has been updated to address actual problem. – Shawn Chin Jun 17 '11 at 12:13
  • +1, didn't know anything about these flags, I'm quite new to C. – hakre Jun 18 '11 at 09:03