It works. Thank you very much!!!

On Tue, Apr 10, 2018 at 2:40 PM, Michal Privoznik <mprivozn@redhat.com> wrote:
On 04/10/2018 05:22 AM, Han Han wrote:
> Hi,
> I tried to compile libvirt with address sanitizer(
> https://github.com/google/sanitizers/wiki/AddressSanitizer) to discover
> memory errors. But fails when make.
> Code version:
> $ git describe
> v4.2.0-92-g3f204e4de
>
> Compile tools:
> automake 1:1.15.1-3 all [installed]
> clang-7 1:7~svn323616-1 amd64 [installed,automatic]
> make 4.2.1-1 amd64 [installed,automatic]
>
> Compile steps:
> $ ./bootstrap
> $ CC=clang-7 CFLAGS="-g -O1 -fsanitize=address -fno-omit-frame-pointer
> -Wno-error" LDFLAGS="-fsanitize=address" ./configure
>
> Configure succed.
> $ make
> But error appeared:
> make  all-am
> make[3]: Entering directory '/home/hhan/Software/libvirt/src'
>   CCLD     libvirt.la
> ./.libs/libvirt_util.a(libvirt_util_la-viralloc.o): In function `virAlloc':
> /home/hhan/Software/libvirt/src/util/viralloc.c:144: undefined reference to
> `__asan_report_store8'

Huh, I remember seeing different error when trying this (although I'm
using gcc). However, I suspect '-Wl,-z -Wl,defs' arguments are problem.
We add them onto linker cmd line. You can try applying this patch and
see if it helps:

diff --git i/configure.ac w/configure.ac
index 18587270e6..e23c0e4c22 100644
--- i/configure.ac
+++ w/configure.ac
@@ -237,7 +237,6 @@ LIBVIRT_COMPILE_WARNINGS
 LIBVIRT_COMPILE_PIE
 LIBVIRT_LINKER_RELRO
 LIBVIRT_LINKER_NO_INDIRECT
-LIBVIRT_LINKER_NO_UNDEFINED

 LIBVIRT_ARG_APPARMOR
 LIBVIRT_ARG_ATTR


Michal



--
Best regards,
-----------------------------------
Han Han
Quality Engineer
Redhat.

Email: hhan@redhat.com
Phone: +861065339333