Skip to contentSkip to conversation

external-arm-toolchain: un-break target compilation

PATCH In review Denys Dmytriyenko 3 participants 5 messages Jun 4, 2020 – Jun 8, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 external-arm-toolchain: un-break target compilation

From: Denys Dmytriyenko <[email protected]>

Compiling on the target using runtime libs from external-arm-toolchain requires libgcc.a, as libgcc_s.so explains:

/* GNU ld script
Use the shared library, but some functions are only in the static library. */
GROUP ( libgcc_s.so.1 -lgcc )

Otherwise it results in errors like:

| /usr/lib/gcc/arm-linux-gnueabi/9.2.1/../../../../arm-linux-gnueabi/bin/ld: cannot find -lgcc
| /usr/lib/gcc/arm-linux-gnueabi/9.2.1/../../../../arm-linux-gnueabi/bin/ld: cannot find -lgcc
| collect2: error: ld returned 1 exit status

This already has been fixed before in this commit:
https://git.linaro.org/openembedded/meta-linaro.git/commit/?id=91ea4d017bf0598e49944e76c889e66d58c066ce

But then it got broken/undone here w/o due review:
https://git.linaro.org/openembedded/meta-linaro.git/commit/?id=b43d5f0ce431ba1e242504641266a63293ded5db

Even though it's a static library, we want it to be in libgcc-dev as it's not optional, but rather required for development.

---
 .../recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +2 -1
index 04d8923..8cfc208 100644
@@ -117,7 +117,7 @@ do_install() {
 	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}/
@@ -310,6 +310,7 @@ INSANE_SKIP_${PN}-utils += "ldflags"
 INSANE_SKIP_libstdc++ += "ldflags"
 INSANE_SKIP_libgfortran += "ldflags"
 INSANE_SKIP_libgcc += "ldflags dev-deps"
+INSANE_SKIP_libgcc-dev += "staticdev"
 INSANE_SKIP_libgfortran += "ldflags dev-deps"
 INSANE_SKIP_libstdc++ += "ldflags dev-deps"
 INSANE_SKIP_libatomic += "ldflags"
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Denys Dmytriyenko

From: Denys Dmytriyenko <[email protected]>

Compiling on the target using runtime libs from external-arm-toolchain requires libgcc.a, as libgcc_s.so explains:

/* GNU ld script
Use the shared library, but some functions are only in the static library. */
GROUP ( libgcc_s.so.1 -lgcc )

Quoted 5 lines

Otherwise it results in errors like:

| /usr/lib/gcc/arm-linux-gnueabi/9.2.1/../../../../arm-linux-gnueabi/bin/ld: cannot find -lgcc
| /usr/lib/gcc/arm-linux-gnueabi/9.2.1/../../../../arm-linux-gnueabi/bin/ld: cannot find -lgcc
| collect2: error: ld returned 1 exit status

Ah I see, so libgcc.a is mandatory for aarch32 but that isn't the case for aarch64 where only having a shared library seems to be sufficient.

Quoted 3 lines

This already has been fixed before in this commit:
https://git.linaro.org/openembedded/meta-linaro.git/commit/?id=91ea4d017bf0598e49944e76c889e66d58c066ce

There were mainly two reasons to revert libgcc static library packaging:

1. It was done improperly earlier leading to following QA issues:

ERROR: external-arm-toolchain-2019.12-r0 do_package_qa: QA Issue: non
-staticdev package contains static .a library: libgcc-dev path '/work/aarch64-poky-linux/external-arm-toolchain/2019.12-r0/packages-split/libgcc-dev/usr/lib/aarch64-none-linux-gnu/9.2.1/libgcc_eh.a' non -staticdev package contains static .a library: libgcc-dev path '/work/aarch64-poky-linux/external-arm-toolchain/2019.12-r0/packages-split/libgcc-dev/usr/lib/aarch64-none-linux-gnu/9.2.1/libgcc.a' [staticdev]
ERROR: external-arm-toolchain-2019.12-r0 do_package_qa: QA run found
fatal errors. Please consider fixing them.
ERROR: Logfile of failure stored in:
/home/sumit.garg/T2502/poky/build/tmp/work/aarch64-poky-linux/external-arm-toolchain/2019.12-r0/temp/log.do_package_qa.8281
ERROR: Task (/home/sumit.garg/T2502/poky/meta-arm/meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb:do_package_qa) failed with exit code '1'

2. There wasn't any motivation mentioned in your earlier commit message like this commit does to include libgcc static library.

Quoted 5 lines

But then it got broken/undone here w/o due review:
https://git.linaro.org/openembedded/meta-linaro.git/commit/?id=b43d5f0ce431ba1e242504641266a63293ded5db

Even though it's a static library, we want it to be in libgcc-dev as it's not optional, but rather required for development.

Yeah it's required for aarch32 but optional for aarch64.

So you could elaborate more in the commit message that this change is specifically required for arm32.

With that, feel free to add:

Quoted 20 lines
---
 .../recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +1 -1
index 04d8923..8cfc208 100644
@@ -117,7 +117,7 @@ do_install() {
        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}/

meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb INSANE_SKIP_${PN}-utils += "ldflags" · line 313

Quoted 4 lines
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +1 -0
@@ -310,6 +310,7 @@ INSANE_SKIP_${PN}-utils += "ldflags"
 INSANE_SKIP_libstdc++ += "ldflags"
 INSANE_SKIP_libgfortran += "ldflags"
 INSANE_SKIP_libgcc += "ldflags dev-deps"
+INSANE_SKIP_libgcc-dev += "staticdev"

This change was missing from your earlier commit.

-Sumit

Quoted 7 lines
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +0 -1
 INSANE_SKIP_libgfortran += "ldflags dev-deps"
 INSANE_SKIP_libstdc++ += "ldflags dev-deps"
 INSANE_SKIP_libatomic += "ldflags"
--

2.7.4

#2 lore raw
Quoted 12 lines · Sumit Garg
Quoted 11 lines · Denys Dmytriyenko

From: Denys Dmytriyenko <[email protected]>

Compiling on the target using runtime libs from external-arm-toolchain requires libgcc.a, as libgcc_s.so explains:

/* GNU ld script
Use the shared library, but some functions are only in the static library. */
GROUP ( libgcc_s.so.1 -lgcc )

Quoted 7 lines
Quoted 4 lines

Otherwise it results in errors like:

| /usr/lib/gcc/arm-linux-gnueabi/9.2.1/../../../../arm-linux-gnueabi/bin/ld: cannot find -lgcc
| /usr/lib/gcc/arm-linux-gnueabi/9.2.1/../../../../arm-linux-gnueabi/bin/ld: cannot find -lgcc
| collect2: error: ld returned 1 exit status

Ah I see, so libgcc.a is mandatory for aarch32 but that isn't the case for aarch64 where only having a shared library seems to be sufficient.

Well, I don't have all the old versions of the toolchain around to check, but yes, gcc9 and gcc8 both seem to be like that:

arm32 - libgcc_s.so is an ld script that requires libgcc.a arm64 - libgcc_s.so is just a symlink to libgcc_s.so.1

Not sure why arm32 requires some functions from the static lib, while arm64 doesn't. I would assume it depends on how the toolchain was built...

Quoted 8 lines
Quoted 3 lines

This already has been fixed before in this commit:
https://git.linaro.org/openembedded/meta-linaro.git/commit/?id=91ea4d017bf0598e49944e76c889e66d58c066ce

There were mainly two reasons to revert libgcc static library packaging:

1. It was done improperly earlier leading to following QA issues:

Quoted 12 lines

ERROR: external-arm-toolchain-2019.12-r0 do_package_qa: QA Issue: non
-staticdev package contains static .a library: libgcc-dev path '/work/aarch64-poky-linux/external-arm-toolchain/2019.12-r0/packages-split/libgcc-dev/usr/lib/aarch64-none-linux-gnu/9.2.1/libgcc_eh.a' non -staticdev package contains static .a library: libgcc-dev path '/work/aarch64-poky-linux/external-arm-toolchain/2019.12-r0/packages-split/libgcc-dev/usr/lib/aarch64-none-linux-gnu/9.2.1/libgcc.a' [staticdev]
ERROR: external-arm-toolchain-2019.12-r0 do_package_qa: QA run found
fatal errors. Please consider fixing them.
ERROR: Logfile of failure stored in:
/home/sumit.garg/T2502/poky/build/tmp/work/aarch64-poky-linux/external-arm-toolchain/2019.12-r0/temp/log.do_package_qa.8281
ERROR: Task (/home/sumit.garg/T2502/poky/meta-arm/meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb:do_package_qa) failed with exit code '1'

That's what INSANE_SKIP_libgcc-dev += "staticdev" is for - back then it wasn't a fatal error, hence wasn't there.

Quoted 2 lines

2. There wasn't any motivation mentioned in your earlier commit message like this commit does to include libgcc static library.

Well, it may not have been 100% clear, but it did imply it was needed for development:

* Install additional static libs, stubs and header files
* Needed for -dev versions of libgcc, libgfortran and other packages
...

Quoted 10 lines
Quoted 5 lines

But then it got broken/undone here w/o due review:
https://git.linaro.org/openembedded/meta-linaro.git/commit/?id=b43d5f0ce431ba1e242504641266a63293ded5db

Even though it's a static library, we want it to be in libgcc-dev as it's not optional, but rather required for development.

Yeah it's required for aarch32 but optional for aarch64.

So you could elaborate more in the commit message that this change is specifically required for arm32.

Were there any tests done on arm32? How about arm64?

Quoted 41 lines

With that, feel free to add:

Quoted 20 lines
---
 .../recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +1 -1
index 04d8923..8cfc208 100644
@@ -117,7 +117,7 @@ do_install() {
        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}/

meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb INSANE_SKIP_${PN}-utils += "ldflags" · line 313

Quoted 4 lines
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +1 -0
@@ -310,6 +310,7 @@ INSANE_SKIP_${PN}-utils += "ldflags"
 INSANE_SKIP_libstdc++ += "ldflags"
 INSANE_SKIP_libgfortran += "ldflags"
 INSANE_SKIP_libgcc += "ldflags dev-deps"
+INSANE_SKIP_libgcc-dev += "staticdev"

This change was missing from your earlier commit.

-Sumit

Quoted 7 lines
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +0 -1
 INSANE_SKIP_libgfortran += "ldflags dev-deps"
 INSANE_SKIP_libstdc++ += "ldflags dev-deps"
 INSANE_SKIP_libatomic += "ldflags"
--

2.7.4

Reviewed-by
#3 lore raw
Quoted 74 lines · Denys Dmytriyenko
Quoted 12 lines · Sumit Garg
Quoted 11 lines · Denys Dmytriyenko

From: Denys Dmytriyenko <[email protected]>

Compiling on the target using runtime libs from external-arm-toolchain requires libgcc.a, as libgcc_s.so explains:

/* GNU ld script
Use the shared library, but some functions are only in the static library. */
GROUP ( libgcc_s.so.1 -lgcc )

Quoted 7 lines
Quoted 4 lines

Otherwise it results in errors like:

| /usr/lib/gcc/arm-linux-gnueabi/9.2.1/../../../../arm-linux-gnueabi/bin/ld: cannot find -lgcc
| /usr/lib/gcc/arm-linux-gnueabi/9.2.1/../../../../arm-linux-gnueabi/bin/ld: cannot find -lgcc
| collect2: error: ld returned 1 exit status

Ah I see, so libgcc.a is mandatory for aarch32 but that isn't the case for aarch64 where only having a shared library seems to be sufficient.

Well, I don't have all the old versions of the toolchain around to check, but yes, gcc9 and gcc8 both seem to be like that:

arm32 - libgcc_s.so is an ld script that requires libgcc.a arm64 - libgcc_s.so is just a symlink to libgcc_s.so.1

Not sure why arm32 requires some functions from the static lib, while arm64 doesn't. I would assume it depends on how the toolchain was built...

Quoted 8 lines
Quoted 3 lines

This already has been fixed before in this commit:
https://git.linaro.org/openembedded/meta-linaro.git/commit/?id=91ea4d017bf0598e49944e76c889e66d58c066ce

There were mainly two reasons to revert libgcc static library packaging:

1. It was done improperly earlier leading to following QA issues:

Quoted 12 lines

ERROR: external-arm-toolchain-2019.12-r0 do_package_qa: QA Issue: non
-staticdev package contains static .a library: libgcc-dev path '/work/aarch64-poky-linux/external-arm-toolchain/2019.12-r0/packages-split/libgcc-dev/usr/lib/aarch64-none-linux-gnu/9.2.1/libgcc_eh.a' non -staticdev package contains static .a library: libgcc-dev path '/work/aarch64-poky-linux/external-arm-toolchain/2019.12-r0/packages-split/libgcc-dev/usr/lib/aarch64-none-linux-gnu/9.2.1/libgcc.a' [staticdev]
ERROR: external-arm-toolchain-2019.12-r0 do_package_qa: QA run found
fatal errors. Please consider fixing them.
ERROR: Logfile of failure stored in:
/home/sumit.garg/T2502/poky/build/tmp/work/aarch64-poky-linux/external-arm-toolchain/2019.12-r0/temp/log.do_package_qa.8281
ERROR: Task (/home/sumit.garg/T2502/poky/meta-arm/meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb:do_package_qa) failed with exit code '1'

That's what INSANE_SKIP_libgcc-dev += "staticdev" is for - back then it wasn't a fatal error, hence wasn't there.

Quoted 2 lines

2. There wasn't any motivation mentioned in your earlier commit message like this commit does to include libgcc static library.

Well, it may not have been 100% clear, but it did imply it was needed for development:

* Install additional static libs, stubs and header files
* Needed for -dev versions of libgcc, libgfortran and other packages
...

Quoted 6 lines
Quoted 5 lines

But then it got broken/undone here w/o due review:
https://git.linaro.org/openembedded/meta-linaro.git/commit/?id=b43d5f0ce431ba1e242504641266a63293ded5db

Even though it's a static library, we want it to be in libgcc-dev as it's not optional, but rather required for development.

Quoted 7 lines
Quoted 4 lines

Yeah it's required for aarch32 but optional for aarch64.

So you could elaborate more in the commit message that this change is specifically required for arm32.

Were there any tests done on arm32? How about arm64?

I think I was pretty explicit about testing here [1]. Native compilation wasn't in scope as the native compiler is altogether different from pre-built toolchain (cross-compilation).

Regarding libgcc for native compilation, I did explore a bit further and it seems that you are correct, the compiler mandates "-lgcc" to build executable files while "-lgcc_s" can be used optionally to build dynamic objects.

So we can go ahead with this patch itself with:

[1] https://lists.yoctoproject.org/g/yocto/message/48094

-Sumit

Quoted 38 lines
Quoted 38 lines
Quoted 21 lines
---
 .../recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +1 -1
index 04d8923..8cfc208 100644
@@ -117,7 +117,7 @@ do_install() {
        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}/

meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb INSANE_SKIP_${PN}-utils += "ldflags" · line 313

Quoted 4 lines
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +1 -0
@@ -310,6 +310,7 @@ INSANE_SKIP_${PN}-utils += "ldflags"
 INSANE_SKIP_libstdc++ += "ldflags"
 INSANE_SKIP_libgfortran += "ldflags"
 INSANE_SKIP_libgcc += "ldflags dev-deps"
+INSANE_SKIP_libgcc-dev += "staticdev"

This change was missing from your earlier commit.

-Sumit

Quoted 7 lines
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +0 -1
 INSANE_SKIP_libgfortran += "ldflags dev-deps"
 INSANE_SKIP_libstdc++ += "ldflags dev-deps"
 INSANE_SKIP_libatomic += "ldflags"
--

2.7.4

#4 lore raw
Quoted 87 lines · Sumit Garg
Quoted 74 lines · Denys Dmytriyenko
Quoted 12 lines · Sumit Garg
Quoted 11 lines · Denys Dmytriyenko

From: Denys Dmytriyenko <[email protected]>

Compiling on the target using runtime libs from external-arm-toolchain requires libgcc.a, as libgcc_s.so explains:

/* GNU ld script
Use the shared library, but some functions are only in the static library. */
GROUP ( libgcc_s.so.1 -lgcc )

Quoted 7 lines
Quoted 4 lines

Otherwise it results in errors like:

| /usr/lib/gcc/arm-linux-gnueabi/9.2.1/../../../../arm-linux-gnueabi/bin/ld: cannot find -lgcc
| /usr/lib/gcc/arm-linux-gnueabi/9.2.1/../../../../arm-linux-gnueabi/bin/ld: cannot find -lgcc
| collect2: error: ld returned 1 exit status

Ah I see, so libgcc.a is mandatory for aarch32 but that isn't the case for aarch64 where only having a shared library seems to be sufficient.

Well, I don't have all the old versions of the toolchain around to check, but yes, gcc9 and gcc8 both seem to be like that:

arm32 - libgcc_s.so is an ld script that requires libgcc.a arm64 - libgcc_s.so is just a symlink to libgcc_s.so.1

Not sure why arm32 requires some functions from the static lib, while arm64 doesn't. I would assume it depends on how the toolchain was built...

Quoted 8 lines
Quoted 3 lines

This already has been fixed before in this commit:
https://git.linaro.org/openembedded/meta-linaro.git/commit/?id=91ea4d017bf0598e49944e76c889e66d58c066ce

There were mainly two reasons to revert libgcc static library packaging:

1. It was done improperly earlier leading to following QA issues:

Quoted 12 lines

ERROR: external-arm-toolchain-2019.12-r0 do_package_qa: QA Issue: non
-staticdev package contains static .a library: libgcc-dev path '/work/aarch64-poky-linux/external-arm-toolchain/2019.12-r0/packages-split/libgcc-dev/usr/lib/aarch64-none-linux-gnu/9.2.1/libgcc_eh.a' non -staticdev package contains static .a library: libgcc-dev path '/work/aarch64-poky-linux/external-arm-toolchain/2019.12-r0/packages-split/libgcc-dev/usr/lib/aarch64-none-linux-gnu/9.2.1/libgcc.a' [staticdev]
ERROR: external-arm-toolchain-2019.12-r0 do_package_qa: QA run found
fatal errors. Please consider fixing them.
ERROR: Logfile of failure stored in:
/home/sumit.garg/T2502/poky/build/tmp/work/aarch64-poky-linux/external-arm-toolchain/2019.12-r0/temp/log.do_package_qa.8281
ERROR: Task (/home/sumit.garg/T2502/poky/meta-arm/meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb:do_package_qa) failed with exit code '1'

That's what INSANE_SKIP_libgcc-dev += "staticdev" is for - back then it wasn't a fatal error, hence wasn't there.

Quoted 2 lines

2. There wasn't any motivation mentioned in your earlier commit message like this commit does to include libgcc static library.

Well, it may not have been 100% clear, but it did imply it was needed for development:

* Install additional static libs, stubs and header files
* Needed for -dev versions of libgcc, libgfortran and other packages
...

Quoted 6 lines
Quoted 5 lines

But then it got broken/undone here w/o due review:
https://git.linaro.org/openembedded/meta-linaro.git/commit/?id=b43d5f0ce431ba1e242504641266a63293ded5db

Even though it's a static library, we want it to be in libgcc-dev as it's not optional, but rather required for development.

Quoted 7 lines
Quoted 4 lines

Yeah it's required for aarch32 but optional for aarch64.

So you could elaborate more in the commit message that this change is specifically required for arm32.

Were there any tests done on arm32? How about arm64?

I think I was pretty explicit about testing here [1]. Native compilation wasn't in scope as the native compiler is altogether different from pre-built toolchain (cross-compilation).

Quoted 8 lines

Regarding libgcc for native compilation, I did explore a bit further and it seems that you are correct, the compiler mandates "-lgcc" to build executable files while "-lgcc_s" can be used optionally to build dynamic objects.

So we can go ahead with this patch itself with:

Pulled into master.

Thanks,
Jon

Quoted 45 lines

[1] https://lists.yoctoproject.org/g/yocto/message/48094

-Sumit

Quoted 38 lines
Quoted 38 lines
Quoted 21 lines
---
 .../recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +1 -1
index 04d8923..8cfc208 100644
@@ -117,7 +117,7 @@ do_install() {
        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}/

meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb INSANE_SKIP_${PN}-utils += "ldflags" · line 313

Quoted 4 lines
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +1 -0
@@ -310,6 +310,7 @@ INSANE_SKIP_${PN}-utils += "ldflags"
 INSANE_SKIP_libstdc++ += "ldflags"
 INSANE_SKIP_libgfortran += "ldflags"
 INSANE_SKIP_libgcc += "ldflags dev-deps"
+INSANE_SKIP_libgcc-dev += "staticdev"

This change was missing from your earlier commit.

-Sumit

Quoted 7 lines
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +0 -1
 INSANE_SKIP_libgfortran += "ldflags dev-deps"
 INSANE_SKIP_libstdc++ += "ldflags dev-deps"
 INSANE_SKIP_libatomic += "ldflags"
--

2.7.4