I'm trying to build a cpp program on AIX 7.2 using gcc with address sanitizer (-fsanitize=address) but this errors out with:
cc1plus: warning: '-fsanitize=address' not supported for this target
collect2: fatal error: library libasan not found
compilation terminated.
I thought maybe the compilation will succeed if I have the libasan shared library. So I tried building llvm from source but running into the same issue with that:
> export CC=gcc; export CXX=g++;
> cmake -DLLVM_ENABLE_PROJECTS=clang -DLLVM_ENABLE_RUNTIMES=compiler-rt -DCMAKE_INSTALL_PREFIX=/llvm_install -DLLVM_USE_SANITIZER=Address -DCMAKE_BUILD_TYPE=Debug -DLLVM_TARGETS_TO_BUILD="PowerPC" -G "Unix Makefiles" /llvm-project/llvm
Consolidate compiler generated dependencies of target LLVMDemangle
[ 0%] Building CXX object lib/Demangle/CMakeFiles/LLVMDemangle.dir/Demangle.cpp.o
cc1plus: error: '-fsanitize=address' not supported for this target [-Werror]
cc1plus: all warnings being treated as errors
My environment:
gcc version 10.3.0
cmake version 3.20.0
AIX 7.2
Questions:
- Does gcc not support
fsanitize=addresson AIX? - Has someone successfully built a cpp program with address sanitizer on AIX? If so, can you please share the steps.
- Do I need to use xlc? Is there no way to make this work with
gcc?
Apologies if this it not the right forum to ask AIX queries.