I am trying to build clang 16.0.5 for x86_64 Ubuntu 20.04 so that I can build ARM64 executables with Asan. I’ve tried dozens of variants of cmake options and still get complaints when compiling about scudo_standalone not existing. Cannot find much of anything from googling and using Bing chat. What am I doing wrong? Current cmake command, which I wouldn’t be surprised has things I don’t really need it this:
if (SCUDO_STANDALONE_SUPPORTED_ARCH AND
COMPILER_RT_BUILD_SANITIZERS AND
"scudo_standalone" IN_LIST COMPILER_RT_SANITIZERS_TO_BUILD AND
OS_NAME MATCHES "Linux" AND
COMPILER_RT_HAS_AUXV)
set(COMPILER_RT_HAS_SCUDO_STANDALONE TRUE)
else()
set(COMPILER_RT_HAS_SCUDO_STANDALONE FALSE)
endif()
So this means that scudo_standalone target only get loaded when COMPILER_RT_HAS_SCUDO_STANDALONE is TRUE, which requires:
scudo_standalone supports target arch
sanitizers in compiler-rt are not disabled
“scudo_standalone” in COMPILER_RT_SANITIZERS_TO_BUILD
Solution:
add -DCOMPILER_RT_BUILD_GWP_ASAN=FALSE so that gwp_asan is skipped and nothing depends on scudo_standalone
(According to code, this SHOULD work. If not, find the following line in CMakeLists.txt of compiler-rt and change its default to OFF)
option(COMPILER_RT_BUILD_GWP_ASAN "Build GWP-ASan, and link it into SCUDO" ON)
Possible solutions if you do want gwp_asan:
“scudo_standalone” not in COMPILER_RT_SANITIZERS_TO_BUILD
add it (it seems to be automatically added)
sys/auxv.h does not exist
(cross) compile a newer glibc and specify CMAKE_SYSROOT
Lazy solution:
give up compile-rt or just use cross gcc in manufacturer SDK