Compiler errors Yocto nativesdk ncurses无法生成,因为包含路径未以sysroot作为前缀

Compiler errors Yocto nativesdk ncurses无法生成,因为包含路径未以sysroot作为前缀,compiler-errors,cross-compiling,yocto,Compiler Errors,Cross Compiling,Yocto,我正在尝试为imx6qsabresd板的Yocto“dizzy”分支构建SDK。 我已经遵循了在的说明,唯一的区别是我使用了dizzy branch而不是jethro 运行bitbake元工具链会出现以下错误: | echo | gawk -f /mnt/space1/yocto-dizzy-imx6/build/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-ncurses/5.9-r15.1/ncurses-5.9/ncurses/base

我正在尝试为imx6qsabresd板的Yocto“dizzy”分支构建SDK。 我已经遵循了在的说明,唯一的区别是我使用了dizzy branch而不是jethro

运行
bitbake元工具链
会出现以下错误:

| echo | gawk -f /mnt/space1/yocto-dizzy-imx6/build/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-ncurses/5.9-r15.1/ncurses-5.9/ncurses/base/MKunctrl.awk bigstrings=1 >unctrl.c
| x86_64-pokysdk-linux-gcc  --sysroot=/mnt/space1/yocto-dizzy-imx6/build/tmp/sysroots/x86_64-nativesdk-pokysdk-linux -DHAVE_CONFIG_H -I../ncurses -I/mnt/space1/yocto-dizzy-imx6/build/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-ncurses/5.9-r15.1/ncurses-5.9/ncurses -isystem/mnt/space1/yocto-dizzy-imx6/build/tmp/sysroots/x86_64-nativesdk-pokysdk-linux/opt/poky/1.7.3/sysroots/x86_64-pokysdk-linux/usr/include -D_GNU_SOURCE -DNDEBUG -I. -I../include -I/mnt/space1/yocto-dizzy-imx6/build/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-ncurses/5.9-r15.1/ncurses-5.9/ncurses/../include -I/opt/poky/1.7.3/sysroots/x86_64-pokysdk-linux/usr/include -isystem/mnt/space1/yocto-dizzy-imx6/build/tmp/sysroots/x86_64-nativesdk-pokysdk-linux/opt/poky/1.7.3/sysroots/x86_64-pokysdk-linux/usr/include -O2 -pipe  --param max-inline-insns-single=1200 -fPIC -DUSE_TERMLIB -c /mnt/space1/yocto-dizzy-imx6/build/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-ncurses/5.9-r15.1/ncurses-5.9/ncurses/tinfo/access.c -o ../obj_s/access.o
| cc1: error: /opt/poky/1.7.3/sysroots/x86_64-pokysdk-linux/usr/include: Permission denied
[..]
ERROR: Task 1368 (virtual:nativesdk:/mnt/space1/yocto-dizzy-imx6/sources/poky/meta/recipes-core/ncurses/ncurses_5.9.bb, do_compile) failed with exit code '1'
上述相关论点如下:

  • -I/opt/poky/1.7.3/sysroot/x86\u 64-pokysdk-linux/usr/include
  • --sysroot=/mnt/space1/yocto-dizzy-imx6/build/tmp/sysroot/x86_64-nativesdk-pokysdk-linux
ncurses是首批构建的软件包之一,我想这个问题并不特定于ncurses

显然,编译器试图访问绝对include dir
/opt/poky/1.7.3/sysroot/x86_64-pokysdk-linux/usr/include
,而不考虑sysroot前缀
/mnt/space1/yocto-dizzy-imx6/build/tmp/sysroot/x86_64-nativesdk-pokysdk-linux
。两者加在一起,
/mnt/space1/yocto-dizzy-imx6/build/tmp/sysroot/x86_64-nativesdk-pokysdk-linux/opt/poky/1.7.3/sysroot/x86_64-pokysdk-linux/usr/include
,将是正确的include路径


现在,谁是这里的错?编译器在查看
-I
include dirs时没有考虑
--sysroot
参数?或者Yocto的食谱中有错误?也许Yocto的工作就是给include路径加前缀?还有其他提示吗?

我认为您需要应用这些提示。具体来说,这些线

#从cppfaglass中删除${includedir},需要交叉编译

sed-i's#-i${cf#u includedir}##g'${s}/configure | | die“sed CPPFLAGS”



闪电的回答让我找到了正确的地方。 以下是一些更详细的信息:

ncurses的
configure.in
包含对
CF\u INCLUDE\u DIRS
宏的调用,该宏在
aclocal.m4
中定义。该宏添加了一个include路径,但没有使用sysroot作为前缀,这会破坏构建

通常情况下,修复程序会更改
aclocal.m4
中的宏,但这是不可能的,因为“ncurses需要修补的autoconf213来生成配置脚本。此autoconf不可用”。因此,需要对
configure
进行修补

作为参考,这是我为Yocto dizzy创建的补丁:

Index: ncurses-5.9/configure
===================================================================
--- ncurses-5.9.orig/configure
+++ ncurses-5.9/configure
@@ -18601,10 +18601,10 @@ if test "$GCC" != yes; then
 elif test "$includedir" != "/usr/include"; then
        if test "$includedir" = '${prefix}/include' ; then
                if test $prefix != /usr ; then
-           CPPFLAGS="$CPPFLAGS -I\${includedir}"
+           :
                fi
        else
-       CPPFLAGS="$CPPFLAGS -I\${includedir}"
+       :
        fi
 fi

谢谢!虽然该补丁不适用于我的Yocto版本,但它向我指出了问题的根源,我设法以非常类似的方式修复了它。
diff --git a/meta/recipes-core/ncurses/ncurses.inc b/meta/recipes-core/ncurses/ncurses.inc
index 10f7dd1..225e369 100644
--- a/meta/recipes-core/ncurses/ncurses.inc
+++ b/meta/recipes-core/ncurses/ncurses.inc
@@ -13,7 +13,7 @@ BINCONFIG = "${bindir}/ncurses-config"
 inherit autotools binconfig-disabled multilib_header

 # Upstream has useful patches at times at ftp://invisible-island.net/ncurses/
-SRC_URI = "${GNU_MIRROR}/ncurses/ncurses-${PV}.tar.gz"
+SRC_URI = "ftp://invisible-island.net/${BPN}/current/${BP}-${REVISION}.tgz"

 EXTRA_AUTORECONF = "-I m4"
 CONFIG_SITE =+ "${WORKDIR}/config.cache"
@@ -97,6 +97,8 @@ do_configure() {
         # broken because it requires stdin to be pollable (which is
         # not the case for /dev/null redirections)
         export cf_cv_working_poll=yes
+   #Remove ${includedir} from CPPFLAGS, need for cross compile
+   sed -i 's#-I${cf_includedir}##g' ${S}/configure || die "sed CPPFLAGS"

    # The --enable-pc-files requires PKG_CONFIG_LIBDIR existed
    mkdir -p ${PKG_CONFIG_LIBDIR}
@@ -105,6 +107,7 @@ do_configure() {
        return 1
    ! ${ENABLE_WIDEC} || \
        ncurses_configure "widec" "--enable-widec" "--without-progs"
+
 }

 do_compile() {
@@ -231,7 +234,14 @@ do_install() {
             # At some point we can rely on coreutils 8.16 which has ln -r.
             lnr ${D}${base_libdir}/libtinfo.so.5 ${D}${libdir}/libtinfo.so
         fi
-
+        if [ -d "${D}${includedir}/ncurses" ]; then
+            for f in `find ${D}${includedir}/ncurses -name "*.h"`
+            do
+           f=`basename $f`
+           test -e ${D}${includedir}/$f && continue
+                ln -sf ncurses/$f ${D}${includedir}/$f
+            done
+        fi
         oe_multilib_header curses.h
 }
Index: ncurses-5.9/configure
===================================================================
--- ncurses-5.9.orig/configure
+++ ncurses-5.9/configure
@@ -18601,10 +18601,10 @@ if test "$GCC" != yes; then
 elif test "$includedir" != "/usr/include"; then
        if test "$includedir" = '${prefix}/include' ; then
                if test $prefix != /usr ; then
-           CPPFLAGS="$CPPFLAGS -I\${includedir}"
+           :
                fi
        else
-       CPPFLAGS="$CPPFLAGS -I\${includedir}"
+       :
        fi
 fi