linux 正确的标志以传递 gcc mcrypt.h 位置
linux correct flag to pass gcc mcrypt.h location
我已将 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
当我使用以下选项为 php7 尝试 ./configure 时,我收到一条错误消息 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
让我们看看这个错误在 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
不是 "no" 那么它是
DIR
根据 --with-mcrypt[=DIR]
的值,即目录
路径或什么都没有。
如果没有,则在以下位置查找 mcrypt.h
:
/usr/local/include
(libmcrypt
默认安装 make install
)
/usr/include
(libmcrypt
由发行包管理器安装)
如果不是什么都没有,那么 mcrypt.h
会另外(并且优先)查看
对于:
$PHP_MCRYPT/include
(libmcrypt
由非默认 make install
安装到 $PHP_MCRYPT
)
因此,如果您指定 --with-mcrypt=DIR
,那么 DIR
应该是您的 安装
libmcrypt
的前缀, 不是包含 libmcrypt.so
.
的目录
所以你的解决方案是,更改:
--with-mcrypt=/home/mybin/lib
至:
--with-mcrypt=/home/mybin
我已将 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
当我使用以下选项为 php7 尝试 ./configure 时,我收到一条错误消息 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
让我们看看这个错误在 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
不是 "no" 那么它是
DIR
根据 --with-mcrypt[=DIR]
的值,即目录
路径或什么都没有。
如果没有,则在以下位置查找 mcrypt.h
:
/usr/local/include
(libmcrypt
默认安装make install
)/usr/include
(libmcrypt
由发行包管理器安装)
如果不是什么都没有,那么 mcrypt.h
会另外(并且优先)查看
对于:
$PHP_MCRYPT/include
(libmcrypt
由非默认make install
安装到$PHP_MCRYPT
)
因此,如果您指定 --with-mcrypt=DIR
,那么 DIR
应该是您的 安装
libmcrypt
的前缀, 不是包含 libmcrypt.so
.
所以你的解决方案是,更改:
--with-mcrypt=/home/mybin/lib
至:
--with-mcrypt=/home/mybin