public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH] gcc-runtime: Fix build when using gold
@ 2022-07-14  9:15 Richard Purdie
  2022-07-15 16:58 ` [OE-core] " Khem Raj
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Purdie @ 2022-07-14  9:15 UTC (permalink / raw)
  To: openembedded-core

If gold is enabled as the default linker, it errors trying to link
to our dummy library empty file and this turns off things which should
be present in libstdc++.

For example, _GLIBCXX_HAVE_S_ISREG isn't defined and HAVE_S_ISREG in
libstdc++-v3/config.h isn't set properly.

Instead of just creating an empty file, create an empty elf binary
instead which addresses the issue.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/recipes-devtools/gcc/gcc-runtime.inc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/gcc/gcc-runtime.inc b/meta/recipes-devtools/gcc/gcc-runtime.inc
index c39a0caf8a7..7e920df2d34 100644
--- a/meta/recipes-devtools/gcc/gcc-runtime.inc
+++ b/meta/recipes-devtools/gcc/gcc-runtime.inc
@@ -68,7 +68,8 @@ do_configure () {
 	# libstdc++ isn't built yet so CXX would error not able to find it which breaks stdc++'s configure
 	# tests. Create a dummy empty lib for the purposes of configure.
 	mkdir -p ${WORKDIR}/dummylib
-	touch ${WORKDIR}/dummylib/libstdc++.so
+	touch ${WORKDIR}/dummylib/dummylib.c
+	${CC} ${WORKDIR}/dummylib/dummylib.c -shared -o ${WORKDIR}/dummylib/libstdc++.so
 	for d in libgcc ${RUNTIMETARGET}; do
 		echo "Configuring $d"
 		rm -rf ${B}/${TARGET_SYS}/$d/
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [OE-core] [PATCH] gcc-runtime: Fix build when using gold
  2022-07-14  9:15 [PATCH] gcc-runtime: Fix build when using gold Richard Purdie
@ 2022-07-15 16:58 ` Khem Raj
  0 siblings, 0 replies; 2+ messages in thread
From: Khem Raj @ 2022-07-15 16:58 UTC (permalink / raw)
  To: Richard Purdie, openembedded-core



On 7/14/22 5:15 AM, Richard Purdie wrote:
> If gold is enabled as the default linker, it errors trying to link
> to our dummy library empty file and this turns off things which should
> be present in libstdc++.
> 
> For example, _GLIBCXX_HAVE_S_ISREG isn't defined and HAVE_S_ISREG in
> libstdc++-v3/config.h isn't set properly.
> 
> Instead of just creating an empty file, create an empty elf binary
> instead which addresses the issue.
> 
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>   meta/recipes-devtools/gcc/gcc-runtime.inc | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/recipes-devtools/gcc/gcc-runtime.inc b/meta/recipes-devtools/gcc/gcc-runtime.inc
> index c39a0caf8a7..7e920df2d34 100644
> --- a/meta/recipes-devtools/gcc/gcc-runtime.inc
> +++ b/meta/recipes-devtools/gcc/gcc-runtime.inc
> @@ -68,7 +68,8 @@ do_configure () {
>   	# libstdc++ isn't built yet so CXX would error not able to find it which breaks stdc++'s configure
>   	# tests. Create a dummy empty lib for the purposes of configure.
>   	mkdir -p ${WORKDIR}/dummylib
> -	touch ${WORKDIR}/dummylib/libstdc++.so
> +	touch ${WORKDIR}/dummylib/dummylib.c
> +	${CC} ${WORKDIR}/dummylib/dummylib.c -shared -o ${WORKDIR}/dummylib/libstdc++.so

you can improve it a little by using a one liner

${CC} -x c /dev/null -shared -o ${WORKDIR}/dummylib/libstdc++.so

>   	for d in libgcc ${RUNTIMETARGET}; do
>   		echo "Configuring $d"
>   		rm -rf ${B}/${TARGET_SYS}/$d/
> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#168028): https://lists.openembedded.org/g/openembedded-core/message/168028
> Mute This Topic: https://lists.openembedded.org/mt/92375338/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-15 16:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-14  9:15 [PATCH] gcc-runtime: Fix build when using gold Richard Purdie
2022-07-15 16:58 ` [OE-core] " Khem Raj

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox