0

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:

  1. Does gcc not support fsanitize=address on AIX?
  2. Has someone successfully built a cpp program with address sanitizer on AIX? If so, can you please share the steps.
  3. 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.

3
  • 1
    I think your 1. question is quite explicitly answered by the output you've gotten. Commented Jan 15, 2024 at 13:47
  • I had to work in an AIX environment 10 yrs ago, and I found there was more "native" AIX users on ittoolbox.com. You have to register as a user, and then find/join the AIX specific "forum" (this may all be different now). Later I discovered there are (even better) support forums under ibm.com, and was able to find what I needed without posting a question. Commented Jan 15, 2024 at 15:52
  • If your program works with libasan, then it will work without it as well. Commented Jan 18, 2024 at 11:09

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.