Re: Fail to compile libvirt with address sanitizer by clang-7

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It works. Thank you very much!!!

On Tue, Apr 10, 2018 at 2:40 PM, Michal Privoznik <mprivozn@xxxxxxxxxx> 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@xxxxxxxxxx
Phone: +861065339333
_______________________________________________
libvirt-users mailing list
libvirt-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvirt-users

[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux