Solved by using gcc configure option "--disable-libsanitizer" (btw, option "--without-libsanitizer" has no effect) U.Mutlu wrote on 03/27/2019 09:55 PM:
Hi, while building a gcc crosscompiler for ARMv7-a (32bit TARGET="arm-linux-gnueabihf") on a x86_64 linux host, I get the following error that says that PATH_MAX isn't defined while compiling the file gcc-source/libsanitizer/asan/asan_linux.cc, see below. In that file <limits.h> is included, but PATH_MAX is defined in <linux/limits.h>. This error happens in the very last step of the build process ( cd gcc-build ; make -j5 all ; make install ; cd .. ) I used glibc (not newlib). All sources are the latest versions, ie. from git etc. How to fix this bug? Is the processing of this AddressSanitizer file (asan_linux.cc) optional? Thx ######## ... libtool: compile: /data/sw/src/cross/my_cross_build/gcc-build/./gcc/xgcc -shared-libgcc -B/data/sw/src/cross/my_cross_build/gcc-build/./gcc -nostdinc++ -L/data/sw/src/cross/my_cross_build/gcc-build/arm-linu x-gnueabihf/libstdc++-v3/src -L/data/sw/src/cross/my_cross_build/gcc-build/arm-linux-gnueabihf/libstdc++-v3/src/.libs -L/data/sw/src/cross/my_cross_build/gcc-build/arm-linux-gnueabihf/libstdc++-v3/libsupc++/ .libs -B/sw/src/cross/INSTALL_DIR/arm-linux-gnueabihf/bin/ -B/sw/src/cross/INSTALL_DIR/arm-linux-gnueabihf/lib/ -isystem /sw/src/cross/INSTALL_DIR/arm-linux-gnueabihf/include -isystem /sw/src/cross/INSTALL_D IR/arm-linux-gnueabihf/sys-include -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DASAN_HAS_EXCEPTIONS=1 -DASAN_NEEDS_SEGV=1 -DCAN_SANITIZE_UB=0 -I. -I../../../ ../gcc-source/libsanitizer/asan -I.. -I ../../../../gcc-source/libsanitizer/include -I ../../../../gcc-source/libsanitizer -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-b uiltin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -fno-ipa-icf -I../../libstdc++-v3/include -I../../libstdc++-v3/include/arm-linux-gnueabihf -I../ ../../../gcc-source/libsanitizer/../libstdc++-v3/libsupc++ -std=gnu++11 -g -O2 -D_GNU_SOURCE -MT asan_mac.lo -MD -MP -MF .deps/asan_mac.Tpo -c ../../../../gcc-source/libsanitizer/asan/asan_mac.cc -o asan_mac .o >/dev/null 2>&1 ../../../../gcc-source/libsanitizer/asan/asan_linux.cc: In function 'void __asan::AsanCheckIncompatibleRT()': ../../../../gcc-source/libsanitizer/asan/asan_linux.cc:216:21: error: 'PATH_MAX' was not declared in this scope 216 | char filename[PATH_MAX]; | ^~~~~~~~ ../../../../gcc-source/libsanitizer/asan/asan_linux.cc:217:35: error: 'filename' was not declared in this scope; did you mean 'fileno'? 217 | MemoryMappedSegment segment(filename, sizeof(filename)); | ^~~~~~~~ | fileno Makefile:599: recipe for target 'asan_linux.lo' failed make[4]: *** [asan_linux.lo] Error 1 ###### zz@cs5:/data/sw/src/cross/my_cross_build$ find ../INSTALL_DIR/arm-linux-gnueabihf/ -iname "limit*" -ls 12900673 4 -rw-r--r-- 1 zz zz 937 Mar 27 20:08 ../INSTALL_DIR/arm-linux-gnueabihf/include/linux/limits.h 12241315 8 -rw-r--r-- 1 zz zz 5412 Mar 27 20:35 ../INSTALL_DIR/arm-linux-gnueabihf/include/limits.h zz@cs5:/data/sw/src/cross/my_cross_build$ grep "PATH_MAX" ../INSTALL_DIR/arm-linux-gnueabihf/include/limits.h zz@cs5:/data/sw/src/cross/my_cross_build$ grep "PATH_MAX" ../INSTALL_DIR/arm-linux-gnueabihf/include/linux/limits.h #define PATH_MAX 4096 /* # chars in a path name including nul */ #######