Created attachment 50334 [details] sanitizers do not find PATH_MAX and use linux headers I try to cross compile gcc from windows to freebsd. PATH_MAX does not exist.
../../../../../../../gcc/libsanitizer/asan/asan_linux.cpp: In function 'void __asan::AsanCheckIncompatibleRT()': ../../../../../../../gcc/libsanitizer/asan/asan_linux.cpp:200:21: error: 'PATH_MAX' was not declared in this scope 200 | char filename[PATH_MAX]; | ^~~~~~~~ ../../../../../../../gcc/libsanitizer/asan/asan_linux.cpp:201:35: error: 'filename' was not declared in this scope; did you mean 'rename'? 201 | MemoryMappedSegment segment(filename, sizeof(filename)); | ^~~~~~~~ | rename The bug is still in the source
Since commit 59e4c98173a79fcaa2c33253261409f38856c384 You can add an configure option --includedir=/you/sysroot/include to solve this problem. /you/sysroot/include should contains a real workable limits.h. The reason is due to that if gcc cannot find a limits.h, it will use its ./gcc/glimits.h, which has no PATH_MAX defined.
I had a similar issue when compiling GCC targeting i686-linux on x86_64 debian, and --includedir= helped, thanks! I had to do the following: ../configure --target=i686-linux-gnu --disable-bootstrap --prefix=/usr --includedir=/usr/i686-linux-gnu/include
This has to do with the way you are doing the cross compiling. Either use a sysroot (with --with-sysroot=DIR) or use includedir as directed below.