【问题标题】:./configure cannot locate header file when the directory is specified with CPPFLAGS当使用 CPPFLAGS 指定目录时,./configure 无法找到头文件
【发布时间】:2014-02-05 13:17:30
【问题描述】:

我正在尝试在 Mac OS X Mavericks 上构建 php gettext 模块。

使用brew install gettext 安装gettext,并在/usr/local/opt/gettext 上提供检查的头文件。

$ ls /usr/local/opt/gettext/include/
autosprintf.h   gettext-po.h    libintl.h

How to override environment variables when running configure? 帖子的帮助下,我执行了./configure LDFLAGS='-L/usr/local/opt/gettext/lib/' CPPFLAGS='-I/usr/local/opt/gettext/include/' 以获取此错误消息。

checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.13.6 (ok)
checking for gawk... gawk
checking for GNU gettext support... yes, shared
configure: error: Cannot locate header file libintl.h <--

这有什么问题?为什么我指定目录时configure找不到头文件?

【问题讨论】:

  • CFLAGS='-I/usr/local/opt/gettext/include/' 怎么样?
  • @falsetru:我收到了与 CFLAGS 设置相同的错误消息。
  • 虽然链接的答案说您可以将它们作为论据传递给configure,但您可能还想尝试将它们放在之前 ./configure。这是为一个命令运行设置环境变量的典型 Unix 模式。所以我建议尝试:CPPFLAGS=blahblah ./configure。如果 that 不起作用,请尝试导出变量设置:export CPPFLAGS=blahblah,然后运行./configure。希望其中一个可以解决问题。
  • @verdammelt:不幸的是,这些技巧都不起作用。

标签: php macos unix gettext configure


【解决方案1】:

查看 ./configure 脚本,我注意到该脚本没有查看我提供的环境变量。我刚刚修改了脚本(第 4067 行)以使其工作。

if test "$PHP_GETTEXT" != "no"; then
  for i in $PHP_GETTEXT /usr/local /usr /usr/local/opt/gettext; do
    test -r $i/include/libintl.h && GETTEXT_DIR=$i && break
  done

【讨论】:

    【解决方案2】:

    编译 php 时,您可以将 --with-gettext=/usr/local/opt/gettext 作为选项传递给配置命令 - 这就是设置 $PHP_GETTEXT 变量的原因。

    【讨论】:

      【解决方案3】:

      一般需要在'/usr/include'中指定引入文件的目录

      if test -f "/usr/include/WeWorkFinanceSdk_C.h" && test -f 
      "/usr/include/libWeWorkFinanceSdk_C.so"; then
      AC_MSG_RESULT(yes)
      else
       AC_MSG_ERROR(cannot find WeWorkFinanceSdk_C.h in path ${PHP_WXWORK_FINANCE_SDK})
      fi
      

      【讨论】:

        猜你喜欢
        • 2013-04-21
        • 2016-01-01
        • 1970-01-01
        • 2013-08-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-01-17
        • 1970-01-01
        相关资源
        最近更新 更多