Php linux传递gcc mcrypt.h位置的正确标志

Php linux传递gcc mcrypt.h位置的正确标志,php,c++,linux,gcc,php-7,Php,C++,Linux,Gcc,Php 7,我已将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:mcry

我已将
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。请重新安装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
I获取

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
一些有影响的环境变量:
CC编译器命令
CFLAGS C编译器标志
LDFLAGS链接器标志,例如,-L,如果在
非标准目录
要传递给链接器的LIBS库,例如-l
CPPFLAGS(目标)C/C++预处理器标志,例如-I if
在非标准目录中有标题
cppc预处理器
YACC是要使用的“另一个编译器”实现。
默认为找到的第一个程序:`bison-y',`byacc',
`yacc’。
yFlag默认情况下将传递给$YACC的参数列表。
此脚本将默认YFLAGS为空字符串,以避免
某些make应用程序给出的默认值为“-d”。
CXC++编译命令
CXFLAGS C++编译器标志
CXCPP C++预处理器
安装目录的微调:
--bindir=DIR用户可执行文件[EPREFIX/bin]
--sbindir=DIR系统管理可执行文件[EPREFIX/sbin]
--libexecdir=DIR程序可执行文件[EPREFIX/libexec]
--sysconfdir=DIR只读单机数据[前缀/etc]
--sharedstatedir=DIR可修改体系结构独立数据[PREFIX/com]
--localstatedir=DIR可修改的单机数据[前缀/var]
--libdir=DIR对象代码库[EPREFIX/lib]
--includedir=DIR C头文件[前缀/包含]
--oldincludedir=DIR非gcc的C头文件[/usr/include]
--datarootdir=DIR只读arch.-独立数据根[前缀/共享]
--datadir=DIR只读架构独立数据[DATAROOTDIR]
--infodir=DIR信息文档[DATAROOTDIR/info]
--localedir=DIR依赖于区域设置的数据[DATAROOTDIR/locale]
--mandir=DIR-man文档[DATAROOTDIR/man]
--docdir=DIR文档根目录[DATAROOTDIR/doc/PACKAGE]
--htmldir=DIR html文档[DOCDIR]
--dvidir=DIR dvi文档[DOCDIR]
--pdfdir=DIR pdf文档[DOCDIR]
--psdir=DIR ps文档[DOCDIR]
--使用mcrypt=DIR包括mcrypt支持

让我们看看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\u MCRYPT
不是“否”,那么它就是
DIR
的值符合
——带有mcrypt[=DIR]
,即目录 路径或什么都没有

如果它为空,则在以下位置查找
mcrypt.h

  • /usr/local/include
    libmcrypt
    是默认安装的
    make install
  • /usr/include
    libmcrypt
    由发行版软件包管理器安装)
如果它不是空的,那么会另外(作为首选)查看
mcrypt.h
例如:

  • $PHP\u MCRYPT/include
    libmcrypt
    由非默认的
    make install
    安装到
    $PHP\u MCRYPT
因此,如果您使用mcrypt=DIR指定
,那么
DIR
应该是您的安装
libmcrypt
的前缀,而不是包含
libmcrypt.so
的目录

因此,您的解决方案是,改变:

--with-mcrypt=/home/mybin/lib
致:


查看关于该错误的config.log文件,以了解更多有关测试失败原因的信息谢谢你,我认为这是我迄今为止收到的最好的答案。它是清晰的、描述性的,最重要的是没有任何屈尊的暗示。我尝试了几种选项组合,使用mcrypt=/home/mybin
--工作正常,但是使用libdir=DIR的
--也会导致失败。删除
--with libdir
使另一个
--with xxx
也能像您描述的那样工作,包括我的其他问题。Thx艺术,谢谢你。使它有价值;)
--with-mcrypt=/home/mybin