diff options
author | Alejandro Hernandez Samaniego <alejandro@enedino.org> | 2022-01-10 19:50:30 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-01-12 07:19:35 +0000 |
commit | d4b186c2cfe62ba92850093fb165000c9f933202 (patch) | |
tree | e793a5c53198efe416512fcf31329250e1c97978 /meta/recipes-devtools/gcc | |
parent | 16110cdca7211b0efc59464afbb253527c033cad (diff) | |
download | poky-d4b186c2cfe62ba92850093fb165000c9f933202.tar.gz |
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.
(From OE-Core rev: 08ff7c87efdf373f1874fcccd9a2a73fc0efef30)
Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandro@enedino.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/gcc')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-cross-canadian.inc | 8 |
1 files 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" | |||
45 | export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET}" | 45 | export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET}" |
46 | 46 | ||
47 | do_configure () { | 47 | do_configure () { |
48 | if [ ! -d ${RECIPE_SYSROOT}/${target_includedir} ]; then | ||
49 | mkdir -p ${RECIPE_SYSROOT}/${target_includedir} | ||
50 | fi | ||
48 | export CC_FOR_BUILD="${BUILD_CC}" | 51 | export CC_FOR_BUILD="${BUILD_CC}" |
49 | export CXX_FOR_BUILD="${BUILD_CXX}" | 52 | export CXX_FOR_BUILD="${BUILD_CXX}" |
50 | export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}" | 53 | export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}" |
@@ -180,9 +183,6 @@ SYSTEMLIBS = "${target_base_libdir}/" | |||
180 | SYSTEMLIBS1 = "${target_libdir}/" | 183 | SYSTEMLIBS1 = "${target_libdir}/" |
181 | 184 | ||
182 | EXTRA_OECONF += "--enable-poison-system-directories" | 185 | EXTRA_OECONF += "--enable-poison-system-directories" |
183 | EXTRA_OECONF:remove:elf = "--with-sysroot=/not/exist" | 186 | |
184 | EXTRA_OECONF:remove:eabi = "--with-sysroot=/not/exist" | ||
185 | EXTRA_OECONF:append:elf = " --without-headers --with-newlib" | ||
186 | EXTRA_OECONF:append:eabi = " --without-headers --with-newlib" | ||
187 | # gcc 4.7 needs -isystem | 187 | # gcc 4.7 needs -isystem |
188 | export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET} -isystem=${target_includedir}" | 188 | export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET} -isystem=${target_includedir}" |