Skip to contentSkip to conversation

arm-toolchain/gcc,external-arm-toolchain: resolve conflict with gcc headers

PATCH Applied Denys Dmytriyenko 3 participants 3 messages Sep 9, 2022 – Sep 20, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm-toolchain/gcc,external-arm-toolchain: resolve conflict with gcc headers

From: Denys Dmytriyenko <[email protected]>

Historically external-arm-toolchain recipe packaged all gcc headers from ${libdir}/gcc/${TARGET_SYS}/${BINV}/include - some would be picked up by packages like gcc-sanitizers, libssp-dev. libquadmath-dev or libgomp-dev. The rest would fall into catch-all libgcc-dev package.

Unfortunately, that could result in a conflict with a target gcc, which also packages some of those files, like unwind.h or stddef.h, among others.

The conflict could be seen with this config:

EXTRA_IMAGE_FEATURES += "dev-pkgs tools-sdk"
TCMODE = "external-arm"
EXTERNAL_TOOLCHAIN = "/OE/toolchains/gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu"

And the error message is:

Error: Transaction test error:
file /usr/lib/gcc/aarch64-poky-linux/11.2.1/include/stddef.h conflicts between attempted installs of libgcc-s-dev-11.2.1-r0.1.cortexa57 and gcc-arm+11.2-r2022.02.1.cortexa57 file /usr/lib/gcc/aarch64-poky-linux/11.2.1/include/unwind.h conflicts between attempted installs of libgcc-s-dev-11.2.1-r0.1.cortexa57 and gcc-arm+11.2-r2022.02.1.cortexa57

Modify external-arm-toolchain recipe according to how libgcc in OE-Core handles those header files by removing and not packaging them:

https://git.openembedded.org/openembedded-core/tree/meta/recipes-devtools/gcc/libgcc-common.inc#n40

Also need to adjust gcc recipe to pick up unwind.h from EXTERNAL_TOOLCHAIN location now, since libgcc-dev no longer carries it, and install it into STAGING_LIBDIR_NATIVE, where OE-Core gcc-target.inc expects it from gcc-cross:

https://git.openembedded.org/openembedded-core/tree/meta/recipes-devtools/gcc/gcc-target.inc#n164

---
 .../external-arm-toolchain/external-arm-toolchain.bb     | 9 ++++++---
 .../recipes-devtools/gcc/gcc-arm-common.inc              | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +6 -3
index dcc8ebf..fab1761 100644
@@ -75,7 +75,7 @@ do_install() {
 	install -d ${D}${includedir}
 	install -d ${D}/include
 	install -d ${D}${libdir}/${TARGET_SYS}/${EAT_VER_GCC}
-	install -d ${D}${libdir}/gcc/${TARGET_SYS}/${EAT_VER_GCC}
+	install -d ${D}${libdir}/gcc/${TARGET_SYS}/${EAT_VER_GCC}/include
 
 	CP_ARGS="-Prf --preserve=mode,timestamps --no-preserve=ownership"
 	cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}/${EAT_LIBDIR}/*  ${D}${base_libdir}
@@ -104,7 +104,11 @@ do_install() {
 	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}/include/ssp ${D}${libdir}/gcc/${TARGET_SYS}/${EAT_VER_GCC}/include || true
+	cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/lib/gcc/${EAT_TARGET_SYS}/${EAT_VER_GCC}/include/sanitizers ${D}${libdir}/gcc/${TARGET_SYS}/${EAT_VER_GCC}/include || true
+	cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/lib/gcc/${EAT_TARGET_SYS}/${EAT_VER_GCC}/include/quadmath* ${D}${libdir}/gcc/${TARGET_SYS}/${EAT_VER_GCC}/include || true
+	cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/lib/gcc/${EAT_TARGET_SYS}/${EAT_VER_GCC}/include/omp.h ${D}${libdir}/gcc/${TARGET_SYS}/${EAT_VER_GCC}/include || true
+	cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/lib/gcc/${EAT_TARGET_SYS}/${EAT_VER_GCC}/include/openacc.h ${D}${libdir}/gcc/${TARGET_SYS}/${EAT_VER_GCC}/include || true
 	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)
@@ -495,7 +499,6 @@ FILES:libgcc-dev = "\
     ${@oe.utils.conditional('BASETARGET_SYS', '${TARGET_SYS}', '', '${libdir}/${BASETARGET_SYS}', d)} \
     ${libdir}/${TARGET_SYS}/${BINV}* \
     ${libdir}/${TARGET_ARCH}${TARGET_VENDOR}* \
-    ${libdir}/gcc/${TARGET_SYS}/${BINV}/include \
 "
 
 FILES:linux-libc-headers = ""
meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-common.inc +1 -1
index d7cc4e7..fa23e84 100644
@@ -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/${TARGET_SYS}/${EAT_VER_GCC}/include/unwind.h ${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/gcc/${TARGET_SYS}/${BINV}/include/
+		install ${EXTERNAL_TOOLCHAIN}/lib/gcc/${EAT_TARGET_SYS}/${EAT_VER_GCC}/include/unwind.h ${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/gcc/${TARGET_SYS}/${BINV}/include/
 	fi
 }
 
Signature · 1 line
2.25.1
Applied
#1 lore raw
Quoted 9 lines · Denys Dmytriyenko

Historically external-arm-toolchain recipe packaged all gcc headers from ${libdir}/gcc/${TARGET_SYS}/${BINV}/include - some would be picked up by packages like gcc-sanitizers, libssp-dev. libquadmath-dev or libgomp-dev. The rest would fall into catch-all libgcc-dev package.

Unfortunately, that could result in a conflict with a target gcc, which also packages some of those files, like unwind.h or stddef.h, among others.

[...]

Applied, thanks!

[1/1] arm-toolchain/gcc,external-arm-toolchain: resolve conflict with gcc headers

      commit: af69667215440b6bc6a8424c213dee1175ca6198

Best regards,

Signature · 1 line
Jon Mason <[email protected]>
#2 lore raw
In reply to Denys Dmytriyenko
Quoted 34 lines · Denys Dmytriyenko

From: Denys Dmytriyenko <[email protected]>

Historically external-arm-toolchain recipe packaged all gcc headers from ${libdir}/gcc/${TARGET_SYS}/${BINV}/include - some would be picked up by packages like gcc-sanitizers, libssp-dev. libquadmath-dev or libgomp-dev. The rest would fall into catch-all libgcc-dev package.

Unfortunately, that could result in a conflict with a target gcc, which also packages some of those files, like unwind.h or stddef.h, among others.

The conflict could be seen with this config:

EXTRA_IMAGE_FEATURES += "dev-pkgs tools-sdk"
TCMODE = "external-arm"
EXTERNAL_TOOLCHAIN = "/OE/toolchains/gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu"

And the error message is:

Error: Transaction test error:
file /usr/lib/gcc/aarch64-poky-linux/11.2.1/include/stddef.h conflicts between attempted installs of libgcc-s-dev-11.2.1-r0.1.cortexa57 and gcc-arm+11.2-r2022.02.1.cortexa57 file /usr/lib/gcc/aarch64-poky-linux/11.2.1/include/unwind.h conflicts between attempted installs of libgcc-s-dev-11.2.1-r0.1.cortexa57 and gcc-arm+11.2-r2022.02.1.cortexa57

Modify external-arm-toolchain recipe according to how libgcc in OE-Core handles those header files by removing and not packaging them:

https://git.openembedded.org/openembedded-core/tree/meta/recipes-devtools/gcc/libgcc-common.inc#n40

Also need to adjust gcc recipe to pick up unwind.h from EXTERNAL_TOOLCHAIN location now, since libgcc-dev no longer carries it, and install it into STAGING_LIBDIR_NATIVE, where OE-Core gcc-target.inc expects it from gcc-cross:

Quoted 8 lines

https://git.openembedded.org/openembedded-core/tree/meta/recipes-devtools/gcc/gcc-target.inc#n164

---
 .../external-arm-toolchain/external-arm-toolchain.bb     | 9 ++++++---
 .../recipes-devtools/gcc/gcc-arm-common.inc              | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

Apologies for the delayed response as I was at plumbers last week. BTW, thanks for the fix, it looks good to me.

-Sumit

Quoted 59 lines
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +6 -3
index dcc8ebf..fab1761 100644
@@ -75,7 +75,7 @@ do_install() {
        install -d ${D}${includedir}
        install -d ${D}/include
        install -d ${D}${libdir}/${TARGET_SYS}/${EAT_VER_GCC}
-       install -d ${D}${libdir}/gcc/${TARGET_SYS}/${EAT_VER_GCC}
+       install -d ${D}${libdir}/gcc/${TARGET_SYS}/${EAT_VER_GCC}/include
 
        CP_ARGS="-Prf --preserve=mode,timestamps --no-preserve=ownership"
        cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}/${EAT_LIBDIR}/*  ${D}${base_libdir}
@@ -104,7 +104,11 @@ do_install() {
        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}/include/ssp ${D}${libdir}/gcc/${TARGET_SYS}/${EAT_VER_GCC}/include || true
+       cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/lib/gcc/${EAT_TARGET_SYS}/${EAT_VER_GCC}/include/sanitizers ${D}${libdir}/gcc/${TARGET_SYS}/${EAT_VER_GCC}/include || true
+       cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/lib/gcc/${EAT_TARGET_SYS}/${EAT_VER_GCC}/include/quadmath* ${D}${libdir}/gcc/${TARGET_SYS}/${EAT_VER_GCC}/include || true
+       cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/lib/gcc/${EAT_TARGET_SYS}/${EAT_VER_GCC}/include/omp.h ${D}${libdir}/gcc/${TARGET_SYS}/${EAT_VER_GCC}/include || true
+       cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/lib/gcc/${EAT_TARGET_SYS}/${EAT_VER_GCC}/include/openacc.h ${D}${libdir}/gcc/${TARGET_SYS}/${EAT_VER_GCC}/include || true
        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)
@@ -495,7 +499,6 @@ FILES:libgcc-dev = "\
     ${@oe.utils.conditional('BASETARGET_SYS', '${TARGET_SYS}', '', '${libdir}/${BASETARGET_SYS}', d)} \
     ${libdir}/${TARGET_SYS}/${BINV}* \
     ${libdir}/${TARGET_ARCH}${TARGET_VENDOR}* \
-    ${libdir}/gcc/${TARGET_SYS}/${BINV}/include \
 "
 
 FILES:linux-libc-headers = ""
meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-common.inc +1 -2
index d7cc4e7..fa23e84 100644
@@ -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/${TARGET_SYS}/${EAT_VER_GCC}/include/unwind.h ${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/gcc/${TARGET_SYS}/${BINV}/include/
+               install ${EXTERNAL_TOOLCHAIN}/lib/gcc/${EAT_TARGET_SYS}/${EAT_VER_GCC}/include/unwind.h ${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/gcc/${TARGET_SYS}/${BINV}/include/
        fi
 }
 
--

2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#3760): https://lists.yoctoproject.org/g/meta-arm/message/3760
Mute This Topic: https://lists.yoctoproject.org/mt/93581613/1777089
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-arm/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-