linux正确标志通过gcc mcrypt.h位置 [英] linux correct flag to pass gcc mcrypt.h location

查看:138
本文介绍了linux正确标志通过gcc mcrypt.h位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将 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为php7使用下面的选项,我得到一个错误信息 configure:error:mcrypt.h not found。请重新安装libmcrypt。



我使用不正确的标志告诉gcc查看 ../ include 目录 mcrypt.h

  ./配置\ 
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

$ <$ p $ <$ p $ <$ p $ >

 一些有影响的环境变量:
CC C编译器命令
CFLAGS C编译器标志
LDFLAGS链接器标志,例如-L< lib dir>如果你有一个
非标准目录中的库< lib dir>
LIBS库传递给链接器,例如-l< library>
CPPFLAGS(Objective)C / C ++预处理器标志,例如。 -I< include dir>如果
在非标准目录中有标题< include dir>
CPP C预处理器
YACC要使用的另一个编译器编译器实现。
默认为第一个程序:`bison -y',`byacc',
`yacc'。
YFLAGS将默认传递给$ YACC的参数列表。
此脚本将默认YFLAGS为空字符串,以避免某些make应用程序给出的
默认值`-d'。
CXX C ++编译器命令
CXXFLAGS C ++编译器标志
CXXCPP C ++预处理器

微调安装目录:
--bindir = DIR用户可执行文件[ EPREFIX / bin]
--sbindir = DIR系统管理可执行文件[EPREFIX / sbin]
--libexecdir = DIR程序可执行文件[EPREFIX / libexec]
--sysconfdir = DIR只读单 - 机器数据[PREFIX / etc]
--sharedstatedir = DIR可修改架构无关数据[PREFIX / com]
--localstatedir = DIR可修改的单机数据[PREFIX / var]
--libdir = DIR目标代码库[EPREFIX / lib]
--includedir = DIR C头文件[PREFIX / include]
--oldincludedir = DIR用于非gcc的头文件[/ usr / include]
--datarootdir = DIR只读arch.独立数据根[PREFIX / share]
--datadir = DIR只读架构无关数据[DATAROOTDIR]
- infodir = DIR信息文档[DATAROOTDIR / info]
--localedir = DIR语言环境相关数据[DATAROOTDIR / locale]
--mandir = DIR man documentation [DATAROOTDIR / man]
- docdir = DIR文档根[DATAROOTDIR / doc / PACKAGE]
--htmldir = DIR html文档[DOCDIR]
--dvidir = DIR dvi文档[DOCDIR]
--pdfdir = DIR pdf文档[DOCDIR]
--psdir = DIR ps文档[DOCDIR]

--with-mcrypt = DIR包括mcrypt支持

  php-7.0.4 $ grep -r'mcrypt.h找不到。请重新安装libmcrypt'
ext / mcrypt / config.m4:AC_MSG_ERROR(找不到mcrypt.h,请重新安装libmcrypt。)
configure:as_fn_error $? mcrypt.h not found。请重新安装libmcrypt。 $ LINENO5

我们可以忽略 configure 因为它是一个生成的文件,所以它是从 m4
ext / mcrypt / config.m4 。让我们看一下上下文:

  ... 
if test$ PHP_MCRYPT!=no;那么
for i in $ PHP_MCRYPT / usr / local / usr; do
test -f $ i / include / mcrypt.h&& MCRYPT_DIR = $ i&&& break
done

如果test -z$ MCRYPT_DIR;然后
AC_MSG_ERROR(找不到mcrypt.h,请重新安装libmcrypt。)
fi
...

现在都变得清楚了。如果 $ PHP_MCRYPT 不是否,那么它的
DIR $ c> - with-mcrypt [= DIR]
,即目录
路径或没有。



mcrypt.h




  • usr / local / include ( libmcrypt 是由默认安装 make install li>
  • / usr / include libmcrypt 由distro软件包管理器安装) / li>


如果不是什么,那么 mcrypt.h
中查找:




  • $ PHP_MCRYPT / include c $ c> 安装到非默认 make install $ PHP_MCRYPT



因此,如果您指定 - with-mcrypt = DIR DIR 应为您的安装
前缀
libmcrypt not包含 libmcrypt.so 的目录。





   -  with-mcrypt = / home / mybin / lib 

到:

   -  with-mcrypt = / home / mybin 


I have compiled libmcrypt from source to /home/mybin/... with the following confirmed as the location of the needed files.

/home/mybin/include/mcrypt.h
/home/mybin/include/mutils/mcrypt.h
/home/mybin/lib/libmcrypt.so ...> 4.4.8
/home/mybin/bin/libmcrypt-config

When I try a ./configure for php7 using the below options, I get an error message configure: error: mcrypt.h not found. Please reinstall libmcrypt.

What flags am I using incorrectly to tell gcc to look in the ../include directory for 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

from the configure --help I get

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

解决方案

Let's see where this error comes from in the php7 source tree:

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

We can ignore configure since it's a generated file, so it's from that m4 macro ext/mcrypt/config.m4. Let's look at the context:

...
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
...

Now all becomes clear. If $PHP_MCRYPT isn't "no" then its the value of DIR as per --with-mcrypt[=DIR], i.e. a directory path or nothing.

If it's nothing then mcrypt.h is looked for in:

  • /usr/local/include (libmcrypt was installed by a default make install)
  • /usr/include (libmcrypt was installed by the distro package manager)

If it's not nothing then mcrypt.h is additionally (and for preference) looked for in:

  • $PHP_MCRYPT/include (libmcrypt was installed by a non-default make install to $PHP_MCRYPT)

So if you specify --with-mcrypt=DIR, then DIR should be your installation prefix for libmcrypt, not the directory containing libmcrypt.so.

So your solution is, change:

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

to:

--with-mcrypt=/home/mybin

这篇关于linux正确标志通过gcc mcrypt.h位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆