【问题标题】:Modifying autoconf to properly locate header修改 autoconf 以正确定位标头
【发布时间】:2013-08-13 02:35:13
【问题描述】:

情况是我正在尝试获取从 Internet (http://findingscience.com/pymur/) 下载的代码进行编译,而我正在使用的机器上没有 SUDO 权限。

我已将问题追溯到 configure.ac 中的一行:

AC_CHECK_HEADER([indri/Index.hpp],,[
   AC_MSG_ERROR([Could not find lemur's header files.])
])

因为我收到了来自./configure 的错误消息:

checking indri/Index.hpp usability... no
checking indri/Index.hpp presence... no
checking for indri/Index.hpp... no
configure: error: Could not find lemur's header files.

我尝试直接修改它,使 indri/Index.hpp 具有像 /path/to/indri/Index.hpp 这样的硬编码路径,这似乎没有帮助。

任何无需我修改 /usr 等目录(因为我没有 root 权限)即可编译代码的解决方案将不胜感激。

【问题讨论】:

  • ./configure --prefix=/path/to 不起作用?你在修改什么? configure 的运行情况如何?
  • @ldav1s 前缀选项不起作用。我正在直接修改configure.ac 文件,这是autoconf 用来生成configure 文件的文件。
  • 修改configure.ac 绝对是错误的做法。在您的主目录中安装标头并适当设置CPPFLAGS

标签: configure autoconf


【解决方案1】:

您绝对不需要或不想修改configure.ac。只需将头文件安装在您确实具有写入权限的位置并告诉配置脚本如何找到它们。例如,如果您将头文件安装在 HOME 目录中(以便 $HOME/include/indri/Index.hpp 存在),则运行:

configure CPPFLAGS=-I$HOME/include

这应该适用于大多数平台。请注意,使用路径 /path/to/indri/Index.hpp 修改 configure.ac 将失败,因为您的工具链将使用该路径作为相对路径,并且可能正在寻找像 /usr/include/path/to/indri/Index.hpp 这样的地方。

【讨论】:

    【解决方案2】:

    通常,我会按照 William Pursell 的建议去做。不幸的是,这行不通。我尝试过这个。 pymur 包中有一个错误,其中configure.ac 依赖于一个非常旧 版本的AC_PYTHON_DEVEL 宏,在检查CPPFLAGS 之前会破坏indri/Index.hpp,所以这些目录不会在@ 987654326@命令行。

    如果您想解决这个问题,您必须从 Autoconf 宏存档中获取更多 updated version of that macro 并将其复制到 acinclude.d(在删除 acinclude.d/ac_python_devel.m4 之后)并重新运行 autogen.sh。我能够调用CPPFLAGS="-I /path/to/indri/include" ./configure 并且不会让它绊倒那个特定的问题。

    这确实是 pymur 维护者应该修复的问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-04-17
      • 2013-05-13
      • 2014-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多