1
votes

I'm trying to build an SDK for the Yocto "dizzy" branch for the imx6qsabresd board. I've followed the instructions at https://github.com/Freescale/fsl-community-bsp-platform/blob/jethro/README.adoc, the only difference is that I used the dizzy branch instead of jethro.

Running bitbake meta-toolchain now gives me the following error:

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

The relevant arguments from above are:

  • -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 is one of the first packages getting built, I guess the problem is not specific to ncurses.

Apparently the compiler tries to access the absolute include dir /opt/poky/1.7.3/sysroots/x86_64-pokysdk-linux/usr/include, without considering the sysroot prefix /mnt/space1/yocto-dizzy-imx6/build/tmp/sysroots/x86_64-nativesdk-pokysdk-linux. Both together, /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, would be the correct include path.

Now, who is at fault here? The compiler for not considering the --sysroot argument when looking at the -I include dirs? Or is there a mistake in the Yocto recipes somewhere? Maybe it was Yocto's job to prefix the include path? Any other hints?

2

2 Answers

1
votes

I believe you need to apply this patch. Specifically, these lines

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

The answer from LightenS lead me to the right place to look. Here's some more details:

ncurses' configure.in contains a call to the CF_INCLUDE_DIRS macro, which is defined in aclocal.m4. That macro adds an include path without prefixing it with the sysroot, which breaks the build.

Normally the fix would be changing the macro in aclocal.m4, but that is not possible because "ncurses requires a patched autoconf213 to generate the configure script. This autoconf is not available". So instead configure needs to be patched.

For reference, this is the patch I created for 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