All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Denys Dmytriyenko" <denis@denix.org>
To: Sumit Garg <sumit.garg@linaro.org>
Cc: meta-arm@lists.yoctoproject.org, pbarker@konsulko.com,
	wmills@ti.com, richard.purdie@linuxfoundation.org,
	daniel.thompson@linaro.org
Subject: Re: [PATCH v2 3/5] external-arm-toolchain: Align glibc packaging to OE TARGET_SYS
Date: Thu, 11 Jun 2020 22:15:36 -0400	[thread overview]
Message-ID: <20200612021536.GF17660@denix.org> (raw)
In-Reply-To: <1591796582-5015-4-git-send-email-sumit.garg@linaro.org>

On Wed, Jun 10, 2020 at 07:13:00PM +0530, Sumit Garg wrote:
> OE native and cross compilers (in case of SDK) uses OE TARGET_SYS to
> create standard paths to search for libraries and headers during
> compilation.
> 
> Currently external-arm-toolchain recipe temporarily override TARGET_SYS
> with EAT_TARGET_SYS and packages libraries and headers corresponding to
> EAT_TARGET_SYS which leads to failures during native and cross compilation
> (in case of SDK) such as:
> 
> $ $CXX -o hello++ hello.cpp
> In file included from hello.cpp:1:
> /tmp/armsdk/sysroots/armv7at2hf-neon-oe-linux-gnueabi/usr/include/c++/9.2.1/iostream:38:10: fatal error: bits/c++config.h: No such file or directory
>    38 | #include <bits/c++config.h>
>       |          ^~~~~~~~~~~~~~~~~~
> compilation terminated.
> 
> $ $CC hello.c
> real-ld: cannot find crtbeginS.o: No such file or directory
> 
> So remove temp override of TARGET_SYS and rather package libraries and
> headers corresponding to OE TARGET_SYS.

Yeah, I tried this before some time ago... It didn't work for me for all the 
use cases. It works for you for SDK because you build an OE compiler from 
sources for that case. If you try to use EAT (external ARM toolchain) with OE 
SDK, it would fail.

TARGET_SYS != EAT_TARGET_SYS is indeed inconvenient, but has been there for 
long time. There are other assumptions and limitations in some places of OE 
and those are not restricted to external-arm-toolchain, e.g. you can see 
similar workarounds for musl toolchain:

/usr/lib:
arm-oe-linux-musleabi/
arm-oe-linux-gnueabi -> arm-oe-linux-musleabi
arm-oe-linux-musleabihf -> arm-oe-linux-musleabi

Similar to that, I've been fixing it in many places like:

/usr/lib:
arm-linux-gnueabihf/
arm-linux-gnueabi -> arm-linux-gnueabihf

/usr/include/c++/<version>/:
arm-linux-gnueabihf/
arm-linux-gnueabi -> arm-linux-gnueabihf

BTW, arm-linux-gnueabihf is EAT gcc8, EAT gcc9 uses arm-none-linux-gnueabihf:

/usr/lib:
arm-none-linux-gnueabihf/
arm-linux-gnueabi -> arm-none-linux-gnueabihf

So, using such symlinks allows both OE compiler and EAT cross-compiler to find 
runtime libraries and headers correctly, both on-target and in SDK sysroot.

So, in general, I would welcome this simplification if TARGET_SYS was the same 
as EAT_TARGET_SYS, but I don't believe it's that easy to pull it off...

-- 
Denys


> This fixes changes added in commit:
> https://git.linaro.org/openembedded/meta-linaro.git/commit/?id=91ea4d017bf0598e49944e76c889e66d58c066ce
> 
> Also, update location for unwind.h gcc-arm-common.inc accordingly.
> 
> Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
> ---
>  .../external-arm-toolchain/external-arm-toolchain.bb   | 18 ++++++++++--------
>  .../recipes-devtools/gcc/gcc-arm-common.inc            |  2 +-
>  2 files changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb b/meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb
> index 5d9a0a8..7c7c607 100644
> --- a/meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb
> +++ b/meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb
> @@ -54,7 +54,6 @@ PROVIDES += "\
>  PV = "${EAT_VER_MAIN}"
>  
>  BINV = "${EAT_VER_GCC}"
> -TARGET_SYS = "${EAT_TARGET_SYS}"
>  
>  SRC_URI = "file://SUPPORTED"
>  
> @@ -75,8 +74,8 @@ do_install() {
>  	install -d ${D}${datadir}
>  	install -d ${D}${includedir}
>  	install -d ${D}/include
> -	install -d ${D}${libdir}/${EAT_TARGET_SYS}/${EAT_VER_GCC}
> -	install -d ${D}${libdir}/gcc/${EAT_TARGET_SYS}/${EAT_VER_GCC}
> +	install -d ${D}${libdir}/${TARGET_SYS}/${EAT_VER_GCC}
> +	install -d ${D}${libdir}/gcc/${TARGET_SYS}/${EAT_VER_GCC}
>  
>  	CP_ARGS="-Prf --preserve=mode,timestamps --no-preserve=ownership"
>  	cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}/${EAT_LIBDIR}/*  ${D}${base_libdir}
> @@ -105,6 +104,9 @@ do_install() {
>  	fi
>  
>  	cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}/include/* ${D}${includedir}
> +	if [ -d ${D}${includedir}/c++/${EAT_VER_GCC}/${EAT_TARGET_SYS} ]; then
> +		mv ${D}${includedir}/c++/${EAT_VER_GCC}/${EAT_TARGET_SYS} ${D}${includedir}/c++/${EAT_VER_GCC}/${TARGET_SYS}
> +	fi
>  	ln -sf ../usr/include/c++ ${D}/include/c++
>  
>  	cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}/libc/usr/bin/* ${D}${bindir}
> @@ -116,11 +118,11 @@ do_install() {
>  	sed -i -e 's#/bin/bash#/bin/sh#' ${D}${bindir}/tzselect
>  	sed -i -e 's#/bin/bash#/bin/sh#' ${D}${bindir}/ldd
>  
> -	cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/lib/gcc/${EAT_TARGET_SYS}/${EAT_VER_GCC}/crt*.o ${D}${libdir}/${EAT_TARGET_SYS}/${EAT_VER_GCC}/
> -	cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/lib/gcc/${EAT_TARGET_SYS}/${EAT_VER_GCC}/libgcc* ${D}${libdir}/${EAT_TARGET_SYS}/${EAT_VER_GCC}/
> -	cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/lib/gcc/${EAT_TARGET_SYS}/${EAT_VER_GCC}/libgcov* ${D}${libdir}/gcc/${EAT_TARGET_SYS}/${EAT_VER_GCC}/
> -	cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/lib/gcc/${EAT_TARGET_SYS}/${EAT_VER_GCC}/include ${D}${libdir}/gcc/${EAT_TARGET_SYS}/${EAT_VER_GCC}/
> -	cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/lib/gcc/${EAT_TARGET_SYS}/${EAT_VER_GCC}/finclude ${D}${libdir}/gcc/${EAT_TARGET_SYS}/${EAT_VER_GCC}/
> +	cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/lib/gcc/${EAT_TARGET_SYS}/${EAT_VER_GCC}/crt*.o ${D}${libdir}/${TARGET_SYS}/${EAT_VER_GCC}/
> +	cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/lib/gcc/${EAT_TARGET_SYS}/${EAT_VER_GCC}/libgcc* ${D}${libdir}/${TARGET_SYS}/${EAT_VER_GCC}/
> +	cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/lib/gcc/${EAT_TARGET_SYS}/${EAT_VER_GCC}/libgcov* ${D}${libdir}/gcc/${TARGET_SYS}/${EAT_VER_GCC}/
> +	cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/lib/gcc/${EAT_TARGET_SYS}/${EAT_VER_GCC}/include ${D}${libdir}/gcc/${TARGET_SYS}/${EAT_VER_GCC}/
> +	cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/lib/gcc/${EAT_TARGET_SYS}/${EAT_VER_GCC}/finclude ${D}${libdir}/gcc/${TARGET_SYS}/${EAT_VER_GCC}/
>  
>  	# fix up the copied symlinks (they are still pointing to the multiarch directory)
>  	linker_name="${@bb.utils.contains("TUNE_FEATURES", "aarch64", "ld-linux-aarch64.so.1", bb.utils.contains("TUNE_FEATURES", "callconvention-hard", "ld-linux-armhf.so.3", "ld-linux.so.3",d), d)}"
> diff --git a/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-common.inc b/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-common.inc
> index 5599743..392c57f 100644
> --- a/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-common.inc
> +++ b/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-common.inc
> @@ -12,7 +12,7 @@
>  do_install_prepend_class-target () {
>  	if [ "${TCMODE}" = "external-arm" -a ! -f ${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/gcc/${TARGET_SYS}/${BINV}/include/unwind.h ]; then
>  		install -d ${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/gcc/${TARGET_SYS}/${BINV}/include/
> -		install ${STAGING_LIBDIR}/gcc/${EAT_TARGET_SYS}/${EAT_VER_GCC}/include/unwind.h ${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/gcc/${TARGET_SYS}/${BINV}/include/
> +		install ${STAGING_LIBDIR}/gcc/${TARGET_SYS}/${EAT_VER_GCC}/include/unwind.h ${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/gcc/${TARGET_SYS}/${BINV}/include/
>  	fi
>  }
>  
> -- 
> 2.7.4
> 

  reply	other threads:[~2020-06-12  2:15 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-10 13:42 [PATCH v2 0/5] external-arm-toolchain: Add support for SDK generation Sumit Garg
2020-06-10 13:42 ` [PATCH v2 1/5] external-arm-toolchain: Remove glibc locale dependency Sumit Garg
2020-06-12  4:14   ` [meta-arm] " Denys Dmytriyenko
2020-06-10 13:42 ` [PATCH v2 2/5] external-arm-toolchain: Refine dev libraries/headers packaging Sumit Garg
2020-06-12  4:23   ` Denys Dmytriyenko
2020-06-12  7:07     ` Sumit Garg
2020-06-12  7:35       ` Denys Dmytriyenko
2020-06-12  8:49         ` Sumit Garg
2020-06-10 13:43 ` [PATCH v2 3/5] external-arm-toolchain: Align glibc packaging to OE TARGET_SYS Sumit Garg
2020-06-12  2:15   ` Denys Dmytriyenko [this message]
2020-06-12  5:33     ` Sumit Garg
2020-06-12  6:16       ` Denys Dmytriyenko
2020-06-12  7:12         ` Sumit Garg
2020-06-10 13:43 ` [PATCH v2 4/5] meta-arm-toolchain: Add README Sumit Garg
2020-06-10 13:43 ` [PATCH v2 5/5] external-arm-toolchain: Add package specific licenses Sumit Garg
2020-06-12  4:26   ` Denys Dmytriyenko
2020-06-11 15:12 ` [meta-arm] [PATCH v2 0/5] external-arm-toolchain: Add support for SDK generation Jon Mason
2020-06-12  2:18 ` Denys Dmytriyenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200612021536.GF17660@denix.org \
    --to=denis@denix.org \
    --cc=daniel.thompson@linaro.org \
    --cc=meta-arm@lists.yoctoproject.org \
    --cc=pbarker@konsulko.com \
    --cc=richard.purdie@linuxfoundation.org \
    --cc=sumit.garg@linaro.org \
    --cc=wmills@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.