sanitizer/asan_interface.h: No such file or directory when building with -fsanitize=address

2,096 views
Skip to first unread message

Benjamin Sapp

unread,
Jun 1, 2016, 3:36:21 PM6/1/16
to Protocol Buffers
Hi, I ran the following:

$ git clone https://github.com/google/protobuf.git
$ cd protobuf
$ bazel build
--copt -fsanitize=address --linkopt -fsanitize=address --copt -DADDRESS_SANITIZER=1 --compilation_mode=fastbuild  --verbose_failures --curses=no :protobuf
INFO
: Loading...
INFO
: Found 1 target...
INFO
: Building...
ERROR
: /tmp/protobuf/BUILD:71:1: C++ compilation of rule '//:protobuf_lite' failed: namespace-sandbox failed: error executing command
 
(cd /home/bensapp/.cache/bazel/_bazel_bensapp/9d77888f7e298040819668f1b7f626a8/protobuf && \
 
exec env - \
    PATH
=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
 
/home/bensapp/.cache/bazel/_bazel_bensapp/9d77888f7e298040819668f1b7f626a8/protobuf/_bin/namespace-sandbox @/home/bensapp/.cache/bazel/_bazel_bensapp/9d77888f7e298040819668f1b7f626a8/protobuf/bazel-sandbox/7e30b972-a4b9-427a-add1-c307b1088902-0.params -- /usr/bin/gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-fsanitize=address' '-DADDRESS_SANITIZER=1' '-std=c++0x' -iquote . -iquote bazel-out/local_linux-fastbuild/genfiles -iquote external/bazel_tools -iquote bazel-out/local_linux-fastbuild/genfiles/external/bazel_tools -isystem src -isystem bazel-out/local_linux-fastbuild/genfiles/src -isystem external/bazel_tools/tools/cpp/gcc3 -DHAVE_PTHREAD -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare '-Wno-error=unused-function' -no-canonical-prefixes -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' '-frandom-seed=bazel-out/local_linux-fastbuild/bin/_objs/protobuf_lite/src/google/protobuf/arena.pic.o' -MD -MF bazel-out/local_linux-fastbuild/bin/_objs/protobuf_lite/src/google/protobuf/arena.pic.d -fPIC -c src/google/protobuf/arena.cc -o bazel-out/local_linux-fastbuild/bin/_objs/protobuf_lite/src/google/protobuf/arena.pic.o).
src
/google/protobuf/arena.cc:35:38: fatal error: sanitizer/asan_interface.h: No such file or directory
 
#include <sanitizer/asan_interface.h>
                                     
^
compilation terminated
.
INFO
: Building complete.
Target //:protobuf failed to build
INFO
: Elapsed time: 0.525s, Critical Path: 0.34s

The only place I have sanitizer/asan_interface.h on my machine is
/usr/lib/llvm-3.6/lib/clang/3.6.0/include/sanitizer/asan_interface.h

but I'm using (and would like to keep using) gcc.

Any advice, or is there a proper place to file a bug?

Jeremy Ong

unread,
Jun 1, 2016, 4:13:13 PM6/1/16
to Benjamin Sapp, Protocol Buffers
Those debug sanitizers are part of the LLVM suite of tools.


--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.



--
Jeremy Ong
PlexChat CTO

Benjamin Sapp

unread,
Jun 1, 2016, 4:52:39 PM6/1/16
to Protocol Buffers, ben...@zoox.com
On Wednesday, June 1, 2016 at 1:13:13 PM UTC-7, Jeremy Ong wrote:
Those debug sanitizers are part of the LLVM suite of tools.

Right.  But we want to link protobuf into our bazel workspace which uses GCC and still have asan work.  Are you saying protobuf is not supported for GCC? 

Feng Xiao

unread,
Jun 1, 2016, 5:05:31 PM6/1/16
to Benjamin Sapp, Protocol Buffers
I guess you just need some additional parameters for you bazel invocation. I'm under the impression that bazel supports some flags that let you easily build cc targets with ASAN. Something like "bazel build --config=asan ...". Could you check with the bazel developers?
Reply all
Reply to author
Forward
0 new messages