mac下编译mcrypt的时候总是报错,

起初提示

rm: conftest.dSYM: is a directory

checking if gcc supports -fno-rtti -fno-exceptions... yes

checking for gcc option to produce PIC... -fno-common -DPIC

checking if gcc PIC flag -fno-common -DPIC works... yes

checking if gcc static flag -static works... no

checking if gcc supports -c -o file.o... yes

checking if gcc supports -c -o file.o... (cached) yes

checking whether the gcc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes

checking dynamic linker characteristics... darwin15.3.0 dyld

checking how to hardcode library paths into programs... immediate

checking whether stripping libraries is possible... yes

checking if libtool supports shared libraries... yes

checking whether to build shared libraries... yes

checking whether to build static libraries... yes

checking for gcc... (cached) gcc

checking whether we are using the GNU C compiler... (cached) yes

checking whether gcc accepts -g... (cached) yes

checking for gcc option to accept ISO C89... (cached) none needed

checking dependency style of gcc... (cached) gcc3

checking for libmcrypt-config... /usr/local/mnmp/libmcrypt//bin/libmcrypt-config

checking for libmcrypt - version >= 2.5.0... yes

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

通过增加环境变量搞定了

export LD_LIBRARY_PATH=/usr/local/mnmp/libmcrypt/lib/:/usr/local/mnmp/mhash/lib/

export LDFLAGS="-L/usr/local/mnmp/mhash/lib/ -I/usr/local/mnmp/mhash/include"

export CFLAGS="-I/usr/local/mnmp/mhash/include/"


然后提示文件找不到

通过修改源码搞定


#include <malloc.h>

改为

#include <stdlib.h>