Add workaround to compile static-compat-gcc after host glibc update

Ensure that ada host tools are built/linked with host g++ and thus linked
against the host glibc. Attempting to link against the target glibc leads
otherwise to linker errors like (since the host glibc has been updated to
2.38):

```
/usr/bin/ld: ../../libcommon.a(diagnostic.o): in function `get_terminal_width()':
/usr/include/stdlib.h:483:(.text+0x790): undefined reference to `__isoc23_strtol'
```

Not sure why GCC's build script is using the target "xg++" tool here. Maybe
a misconfiguration on my side or an upstream bug.
This commit is contained in:
Martchus 2023-08-04 17:16:51 +02:00
parent 725f0504c8
commit 2faaaf4e3e
1 changed files with 8 additions and 0 deletions

View File

@ -125,6 +125,14 @@ build() {
"$srcdir/gcc/configure" \
--enable-languages=ada,c,c++,fortran,lto \
$_confflags
# link Ada host tools with host g++ - otherwise we run into linker errors because it would use the too old target glibc
# note: Since we don't need Ada anyways it maybe makes sense to just disable it in the future.
sed -i -r \
-e 's|\+\$\(GCC_LINK\)( .* \$\(TOOLS_LIBS\))|g++\1|g' \
-e 's|--LINK=\"\$\(GCC_LINK\)\"|--LINK=g++|g' \
gcc/ada/gcc-interface/Makefile
make
}