我已将libmcrypt
从源代码编译为/home/mybin/...
,并将以下内容确认为所需文件的位置。
/home/mybin/include/mcrypt.h
/home/mybin/include/mutils/mcrypt.h
/home/mybin/lib/libmcrypt.so ...> 4.4.8
/home/mybin/bin/libmcrypt-config
当我使用以下选项尝试./configure for php7时,收到错误消息configure: error: mcrypt.h not found. Please reinstall libmcrypt.
我使用了哪些标记错误地告诉gcc查看../include
目录mcrypt.h
./configure \
CC=/home/mybin/bin/gcc \
CPPFLAGS="-I/home/mybin/include" \
LDFLAGS="-L/home/mybin/lib" \
LIBS="-lmcrypt" \
--prefix=/home/_cgi/php7 \
--bindir=/home/mybin/bin \
--libdir=/home/mybin/lib \
--includedir=/home/mybin/include \
--with-mcrypt=/home/mybin/lib
来自configure --help
我
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
YACC The `Yet Another Compiler Compiler' implementation to use.
Defaults to the first program found out of: `bison -y', `byacc',
`yacc'.
YFLAGS The list of arguments that will be passed by default to $YACC.
This script will default YFLAGS to the empty string to avoid a
default value of `-d' given by some make applications.
CXX C++ compiler command
CXXFLAGS C++ compiler flags
CXXCPP C++ preprocessor
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
--psdir=DIR ps documentation [DOCDIR]
--with-mcrypt=DIR Include mcrypt support
答案 0 :(得分:6)
让我们看看这个错误来自php7源代码树:
php-7.0.4$ grep -r 'mcrypt.h not found. Please reinstall libmcrypt'
ext/mcrypt/config.m4: AC_MSG_ERROR(mcrypt.h not found. Please reinstall libmcrypt.)
configure: as_fn_error $? "mcrypt.h not found. Please reinstall libmcrypt." "$LINENO" 5
我们可以忽略configure
,因为它是生成的文件,所以它来自m4
宏ext/mcrypt/config.m4
。我们来看看上下文:
...
if test "$PHP_MCRYPT" != "no"; then
for i in $PHP_MCRYPT /usr/local /usr; do
test -f $i/include/mcrypt.h && MCRYPT_DIR=$i && break
done
if test -z "$MCRYPT_DIR"; then
AC_MSG_ERROR(mcrypt.h not found. Please reinstall libmcrypt.)
fi
...
现在一切都变得清晰了。如果$PHP_MCRYPT
不是“不”那么它就是
根据{{1}}的{{1}}的值,即目录
路径或没有。
如果没有,那么在DIR
寻找:
--with-mcrypt[=DIR]
(mcrypt.h
由默认/usr/local/include
)libmcrypt
(make install
由发行包管理器安装)如果它不是什么都是/usr/include
另外(并且优先)看
for in:
libmcrypt
(mcrypt.h
由非默认$PHP_MCRYPT/include
安装到libmcrypt
)因此,如果您指定make install
,那么$PHP_MCRYPT
应该是您的安装
--with-mcrypt=DIR
的前缀,不是包含 DIR
的目录。
所以你的解决方案是,改变:
libmcrypt
为:
libmcrypt.so