apache2 build fails in yocto - “/usr/local/include” is unsafe for cross-compilation [-Wpoison-system-directories]

天大地大妈咪最大 提交于 2021-02-08 10:12:56

问题


I was trying to build apache2 on yocto. But I was getting below errors.

ERROR: This autoconf log indicates errors, it looked at host include and/or library paths while determining system capabilities. Rerun configure task after fixing this.

Some googling led me to https://lists.yoctoproject.org/pipermail/yocto/2012-March/005125.html

So I looked into conf.log and find out those lines:

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

I googled again but, I couldn't understand 3 things yet:

  1. Why has the PATH been set to local path ?
  2. Why does this error only come when building apache2 [ I can build ngnix, cryptsetup, etc..]
  3. How can I fix it?

回答1:


Usually these types of errors come from configure scripts that have paths (like /usr/local/include, /usr/include and all sorts of other variations) hardcoded into them. So the way to fix it is to patch configure.ac (if there is one in the package, of course, configure otherwise) removing this paths.

For example, take a look at patch for pure-ftpd from current meta-oe, it solves similar problem:

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


来源:https://stackoverflow.com/questions/37799950/apache2-build-fails-in-yocto-usr-local-include-is-unsafe-for-cross-compilat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!