Closed wlfans123 closed 5 years ago
So do you want build uftrace itself with Asan, right? AFAIK Asan has a tricky requirements that might conflict with uftrace.
Anyway I guess it's because Asan added some references to its internal functions which will be resolved at runtime (so it's undefined now). Currently libmcount does not allow any undefined symbol. Does below patch fix your problem?
diff --git a/Makefile b/Makefile
index 7ba26e9f..98ae353a 100644
--- a/Makefile
+++ b/Makefile
@@ -76,7 +76,7 @@ TEST_CFLAGS = $(COMMON_CFLAGS) -DUNIT_TEST
UFTRACE_LDFLAGS = $(COMMON_LDFLAGS) $(LDFLAGS_$@) $(LDFLAGS_uftrace)
DEMANGLER_LDFLAGS = $(COMMON_LDFLAGS) $(LDFLAGS_$@) $(LDFLAGS_demangler)
SYMBOLS_LDFLAGS = $(COMMON_LDFLAGS) $(LDFLAGS_$@) $(LDFLAGS_symbols)
-LIB_LDFLAGS = $(COMMON_LDFLAGS) $(LDFLAGS_$@) $(LDFLAGS_lib) -Wl,--no-undefined
+LIB_LDFLAGS = $(COMMON_LDFLAGS) $(LDFLAGS_$@) $(LDFLAGS_lib)
TEST_LDFLAGS = $(COMMON_LDFLAGS) -L$(objdir)/libtraceevent -ltraceevent
ifeq ($(DEBUG), 1)
No. Compilation succeeded.
But, When run uftrace, get a new error.
Error Log:
$:~/uftrace$ make install
INSTALL uftrace
INSTALL libmcount
INSTALL bash-completion
GEN uftrace.1
GEN uftrace-record.1
GEN uftrace-replay.1
GEN uftrace-live.1
GEN uftrace-report.1
GEN uftrace-recv.1
GEN uftrace-info.1
GEN uftrace-dump.1
GEN uftrace-graph.1
GEN uftrace-script.1
GEN uftrace-tui.1
INSTALL man-pages
$:~/uftrace/build/bin$ cp ../../tests/s-hello.c .
$:~/uftrace/build/bin$ gcc -pg s-hello.c
$:~/uftrace/build/bin$ ./uftrace ./a.out
./a.out: symbol lookup error: /home/user/uftrace/build/lib/libmcount-fast.so: undefined symbol: __asan_option_detect_stack_use_after_return
uftrace: /home/user/uftrace/cmds/record.c:1357:save_session_symbols
ERROR: cannot find map files: No such file or directory
address sanitizer build is possible as follows:
$ make ASAN=1
I also made one of asan report in #803.
I think we can close this. Please use make ASAN=1
.
when I run AddressSanitizer Build, I got an error like below:
What's the solution?
Build command line:
Error Log: