Hi, I'm trying to build GCC 12.1.0 with amdgcn-amdhsa offload support, but I'm running into a problem when it tries to compile libssp. I am on Ubuntu 20.04.1 LTS, and have an AMD RX 480 gpu. The compiler I'm using to try and build gcc with is the one which comes with Ubuntu (9.4.0). I checked out the git repo on tag releases/gcc-12.1.0, and softlinked the following files from AMD's rocm installed llvm: ln -s /opt/rocm/llvm/bin/llvm-ar $HOME/opt/gcc/12.1.0/amdgcn-amdhsa/gcc-bin/12.1.0/ar ln -s /opt/rocm/llvm/bin/llvm-mc $HOME/opt/gcc/12.1.0/amdgcn-amdhsa/gcc-bin/12.1.0/as ln -s /opt/rocm/llvm/bin/lld $HOME/opt/gcc/12.1.0/amdgcn-amdhsa/gcc-bin/12.1.0/ld ln -s /opt/rocm/llvm/bin/llvm-ar $HOME/opt/gcc/12.1.0/amdgcn-amdhsa/gcc-bin/12.1.0/ranlib Configure and build command: ${gccsrc}/configure --target=amdgcn-amdhsa --disable-sjlj-exceptions --with-newlib --enable-as-accelerator-for=x86_64-pc-linux-gnu --with-build-time-tools=$HOME/opt/gcc/12.1.0/amdgcn-amdhsa/gcc-bin/12.1.0 --prefix=$HOME/opt/gcc/12.1.0 --enable-languages=c,lto,c++,fortran --enable-libgomp make When it tries to compile gcc/libssp/ssp.c, it can't find some common C functions/types: make[3]: Entering directory '${gccobj}/amdgcn-amdhsa/libssp' /bin/bash ./libtool --tag=CC --mode=compile ${gccobj}/./gcc/xgcc -B${gccobj}/./gcc/ -B$HOME/opt/gcc/12.1.0/amdgcn-amdhsa/bin/ -B$HOME/opt/gcc/12.1.0/amdgcn-amdhsa/lib/ -isystem $HOME/opt/gcc/12.1.0/amdgcn-amdhsa/include -isystem $HOME/opt/gcc/12.1.0/amdgcn-amdhsa/sys-include -DHAVE_CONFIG_H -I. -I../../../gcc/libssp -Wall -g -O2 -MT ssp.lo -MD -MP -MF .deps/ssp.Tpo -c -o ssp.lo ../../../gcc/libssp/ssp.c libtool: compile: ${gccobj}/./gcc/xgcc -B${gccobj}/./gcc/ -B$HOME/opt/gcc/12.1.0/amdgcn-amdhsa/bin/ -B$HOME/opt/gcc/12.1.0/amdgcn-amdhsa/lib/ -isystem $HOME/opt/gcc/12.1.0/amdgcn-amdhsa/include -isystem $HOME/opt/gcc/12.1.0/amdgcn-amdhsa/sys-include -DHAVE_CONFIG_H -I. -I../../../gcc/libssp -Wall -g -O2 -MT ssp.lo -MD -MP -MF .deps/ssp.Tpo -c ../../../gcc/libssp/ssp.c -o ssp.o ../../../gcc/libssp/ssp.c: In function ‘__guard_setup’: ../../../gcc/libssp/ssp.c:93:12: warning: implicit declaration of function ‘open’ [-Wimplicit-function-declaration] 93 | int fd = open ("/dev/urandom", O_RDONLY); | ^~~~ ../../../gcc/libssp/ssp.c:93:34: error: ‘O_RDONLY’ undeclared (first use in this function) 93 | int fd = open ("/dev/urandom", O_RDONLY); | ^~~~~~~~ ../../../gcc/libssp/ssp.c:93:34: note: each undeclared identifier is reported only once for each function it appears in ../../../gcc/libssp/ssp.c:96:7: error: unknown type name ‘ssize_t’ 96 | ssize_t size = read (fd, &__stack_chk_guard, | ^~~~~~~ ../../../gcc/libssp/ssp.c:96:22: warning: implicit declaration of function ‘read’ [-Wimplicit-function-declaration] 96 | ssize_t size = read (fd, &__stack_chk_guard, | ^~~~ ../../../gcc/libssp/ssp.c:98:7: warning: implicit declaration of function ‘close’ [-Wimplicit-function-declaration] 98 | close (fd); | ^~~~~ ../../../gcc/libssp/ssp.c: At top level: ../../../gcc/libssp/ssp.c:113:25: error: unknown type name ‘size_t’ 113 | fail (const char *msg1, size_t msg1len, const char *msg3) | ^~~~~~ ../../../gcc/libssp/ssp.c:36:1: note: ‘size_t’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’? 35 | #include "config.h" +++ |+#include <stddef.h> 36 | #ifdef HAVE_ALLOCA_H ../../../gcc/libssp/ssp.c: In function ‘__stack_chk_fail’: ../../../gcc/libssp/ssp.c:185:3: warning: implicit declaration of function ‘fail’ [-Wimplicit-function-declaration] 185 | fail (msg, strlen (msg), "stack smashing detected: terminated"); | ^~~~ ../../../gcc/libssp/ssp.c:185:14: warning: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration] 185 | fail (msg, strlen (msg), "stack smashing detected: terminated"); | ^~~~~~ ../../../gcc/libssp/ssp.c:36:1: note: include ‘<string.h>’ or provide a declaration of ‘strlen’ 35 | #include "config.h" +++ |+#include <string.h> 36 | #ifdef HAVE_ALLOCA_H ../../../gcc/libssp/ssp.c:185:14: warning: incompatible implicit declaration of built-in function ‘strlen’ [-Wbuiltin-declaration-mismatch] 185 | fail (msg, strlen (msg), "stack smashing detected: terminated"); | ^~~~~~ ../../../gcc/libssp/ssp.c:185:14: note: include ‘<string.h>’ or provide a declaration of ‘strlen’ ../../../gcc/libssp/ssp.c: In function ‘__chk_fail’: ../../../gcc/libssp/ssp.c:192:14: warning: incompatible implicit declaration of built-in function ‘strlen’ [-Wbuiltin-declaration-mismatch] 192 | fail (msg, strlen (msg), "buffer overflow detected: terminated"); | ^~~~~~ ../../../gcc/libssp/ssp.c:192:14: note: include ‘<string.h>’ or provide a declaration of ‘strlen’ make[3]: *** [Makefile:576: ssp.lo] Error 1 make[3]: Leaving directory '${gccobj}/amdgcn-amdhsa/libssp' make[2]: *** [Makefile:441: all] Error 2 make[2]: Leaving directory '${gccobj}/amdgcn-amdhsa/libssp' make[1]: *** [Makefile:13103: all-target-libssp] Error 2 make[1]: Leaving directory '${gccobj}' make: *** [Makefile:1013: all] Error 2 Is there some dependency I could be missing?