I am using g++
to compile a C++ program. I am using the g++ installed through Homebrew (currently g++-13). Now, I installed llvm
through homebrew, and for some reason, it doesn't link it due to some conflicts with Mac's llvm
I guess. I read somewhere we need to have LDFLAGS="-L$HOMEBREW_PREFIX/opt/llvm/lib/c++ -Wl, rpath,$HOMEBREW_PREFIX/opt/llvm/lib/c++"
So, for echo $LDFLAGS
I get,
-L/opt/homebrew/opt/llvm/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++
But, using g++ -std=c++17 -o x x.cpp -fsanitize=address -g
I get the following error:
ld: library not found for -lasan
collect2: error: ld returned 1 exit status
Can someone please help me to resolve this? I am using MacOS Ventura 13.3.1.