* [PATCH] gcc-cross-canadian: Fix cross canadian compiler for baremetal targets
@ 2022-01-11 2:50 Alejandro Enedino Hernandez Samaniego
2022-01-11 7:54 ` [OE-core] " Khem Raj
0 siblings, 1 reply; 4+ messages in thread
From: Alejandro Enedino Hernandez Samaniego @ 2022-01-11 2:50 UTC (permalink / raw)
To: openembedded-core; +Cc: Alejandro Enedino Hernandez Samaniego
While building GCC it checks whether the include directory exists,
if it doesnt it throws an error and exits:
| The directory that should contain system headers does not exist:
| tmp/work/x86_64-nativesdk-pokysdk-linux/gcc-cross-canadian-riscv32/
11.2.0-r0/recipe-sysroot/usr/include/
| make[1]: *** [Makefile:3257: stmp-fixinc] Error 1
Even though for the baremetal toolchain not having this directory
does make sense.
We overcame this by removing the --with-sysroot=/not/exist argument
for baremetal toolchains (via TARGET_OS override), however, the
newlib toolchain does have headers and an includedir, hence by fixing
the baremetal toolchain we broke the newlib one since it uses the same
TARGET_OS as baremetal, causing for example (on newlib):
/sdk/sysroots/x86_64-pokysdk-linux/usr/lib/riscv32-poky-elf/gcc/
riscv32-poky-elf/11.2.0/include/stdint.h:9:16:
fatal error: stdint.h: No such file or directory
| # include_next <stdint.h>
^~~~~~~~~~
compilation terminated.
By creating a dummy includedir, and removing the previous fix we
allow GCC to be built the same way, unifying the cross compiler
for all targets.
After this fix both TCLIBC=baremetal and TCLIBC=newlib SDKs work
properly.
Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandro@enedino.org>
---
meta/recipes-devtools/gcc/gcc-cross-canadian.inc | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/meta/recipes-devtools/gcc/gcc-cross-canadian.inc b/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
index 495dd9070b..168486bd4e 100644
--- a/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
+++ b/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
@@ -45,6 +45,9 @@ export WINDRES_FOR_TARGET = "${TARGET_PREFIX}windres"
export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET}"
do_configure () {
+ if [ ! -d ${RECIPE_SYSROOT}/${target_includedir} ]; then
+ mkdir -p ${RECIPE_SYSROOT}/${target_includedir}
+ fi
export CC_FOR_BUILD="${BUILD_CC}"
export CXX_FOR_BUILD="${BUILD_CXX}"
export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
@@ -180,9 +183,6 @@ SYSTEMLIBS = "${target_base_libdir}/"
SYSTEMLIBS1 = "${target_libdir}/"
EXTRA_OECONF += "--enable-poison-system-directories"
-EXTRA_OECONF:remove:elf = "--with-sysroot=/not/exist"
-EXTRA_OECONF:remove:eabi = "--with-sysroot=/not/exist"
-EXTRA_OECONF:append:elf = " --without-headers --with-newlib"
-EXTRA_OECONF:append:eabi = " --without-headers --with-newlib"
+
# gcc 4.7 needs -isystem
export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET} -isystem=${target_includedir}"
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [OE-core] [PATCH] gcc-cross-canadian: Fix cross canadian compiler for baremetal targets
2022-01-11 2:50 [PATCH] gcc-cross-canadian: Fix cross canadian compiler for baremetal targets Alejandro Enedino Hernandez Samaniego
@ 2022-01-11 7:54 ` Khem Raj
2022-01-11 9:26 ` Alejandro Enedino Hernandez Samaniego
0 siblings, 1 reply; 4+ messages in thread
From: Khem Raj @ 2022-01-11 7:54 UTC (permalink / raw)
To: Alejandro Hernandez Samaniego
Cc: Patches and discussions about the oe-core layer
On Mon, Jan 10, 2022 at 6:50 PM Alejandro Hernandez Samaniego
<alejandro@enedino.org> wrote:
>
> While building GCC it checks whether the include directory exists,
> if it doesnt it throws an error and exits:
>
> | The directory that should contain system headers does not exist:
> | tmp/work/x86_64-nativesdk-pokysdk-linux/gcc-cross-canadian-riscv32/
> 11.2.0-r0/recipe-sysroot/usr/include/
> | make[1]: *** [Makefile:3257: stmp-fixinc] Error 1
>
> Even though for the baremetal toolchain not having this directory
> does make sense.
>
> We overcame this by removing the --with-sysroot=/not/exist argument
> for baremetal toolchains (via TARGET_OS override), however, the
> newlib toolchain does have headers and an includedir, hence by fixing
> the baremetal toolchain we broke the newlib one since it uses the same
> TARGET_OS as baremetal, causing for example (on newlib):
>
> /sdk/sysroots/x86_64-pokysdk-linux/usr/lib/riscv32-poky-elf/gcc/
> riscv32-poky-elf/11.2.0/include/stdint.h:9:16:
> fatal error: stdint.h: No such file or directory
>
> | # include_next <stdint.h>
> ^~~~~~~~~~
> compilation terminated.
>
> By creating a dummy includedir, and removing the previous fix we
> allow GCC to be built the same way, unifying the cross compiler
> for all targets.
>
> After this fix both TCLIBC=baremetal and TCLIBC=newlib SDKs work
> properly.
>
> Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandro@enedino.org>
> ---
> meta/recipes-devtools/gcc/gcc-cross-canadian.inc | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/meta/recipes-devtools/gcc/gcc-cross-canadian.inc b/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
> index 495dd9070b..168486bd4e 100644
> --- a/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
> +++ b/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
> @@ -45,6 +45,9 @@ export WINDRES_FOR_TARGET = "${TARGET_PREFIX}windres"
> export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET}"
>
> do_configure () {
> + if [ ! -d ${RECIPE_SYSROOT}/${target_includedir} ]; then
> + mkdir -p ${RECIPE_SYSROOT}/${target_includedir}
> + fi
this looks ok from looks of it. Can you check what changes in
buildhistory when doing this for baremetal ( non-newlib ) build ?
> export CC_FOR_BUILD="${BUILD_CC}"
> export CXX_FOR_BUILD="${BUILD_CXX}"
> export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
> @@ -180,9 +183,6 @@ SYSTEMLIBS = "${target_base_libdir}/"
> SYSTEMLIBS1 = "${target_libdir}/"
>
> EXTRA_OECONF += "--enable-poison-system-directories"
> -EXTRA_OECONF:remove:elf = "--with-sysroot=/not/exist"
> -EXTRA_OECONF:remove:eabi = "--with-sysroot=/not/exist"
> -EXTRA_OECONF:append:elf = " --without-headers --with-newlib"
> -EXTRA_OECONF:append:eabi = " --without-headers --with-newlib"
> +
> # gcc 4.7 needs -isystem
> export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET} -isystem=${target_includedir}"
> --
> 2.25.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#160383): https://lists.openembedded.org/g/openembedded-core/message/160383
> Mute This Topic: https://lists.openembedded.org/mt/88341227/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] 4+ messages in thread
* Re: [OE-core] [PATCH] gcc-cross-canadian: Fix cross canadian compiler for baremetal targets
2022-01-11 7:54 ` [OE-core] " Khem Raj
@ 2022-01-11 9:26 ` Alejandro Enedino Hernandez Samaniego
2022-01-11 16:18 ` Khem Raj
0 siblings, 1 reply; 4+ messages in thread
From: Alejandro Enedino Hernandez Samaniego @ 2022-01-11 9:26 UTC (permalink / raw)
To: Khem Raj; +Cc: Patches and discussions about the oe-core layer
[-- Attachment #1: Type: text/plain, Size: 4087 bytes --]
On Tue, 11 Jan 2022 at 00:55, Khem Raj <raj.khem@gmail.com> wrote:
> On Mon, Jan 10, 2022 at 6:50 PM Alejandro Hernandez Samaniego
> <alejandro@enedino.org> wrote:
> >
> > While building GCC it checks whether the include directory exists,
> > if it doesnt it throws an error and exits:
> >
> > | The directory that should contain system headers does not exist:
> > | tmp/work/x86_64-nativesdk-pokysdk-linux/gcc-cross-canadian-riscv32/
> > 11.2.0-r0/recipe-sysroot/usr/include/
> > | make[1]: *** [Makefile:3257: stmp-fixinc] Error 1
> >
> > Even though for the baremetal toolchain not having this directory
> > does make sense.
> >
> > We overcame this by removing the --with-sysroot=/not/exist argument
> > for baremetal toolchains (via TARGET_OS override), however, the
> > newlib toolchain does have headers and an includedir, hence by fixing
> > the baremetal toolchain we broke the newlib one since it uses the same
> > TARGET_OS as baremetal, causing for example (on newlib):
> >
> > /sdk/sysroots/x86_64-pokysdk-linux/usr/lib/riscv32-poky-elf/gcc/
> > riscv32-poky-elf/11.2.0/include/stdint.h:9:16:
> > fatal error: stdint.h: No such file or directory
> >
> > | # include_next <stdint.h>
> > ^~~~~~~~~~
> > compilation terminated.
> >
> > By creating a dummy includedir, and removing the previous fix we
> > allow GCC to be built the same way, unifying the cross compiler
> > for all targets.
> >
> > After this fix both TCLIBC=baremetal and TCLIBC=newlib SDKs work
> > properly.
> >
> > Signed-off-by: Alejandro Enedino Hernandez Samaniego <
> alejandro@enedino.org>
> > ---
> > meta/recipes-devtools/gcc/gcc-cross-canadian.inc | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
> b/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
> > index 495dd9070b..168486bd4e 100644
> > --- a/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
> > +++ b/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
> > @@ -45,6 +45,9 @@ export WINDRES_FOR_TARGET = "${TARGET_PREFIX}windres"
> > export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET}"
> >
> > do_configure () {
> > + if [ ! -d ${RECIPE_SYSROOT}/${target_includedir} ]; then
> > + mkdir -p ${RECIPE_SYSROOT}/${target_includedir}
> > + fi
>
> this looks ok from looks of it. Can you check what changes in
> buildhistory when doing this for baremetal ( non-newlib ) build ?
>
Hi Khem,
Sure thing, after the patch buildhistory reports only a change in size (for
doc which is a little odd):
$ buildhistory-diff
packages/x86_64-nativesdk-pokysdk-linux/gcc-cross-canadian-riscv32/gcc-cross-canadian-riscv32-doc:
PKGSIZE changed from 181563 to 2993113 (+1549%)
I was a bit curious on what had changed in the docs and some docfiles used
to have "timestamp" in them and now they contain actual data.
Alejandro
>
> > export CC_FOR_BUILD="${BUILD_CC}"
> > export CXX_FOR_BUILD="${BUILD_CXX}"
> > export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
> > @@ -180,9 +183,6 @@ SYSTEMLIBS = "${target_base_libdir}/"
> > SYSTEMLIBS1 = "${target_libdir}/"
> >
> > EXTRA_OECONF += "--enable-poison-system-directories"
> > -EXTRA_OECONF:remove:elf = "--with-sysroot=/not/exist"
> > -EXTRA_OECONF:remove:eabi = "--with-sysroot=/not/exist"
> > -EXTRA_OECONF:append:elf = " --without-headers --with-newlib"
> > -EXTRA_OECONF:append:eabi = " --without-headers --with-newlib"
> > +
> > # gcc 4.7 needs -isystem
> > export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET}
> -isystem=${target_includedir}"
> > --
> > 2.25.1
> >
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#160383):
> https://lists.openembedded.org/g/openembedded-core/message/160383
> > Mute This Topic: https://lists.openembedded.org/mt/88341227/1997914
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> raj.khem@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
>
[-- Attachment #2: Type: text/html, Size: 6615 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [OE-core] [PATCH] gcc-cross-canadian: Fix cross canadian compiler for baremetal targets
2022-01-11 9:26 ` Alejandro Enedino Hernandez Samaniego
@ 2022-01-11 16:18 ` Khem Raj
0 siblings, 0 replies; 4+ messages in thread
From: Khem Raj @ 2022-01-11 16:18 UTC (permalink / raw)
To: Alejandro Enedino Hernandez Samaniego
Cc: Patches and discussions about the oe-core layer
[-- Attachment #1: Type: text/plain, Size: 4347 bytes --]
Sounds good to me thanks for doing it
On Tue, Jan 11, 2022 at 1:27 AM Alejandro Enedino Hernandez Samaniego <
alejandro@enedino.org> wrote:
> On Tue, 11 Jan 2022 at 00:55, Khem Raj <raj.khem@gmail.com> wrote:
>
>> On Mon, Jan 10, 2022 at 6:50 PM Alejandro Hernandez Samaniego
>> <alejandro@enedino.org> wrote:
>> >
>> > While building GCC it checks whether the include directory exists,
>> > if it doesnt it throws an error and exits:
>> >
>> > | The directory that should contain system headers does not exist:
>> > | tmp/work/x86_64-nativesdk-pokysdk-linux/gcc-cross-canadian-riscv32/
>> > 11.2.0-r0/recipe-sysroot/usr/include/
>> > | make[1]: *** [Makefile:3257: stmp-fixinc] Error 1
>> >
>> > Even though for the baremetal toolchain not having this directory
>> > does make sense.
>> >
>> > We overcame this by removing the --with-sysroot=/not/exist argument
>> > for baremetal toolchains (via TARGET_OS override), however, the
>> > newlib toolchain does have headers and an includedir, hence by fixing
>> > the baremetal toolchain we broke the newlib one since it uses the same
>> > TARGET_OS as baremetal, causing for example (on newlib):
>> >
>> > /sdk/sysroots/x86_64-pokysdk-linux/usr/lib/riscv32-poky-elf/gcc/
>> > riscv32-poky-elf/11.2.0/include/stdint.h:9:16:
>> > fatal error: stdint.h: No such file or directory
>> >
>> > | # include_next <stdint.h>
>> > ^~~~~~~~~~
>> > compilation terminated.
>> >
>> > By creating a dummy includedir, and removing the previous fix we
>> > allow GCC to be built the same way, unifying the cross compiler
>> > for all targets.
>> >
>> > After this fix both TCLIBC=baremetal and TCLIBC=newlib SDKs work
>> > properly.
>> >
>> > Signed-off-by: Alejandro Enedino Hernandez Samaniego <
>> alejandro@enedino.org>
>> > ---
>> > meta/recipes-devtools/gcc/gcc-cross-canadian.inc | 8 ++++----
>> > 1 file changed, 4 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
>> b/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
>> > index 495dd9070b..168486bd4e 100644
>> > --- a/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
>> > +++ b/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
>> > @@ -45,6 +45,9 @@ export WINDRES_FOR_TARGET = "${TARGET_PREFIX}windres"
>> > export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET}"
>> >
>> > do_configure () {
>> > + if [ ! -d ${RECIPE_SYSROOT}/${target_includedir} ]; then
>> > + mkdir -p ${RECIPE_SYSROOT}/${target_includedir}
>> > + fi
>>
>> this looks ok from looks of it. Can you check what changes in
>> buildhistory when doing this for baremetal ( non-newlib ) build ?
>>
>
> Hi Khem,
>
> Sure thing, after the patch buildhistory reports only a change in size
> (for doc which is a little odd):
> $ buildhistory-diff
>
> packages/x86_64-nativesdk-pokysdk-linux/gcc-cross-canadian-riscv32/gcc-cross-canadian-riscv32-doc:
> PKGSIZE changed from 181563 to 2993113 (+1549%)
>
> I was a bit curious on what had changed in the docs and some docfiles used
> to have "timestamp" in them and now they contain actual data.
>
> Alejandro
>
>
>>
>> > export CC_FOR_BUILD="${BUILD_CC}"
>> > export CXX_FOR_BUILD="${BUILD_CXX}"
>> > export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
>> > @@ -180,9 +183,6 @@ SYSTEMLIBS = "${target_base_libdir}/"
>> > SYSTEMLIBS1 = "${target_libdir}/"
>> >
>> > EXTRA_OECONF += "--enable-poison-system-directories"
>> > -EXTRA_OECONF:remove:elf = "--with-sysroot=/not/exist"
>> > -EXTRA_OECONF:remove:eabi = "--with-sysroot=/not/exist"
>> > -EXTRA_OECONF:append:elf = " --without-headers --with-newlib"
>> > -EXTRA_OECONF:append:eabi = " --without-headers --with-newlib"
>> > +
>> > # gcc 4.7 needs -isystem
>> > export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET}
>> -isystem=${target_includedir}"
>> > --
>> > 2.25.1
>> >
>> >
>> > -=-=-=-=-=-=-=-=-=-=-=-
>> > Links: You receive all messages sent to this group.
>> > View/Reply Online (#160383):
>> https://lists.openembedded.org/g/openembedded-core/message/160383
>> > Mute This Topic: https://lists.openembedded.org/mt/88341227/1997914
>> > Group Owner: openembedded-core+owner@lists.openembedded.org
>> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
>> raj.khem@gmail.com]
>> > -=-=-=-=-=-=-=-=-=-=-=-
>> >
>>
>
[-- Attachment #2: Type: text/html, Size: 7241 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-01-11 16:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-11 2:50 [PATCH] gcc-cross-canadian: Fix cross canadian compiler for baremetal targets Alejandro Enedino Hernandez Samaniego
2022-01-11 7:54 ` [OE-core] " Khem Raj
2022-01-11 9:26 ` Alejandro Enedino Hernandez Samaniego
2022-01-11 16:18 ` Khem Raj
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.