apache2 build在yocto中失败 - “/ usr / local / include”对于交叉编译是不安全的[-Wpoison-system-directories]

时间:2016-06-13 22:10:03

标签: apache build autotools yocto openembedded

我试图在yocto上构建apache2。 但是我遇到了错误。

  

错误:此autoconf日志指示错误,它在确定系统功能时查看主机包含和/或库路径。   修复此问题后重新运行配置任务。

一些谷歌搜索引导我 https://lists.yoctoproject.org/pipermail/yocto/2012-March/005125.html

所以我调查了conf.log并找出了这些内容:

cc1: warning: include location "/usr/local/include" is unsafe for
cross-compilation [-Wpoison-system-directories]

arm-poky-linux-gnueabi/4.9.2/ld: warning: library search path "/usr/local/lib" 
is unsafe for cross-compilation

我再次搜索,但我还无法理解3件事:

  1. 为什么PATH已设置为本地路径?
  2. 为什么只有在构建apache2 [我可以构建ngnixcryptsetup等等时才会出现此错误。]
  3. 我该如何解决?

1 个答案:

答案 0 :(得分:0)

通常,这些类型的错误来自配置脚本,这些脚本具有硬编码到其中的路径(如/usr/local/include/usr/include和各种其他变体)。因此修复它的方法是修补configure.ac(如果包中有一个,当然,configure,否则)删除此路径。

例如,从当前的meta-oe看一下patch for pure-ftpd,它解决了类似的问题:

--- a/configure.ac
+++ b/configure.ac
@@ -100,18 +100,6 @@ AC_ARG_VAR(PYTHON,local path to the python interpreter)
 python_possible_path="/usr/bin:/usr/local/bin:/bin:/opt/python/bin:/opt/python/usr/bin:/opt/python/usr/local/bin"
 AC_PATH_PROG(PYTHON,python,/usr/bin/env python,$python_possible_path)

-if test -d /usr/local/include; then
-  CPPFLAGS="$CPPFLAGS -I/usr/local/include"
-fi
-
-if test -d /usr/kerberos/include; then
-  CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
-fi
-
-if test -d /usr/local/lib; then
-  LDFLAGS="$LDFLAGS -L/usr/local/lib"
-fi
-
 CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"

 dnl Checks for header files