由于包含不带sysroot前缀的路径,Yocto nativesdk-ncurses无法构建

时间:2016-03-10 15:46:01

标签: compiler-errors cross-compiling yocto

我正在尝试为imx6qsabresd主板的Yocto“dizzy”分支构建一个SDK。 我按照https://github.com/Freescale/fsl-community-bsp-platform/blob/jethro/README.adoc的说明进行操作,唯一的区别是我使用的是头晕而不是jethro。

现在运行bitbake meta-toolchain会出现以下错误:

| 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/sysroots/x86_64-pokysdk-linux/usr/include
  • --sysroot=/mnt/space1/yocto-dizzy-imx6/build/tmp/sysroots/x86_64-nativesdk-pokysdk-linux

ncurses是第一个构建的软件包之一,我想这个问题并不是针对ncurses的。

显然,编译器尝试访问绝对包含目录/opt/poky/1.7.3/sysroots/x86_64-pokysdk-linux/usr/include,而不考虑sysroot前缀/mnt/space1/yocto-dizzy-imx6/build/tmp/sysroots/x86_64-nativesdk-pokysdk-linux。两者一起/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将是正确的包含路径。

现在,谁在这里有过错?查看--sysroot时不考虑-I参数的编译器包括目录?或者某处的Yocto食谱有错吗?也许是Yocto的工作是为包含路径添加前缀?还有其他提示吗?

2 个答案:

答案 0 :(得分:1)

我相信您需要应用此patch。具体来说,这些行

#Remove ${includedir} from CPPFLAGS, need for cross compile

sed -i 's#-I${cf_includedir}##g' ${S}/configure || die "sed CPPFLAGS"

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

答案 1 :(得分:1)

LightenS的回答让我到了正确的地方。 这里有更多细节:

的ncurses&#39; public class BookcaseCatalog: IMethod<Bookcase> { private ObservableCollection<Bookcase> obsCase; public string ConnectionString { get; set; } public void Add(Bookcase obj) { //Do smth } } 包含对configure.in宏的调用,该调用在CF_INCLUDE_DIRS中定义。该宏添加了一个包含路径,但没有为sysroot添加前缀,这会破坏构建。

通常修复程序会更改aclocal.m4中的宏,但这是不可能的,因为&#34; ncurses需要修补的autoconf213来生成配置脚本。此autoconf不可用&#34;。因此需要修补aclocal.m4

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

configure