It seems the issue is caused by libtool. clang refers to libclang_rt.asan_osx_dynamic.dylib automatically if -fsanitize=address flag has been passed. However, libtool-2.4.6 drops the flag[1][2].
The last commit of libtool adds support for the flag[3]. I modified libtool.sh in my TS build tree, and it works (with -no-undefined flag). So, a workaround is, as described in the FAQ, put the flag in CC and CXX when you run configure. CC="clang -fsanitize=address" CXX="clang++ -fsanitize=address" CXXFLAGS="-Werror -fsanitize=address" CFLAGS="-Werror -fsanitize=address" LDFLAGS="-fsanitize=address" ./configure --disable-luajit [1] https://lists.gnu.org/archive/html/libtool/2014-04/msg00026.html [2] http://www.gnu.org/software/libtool/manual/libtool.html#Stripped-link-flags [3] http://git.savannah.gnu.org/cgit/libtool.git/commit/?id=a5c6466528c060cc4660ad0319c00740db0e42ba On Wed, Jan 13, 2016 at 9:32 PM, Masakazu Kitajo <m4s...@gmail.com> wrote: > Thank you all. > > I tried Bryan's command line, but I'm still not able to build with > -no-undefined flag. -static-libasan flag doesn't work too. > > I'm going to dig a little deeper. It might be needed on TS-3939. > > > Masakazu > > > On Wed, Jan 13, 2016 at 5:57 AM, Bryan Call <bc...@apache.org> wrote: >> >> Free lists are runtime configurable with master and compile time with >> 6.0.0 and earlier releases. >> >> -Bryan >> >> >> >> >> > On Jan 12, 2016, at 10:58 AM, Brian Geffon <briangef...@gmail.com> >> > wrote: >> > >> > Make sure to disable freelists too otherwise you'll miss out a number of >> > potential issues. Also, I've always disabled lua_jit w/ ASAN. >> > >> > Brian >> > >> > On Wed, Jan 13, 2016 at 2:21 AM, Bryan Call <bc...@apache.org> wrote: >> > >> >> This is how I configure my bulids: >> >> >> >> With ASAN: >> >> [bcall@homer ~]$ type tsconfig_asan >> >> tsconfig_asan is aliased to `CXXFLAGS="-Werror -fno-omit-frame-pointer >> >> -fsanitize=address" CFLAGS="-Werror" ./configure --enable-ccache >> >> --enable-experimental-plugins --enable-example-plugins’ >> >> >> >> Without ASAN: >> >> [bcall@homer ~]$ type tsconfig >> >> tsconfig is aliased to `CXXFLAGS="-Werror" CFLAGS="-Werror" ./configure >> >> --enable-ccache --enable-experimental-plugins’ >> >> >> >> -Bryan >> >> >> >> >> >> >> >> >> >>> On Jan 12, 2016, at 12:40 AM, Masakazu Kitajo <mas...@apache.org> >> >>> wrote: >> >>> >> >>> Hi there, >> >>> >> >>> I can enable ASAN with -fsanitize=address flag but I also needed to >> >> remove >> >>> -no-undefined flag manually from some modules' Makefiles. >> >>> >> >>> Without the modification, I get link errors such like below: >> >>> https://paste.apache.org/5sR6 >> >>> >> >>> According to the wiki, it seems we can't use ASAN with -no-undefined. >> >>> https://github.com/google/sanitizers/wiki/AddressSanitizer >> >>> >> >>> So my questions are: >> >>> - How do you enable ASAN? (How/Where do you specify the flag?) >> >>> - How can I avoid the link error without manual modifications? >> >>> >> >>> My build environment is OS X (Yosemite) with Apple LLVM version 7.0.2 >> >>> (clang-700.1.81) >> >>> >> >>> Thanks, >> >>> Masakazu >> >> >> >> >> >