]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commit
gcc-cross-canadian: Fix cross canadian compiler for baremetal targets
authorAlejandro Hernandez Samaniego <alejandro@enedino.org>
Tue, 11 Jan 2022 02:50:30 +0000 (19:50 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 12 Jan 2022 07:19:16 +0000 (07:19 +0000)
commit08ff7c87efdf373f1874fcccd9a2a73fc0efef30
treea0d5a96c11c0644cb7e7d7fa64ffee623aa4d7c3
parent549597d422c7bcb467f34139ff25d2bee96bf851
gcc-cross-canadian: Fix cross canadian compiler for baremetal targets

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>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-devtools/gcc/gcc-cross-canadian.inc