diff mbox series

[v2,2/6] package/llvm: install target binary/debug tools

Message ID 1542426982-54683-2-git-send-email-matthew.weber@rockwellcollins.com
State Superseded
Headers show
Series [v2,1/6] package/compiler-rt: new package | expand

Commit Message

Matt Weber Nov. 17, 2018, 3:56 a.m. UTC
The compiler-rt fuzzer and address sanitizer tools require additional
LLVM binary tools installed to allow stack trace decoding actively during
executable analysis.

https://github.com/google/sanitizers/wiki/AddressSanitizerCallStack

Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
Reviewed-by: Romain Naour <romain.naour@smile.fr>
---
Changes
v1 -> v2
 - None
---
 package/llvm/llvm.mk | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Romain Naour Nov. 18, 2018, 7:14 p.m. UTC | #1
Hi Matt,

Le 17/11/2018 à 04:56, Matt Weber a écrit :
> The compiler-rt fuzzer and address sanitizer tools require additional
> LLVM binary tools installed to allow stack trace decoding actively during
> executable analysis.
> 
> https://github.com/google/sanitizers/wiki/AddressSanitizerCallStack
> 
> Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
> Reviewed-by: Romain Naour <romain.naour@smile.fr>

For some reason I get an error while building llvm package tools.

x86_64-linux-g++: WARNING: unsafe header/library path used in cross-compilation:
'-I/usr/include/libxml2'

Can you have a look?

Best regards,
Romain

> ---
> Changes
> v1 -> v2
>  - None
> ---
>  package/llvm/llvm.mk | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/package/llvm/llvm.mk b/package/llvm/llvm.mk
> index 1f9bd44..79477f0 100644
> --- a/package/llvm/llvm.mk
> +++ b/package/llvm/llvm.mk
> @@ -197,8 +197,17 @@ HOST_LLVM_CONF_OPTS += \
>  # We need to activate LLVM_INCLUDE_TOOLS, otherwise it does not generate
>  # libLLVM.so
>  LLVM_CONF_OPTS += \
> -	-DLLVM_INCLUDE_TOOLS=ON \
> +	-DLLVM_INCLUDE_TOOLS=ON
> +
> +# The llvm-symbolizer binary is used by the Compiler-RT Fuzzer
> +# and AddressSanitizer tools for stack traces.
> +ifeq ($(BR2_PACKAGE_COMPILER_RT),y)
> +LLVM_CONF_OPTS += \
> +	-DLLVM_BUILD_TOOLS=ON
> +else
> +LLVM_CONF_OPTS += \
>  	-DLLVM_BUILD_TOOLS=OFF
> +endif
>  
>  # Compiler-rt not in the source tree.
>  # llvm runtime libraries are not in the source tree.
>
Matt Weber Nov. 19, 2018, 1:48 a.m. UTC | #2
Romain,

On Sun, Nov 18, 2018 at 1:14 PM Romain Naour <romain.naour@smile.fr> wrote:
>
> Hi Matt,
>
> Le 17/11/2018 à 04:56, Matt Weber a écrit :
> > The compiler-rt fuzzer and address sanitizer tools require additional
> > LLVM binary tools installed to allow stack trace decoding actively during
> > executable analysis.
> >
> > https://github.com/google/sanitizers/wiki/AddressSanitizerCallStack
> >
> > Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
> > Reviewed-by: Romain Naour <romain.naour@smile.fr>
>
> For some reason I get an error while building llvm package tools.
>
> x86_64-linux-g++: WARNING: unsafe header/library path used in cross-compilation:
> '-I/usr/include/libxml2'
>
> Can you have a look?

I went back and checked my logs on the clang compiler-rt run-test
build for that warning and didn't find it.  I then checked and my
config and it has the unsafe header/library as error.  Was your build
test just applying my patches and doing an explicit 'make llvm'?

Thanks
Matt
Romain Naour Nov. 19, 2018, 8:09 a.m. UTC | #3
Hi Matt,

Le lun. 19 nov. 2018 à 02:48, Matthew Weber <
matthew.weber@rockwellcollins.com> a écrit :

> Romain,
>
> On Sun, Nov 18, 2018 at 1:14 PM Romain Naour <romain.naour@smile.fr>
> wrote:
> >
> > Hi Matt,
> >
> > Le 17/11/2018 à 04:56, Matt Weber a écrit :
> > > The compiler-rt fuzzer and address sanitizer tools require additional
> > > LLVM binary tools installed to allow stack trace decoding actively
> during
> > > executable analysis.
> > >
> > > https://github.com/google/sanitizers/wiki/AddressSanitizerCallStack
> > >
> > > Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
> > > Reviewed-by: Romain Naour <romain.naour@smile.fr>
> >
> > For some reason I get an error while building llvm package tools.
> >
> > x86_64-linux-g++: WARNING: unsafe header/library path used in
> cross-compilation:
> > '-I/usr/include/libxml2'
> >
> > Can you have a look?
>
> I went back and checked my logs on the clang compiler-rt run-test
> build for that warning and didn't find it.  I then checked and my
> config and it has the unsafe header/library as error.  Was your build
> test just applying my patches and doing an explicit 'make llvm'?
>

Indeed,
Some tools use libxml2, so you have to add target libxml2 package as build
dependency.

Best regards,
Romain


> Thanks
> Matt
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>
<div dir="auto"><div>Hi Matt,<br><br><div class="gmail_quote"><div dir="ltr">Le lun. 19 nov. 2018 à 02:48, Matthew Weber &lt;<a href="mailto:matthew.weber@rockwellcollins.com">matthew.weber@rockwellcollins.com</a>&gt; a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Romain,<br>
<br>
On Sun, Nov 18, 2018 at 1:14 PM Romain Naour &lt;<a href="mailto:romain.naour@smile.fr" target="_blank" rel="noreferrer">romain.naour@smile.fr</a>&gt; wrote:<br>
&gt;<br>
&gt; Hi Matt,<br>
&gt;<br>
&gt; Le 17/11/2018 à 04:56, Matt Weber a écrit :<br>
&gt; &gt; The compiler-rt fuzzer and address sanitizer tools require additional<br>
&gt; &gt; LLVM binary tools installed to allow stack trace decoding actively during<br>
&gt; &gt; executable analysis.<br>
&gt; &gt;<br>
&gt; &gt; <a href="https://github.com/google/sanitizers/wiki/AddressSanitizerCallStack" rel="noreferrer noreferrer" target="_blank">https://github.com/google/sanitizers/wiki/AddressSanitizerCallStack</a><br>
&gt; &gt;<br>
&gt; &gt; Signed-off-by: Matthew Weber &lt;<a href="mailto:matthew.weber@rockwellcollins.com" target="_blank" rel="noreferrer">matthew.weber@rockwellcollins.com</a>&gt;<br>
&gt; &gt; Reviewed-by: Romain Naour &lt;<a href="mailto:romain.naour@smile.fr" target="_blank" rel="noreferrer">romain.naour@smile.fr</a>&gt;<br>
&gt;<br>
&gt; For some reason I get an error while building llvm package tools.<br>
&gt;<br>
&gt; x86_64-linux-g++: WARNING: unsafe header/library path used in cross-compilation:<br>
&gt; &#39;-I/usr/include/libxml2&#39;<br>
&gt;<br>
&gt; Can you have a look?<br>
<br>
I went back and checked my logs on the clang compiler-rt run-test<br>
build for that warning and didn&#39;t find it.  I then checked and my<br>
config and it has the unsafe header/library as error.  Was your build<br>
test just applying my patches and doing an explicit &#39;make llvm&#39;?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Indeed,</div><div dir="auto">Some tools use libxml2, so you have to add target libxml2 package as build dependency.</div><div dir="auto"><br></div><div dir="auto">Best regards,</div><div dir="auto">Romain</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Thanks<br>
Matt<br>
_______________________________________________<br>
buildroot mailing list<br>
<a href="mailto:buildroot@busybox.net" target="_blank" rel="noreferrer">buildroot@busybox.net</a><br>
<a href="http://lists.busybox.net/mailman/listinfo/buildroot" rel="noreferrer noreferrer" target="_blank">http://lists.busybox.net/mailman/listinfo/buildroot</a><br>
</blockquote></div></div></div>
Matt Weber Nov. 19, 2018, 1:04 p.m. UTC | #4
Romain,

On Mon, Nov 19, 2018 at 2:10 AM Romain Naour <romain.naour@gmail.com> wrote:
>
> Hi Matt,
>
> Le lun. 19 nov. 2018 à 02:48, Matthew Weber <matthew.weber@rockwellcollins.com> a écrit :
>>
>> Romain,
>>
>> On Sun, Nov 18, 2018 at 1:14 PM Romain Naour <romain.naour@smile.fr> wrote:
>> >
>> > Hi Matt,
>> >
>> > Le 17/11/2018 à 04:56, Matt Weber a écrit :
>> > > The compiler-rt fuzzer and address sanitizer tools require additional
>> > > LLVM binary tools installed to allow stack trace decoding actively during
>> > > executable analysis.
>> > >
>> > > https://github.com/google/sanitizers/wiki/AddressSanitizerCallStack
>> > >
>> > > Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
>> > > Reviewed-by: Romain Naour <romain.naour@smile.fr>
>> >
>> > For some reason I get an error while building llvm package tools.
>> >
>> > x86_64-linux-g++: WARNING: unsafe header/library path used in cross-compilation:
>> > '-I/usr/include/libxml2'
>> >
>> > Can you have a look?
>>
>> I went back and checked my logs on the clang compiler-rt run-test
>> build for that warning and didn't find it.  I then checked and my
>> config and it has the unsafe header/library as error.  Was your build
>> test just applying my patches and doing an explicit 'make llvm'?
>
>
> Indeed,
> Some tools use libxml2, so you have to add target libxml2 package as build dependency.
>

Would you mind sharing your verbose output and equivalent of cmake
config guess/status?
Romain Naour Nov. 20, 2018, 10:36 p.m. UTC | #5
Hi Matt,

Le 19/11/2018 à 14:04, Matthew Weber a écrit :
> Romain,
> 
> On Mon, Nov 19, 2018 at 2:10 AM Romain Naour <romain.naour@gmail.com> wrote:
>>
>> Hi Matt,
>>
>> Le lun. 19 nov. 2018 à 02:48, Matthew Weber <matthew.weber@rockwellcollins.com> a écrit :
>>>
>>> Romain,
>>>
>>> On Sun, Nov 18, 2018 at 1:14 PM Romain Naour <romain.naour@smile.fr> wrote:
>>>>
>>>> Hi Matt,
>>>>
>>>> Le 17/11/2018 à 04:56, Matt Weber a écrit :
>>>>> The compiler-rt fuzzer and address sanitizer tools require additional
>>>>> LLVM binary tools installed to allow stack trace decoding actively during
>>>>> executable analysis.
>>>>>
>>>>> https://github.com/google/sanitizers/wiki/AddressSanitizerCallStack
>>>>>
>>>>> Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
>>>>> Reviewed-by: Romain Naour <romain.naour@smile.fr>
>>>>
>>>> For some reason I get an error while building llvm package tools.
>>>>
>>>> x86_64-linux-g++: WARNING: unsafe header/library path used in cross-compilation:
>>>> '-I/usr/include/libxml2'
>>>>
>>>> Can you have a look?
>>>
>>> I went back and checked my logs on the clang compiler-rt run-test
>>> build for that warning and didn't find it.  I then checked and my
>>> config and it has the unsafe header/library as error.  Was your build
>>> test just applying my patches and doing an explicit 'make llvm'?
>>
>>
>> Indeed,
>> Some tools use libxml2, so you have to add target libxml2 package as build dependency.
>>
> 
> Would you mind sharing your verbose output and equivalent of cmake
> config guess/status?
> 

I need to rebuild from scratch since I've fixed the build locally.
I'll restart a new one next week-end.

Best regards,
Romain
Matt Weber Nov. 20, 2018, 10:44 p.m. UTC | #6
Romain,


On Tue, Nov 20, 2018, 16:37 Romain Naour <romain.naour@gmail.com wrote:

> Hi Matt,
>
> Le 19/11/2018 à 14:04, Matthew Weber a écrit :
> > Romain,
> >
> > On Mon, Nov 19, 2018 at 2:10 AM Romain Naour <romain.naour@gmail.com>
> wrote:
> >>
> >> Hi Matt,
> >>
> >> Le lun. 19 nov. 2018 à 02:48, Matthew Weber <
> matthew.weber@rockwellcollins.com> a écrit :
> >>>
> >>> Romain,
> >>>
> >>> On Sun, Nov 18, 2018 at 1:14 PM Romain Naour <romain.naour@smile.fr>
> wrote:
> >>>>
> >>>> Hi Matt,
> >>>>
> >>>> Le 17/11/2018 à 04:56, Matt Weber a écrit :
> >>>>> The compiler-rt fuzzer and address sanitizer tools require additional
> >>>>> LLVM binary tools installed to allow stack trace decoding actively
> during
> >>>>> executable analysis.
> >>>>>
> >>>>> https://github.com/google/sanitizers/wiki/AddressSanitizerCallStack
> >>>>>
> >>>>> Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
> >>>>> Reviewed-by: Romain Naour <romain.naour@smile.fr>
> >>>>
> >>>> For some reason I get an error while building llvm package tools.
> >>>>
> >>>> x86_64-linux-g++: WARNING: unsafe header/library path used in
> cross-compilation:
> >>>> '-I/usr/include/libxml2'
> >>>>
> >>>> Can you have a look?
> >>>
> >>> I went back and checked my logs on the clang compiler-rt run-test
> >>> build for that warning and didn't find it.  I then checked and my
> >>> config and it has the unsafe header/library as error.  Was your build
> >>> test just applying my patches and doing an explicit 'make llvm'?
> >>
> >>
> >> Indeed,
> >> Some tools use libxml2, so you have to add target libxml2 package as
> build dependency.
> >>
> >
> > Would you mind sharing your verbose output and equivalent of cmake
> > config guess/status?
> >
>
> I need to rebuild from scratch since I've fixed the build locally.
> I'll restart a new one next week-end.
>

When I searched the llvm build, I see there are some xml dependencies.  I
hadn't got far enough to find the variables in llvm build to adjust or if I
just need to make sure libxml2 is built first.


>
>
>
>
> Best regards,
> Romain
>
<div dir="auto"><div>Romain,</div><div dir="auto"><br><br><div class="gmail_quote" dir="auto"><div dir="ltr">On Tue, Nov 20, 2018, 16:37 Romain Naour &lt;<a href="mailto:romain.naour@gmail.com">romain.naour@gmail.com</a> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Matt,<br>
<br>
Le 19/11/2018 à 14:04, Matthew Weber a écrit :<br>
&gt; Romain,<br>
&gt; <br>
&gt; On Mon, Nov 19, 2018 at 2:10 AM Romain Naour &lt;<a href="mailto:romain.naour@gmail.com" target="_blank" rel="noreferrer">romain.naour@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Hi Matt,<br>
&gt;&gt;<br>
&gt;&gt; Le lun. 19 nov. 2018 à 02:48, Matthew Weber &lt;<a href="mailto:matthew.weber@rockwellcollins.com" target="_blank" rel="noreferrer">matthew.weber@rockwellcollins.com</a>&gt; a écrit :<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Romain,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On Sun, Nov 18, 2018 at 1:14 PM Romain Naour &lt;<a href="mailto:romain.naour@smile.fr" target="_blank" rel="noreferrer">romain.naour@smile.fr</a>&gt; wrote:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Hi Matt,<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Le 17/11/2018 à 04:56, Matt Weber a écrit :<br>
&gt;&gt;&gt;&gt;&gt; The compiler-rt fuzzer and address sanitizer tools require additional<br>
&gt;&gt;&gt;&gt;&gt; LLVM binary tools installed to allow stack trace decoding actively during<br>
&gt;&gt;&gt;&gt;&gt; executable analysis.<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; <a href="https://github.com/google/sanitizers/wiki/AddressSanitizerCallStack" rel="noreferrer noreferrer" target="_blank">https://github.com/google/sanitizers/wiki/AddressSanitizerCallStack</a><br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; Signed-off-by: Matthew Weber &lt;<a href="mailto:matthew.weber@rockwellcollins.com" target="_blank" rel="noreferrer">matthew.weber@rockwellcollins.com</a>&gt;<br>
&gt;&gt;&gt;&gt;&gt; Reviewed-by: Romain Naour &lt;<a href="mailto:romain.naour@smile.fr" target="_blank" rel="noreferrer">romain.naour@smile.fr</a>&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; For some reason I get an error while building llvm package tools.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; x86_64-linux-g++: WARNING: unsafe header/library path used in cross-compilation:<br>
&gt;&gt;&gt;&gt; &#39;-I/usr/include/libxml2&#39;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Can you have a look?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I went back and checked my logs on the clang compiler-rt run-test<br>
&gt;&gt;&gt; build for that warning and didn&#39;t find it.  I then checked and my<br>
&gt;&gt;&gt; config and it has the unsafe header/library as error.  Was your build<br>
&gt;&gt;&gt; test just applying my patches and doing an explicit &#39;make llvm&#39;?<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Indeed,<br>
&gt;&gt; Some tools use libxml2, so you have to add target libxml2 package as build dependency.<br>
&gt;&gt;<br>
&gt; <br>
&gt; Would you mind sharing your verbose output and equivalent of cmake<br>
&gt; config guess/status?<br>
&gt; <br>
<br>
I need to rebuild from scratch since I&#39;ve fixed the build locally.<br>
I&#39;ll restart a new one next week-end.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">When I searched the llvm build, I see there are some xml dependencies.  I hadn&#39;t got far enough to find the variables in llvm build to adjust or if I just need to make sure libxml2 is built first.</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote" dir="auto"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br><br><br><br><br>
Best regards,<br>
Romain<br>
</blockquote></div></div></div>
Matt Weber Nov. 21, 2018, 3:12 a.m. UTC | #7
On Tue, Nov 20, 2018 at 4:37 PM Romain Naour <romain.naour@gmail.com> wrote:
>
> Hi Matt,
>
> Le 19/11/2018 à 14:04, Matthew Weber a écrit :
> > Romain,
> >
> > On Mon, Nov 19, 2018 at 2:10 AM Romain Naour <romain.naour@gmail.com> wrote:
> >>
> >> Hi Matt,
> >>
> >> Le lun. 19 nov. 2018 à 02:48, Matthew Weber <matthew.weber@rockwellcollins.com> a écrit :
> >>>
> >>> Romain,
> >>>
> >>> On Sun, Nov 18, 2018 at 1:14 PM Romain Naour <romain.naour@smile.fr> wrote:
> >>>>
> >>>> Hi Matt,
> >>>>
> >>>> Le 17/11/2018 à 04:56, Matt Weber a écrit :
> >>>>> The compiler-rt fuzzer and address sanitizer tools require additional
> >>>>> LLVM binary tools installed to allow stack trace decoding actively during
> >>>>> executable analysis.
> >>>>>
> >>>>> https://github.com/google/sanitizers/wiki/AddressSanitizerCallStack
> >>>>>
> >>>>> Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
> >>>>> Reviewed-by: Romain Naour <romain.naour@smile.fr>
> >>>>
> >>>> For some reason I get an error while building llvm package tools.
> >>>>
> >>>> x86_64-linux-g++: WARNING: unsafe header/library path used in cross-compilation:
> >>>> '-I/usr/include/libxml2'
> >>>>
> >>>> Can you have a look?
> >>>
> >>> I went back and checked my logs on the clang compiler-rt run-test
> >>> build for that warning and didn't find it.  I then checked and my
> >>> config and it has the unsafe header/library as error.  Was your build
> >>> test just applying my patches and doing an explicit 'make llvm'?
> >>
> >>
> >> Indeed,
> >> Some tools use libxml2, so you have to add target libxml2 package as build dependency.
> >>
> >
> > Would you mind sharing your verbose output and equivalent of cmake
> > config guess/status?
> >
>
> I need to rebuild from scratch since I've fixed the build locally.
> I'll restart a new one next week-end.
>

Something like the following added to package/llvm/llvm.mk?  (Still
haven't see this on my end.  I messed with my host system a bit to get
libxml2 support and headers in place, no luck.)

# LLVM requires libxml2
HOST_LLVM_CONF_OPTS += \
       -DLIBXML2_LIBRARIES=$(HOST_DIR)/lib \
       -DLIBXML2_INCLUDE_DIR=$(HOST_DIR)/include/libxml2
HOST_LLVM_DEPENDENCIES += host-libxml2
LLVM_CONF_OPTS += \
       -DLIBXML2_LIBRARIES=$(STAGING_DIR)/usr/lib \
       -DLIBXML2_INCLUDE_DIR=$(STAGING_DIR)/usr/include/libxml2
LLVM_DEPENDENCIES += libxml2

The interesting thing is that it looks like just a windows manifest
manager source file uses the libxml2.  Unsure of it's role....


Matt
Romain Naour Nov. 21, 2018, 9:18 p.m. UTC | #8
Hi Matt,

Le 21/11/2018 à 04:12, Matthew Weber a écrit :
> On Tue, Nov 20, 2018 at 4:37 PM Romain Naour <romain.naour@gmail.com> wrote:
>>
>> Hi Matt,
>>
>> Le 19/11/2018 à 14:04, Matthew Weber a écrit :
>>> Romain,
>>>
>>> On Mon, Nov 19, 2018 at 2:10 AM Romain Naour <romain.naour@gmail.com> wrote:
>>>>
>>>> Hi Matt,
>>>>
>>>> Le lun. 19 nov. 2018 à 02:48, Matthew Weber <matthew.weber@rockwellcollins.com> a écrit :
>>>>>
>>>>> Romain,
>>>>>
>>>>> On Sun, Nov 18, 2018 at 1:14 PM Romain Naour <romain.naour@smile.fr> wrote:
>>>>>>
>>>>>> Hi Matt,
>>>>>>
>>>>>> Le 17/11/2018 à 04:56, Matt Weber a écrit :
>>>>>>> The compiler-rt fuzzer and address sanitizer tools require additional
>>>>>>> LLVM binary tools installed to allow stack trace decoding actively during
>>>>>>> executable analysis.
>>>>>>>
>>>>>>> https://github.com/google/sanitizers/wiki/AddressSanitizerCallStack
>>>>>>>
>>>>>>> Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
>>>>>>> Reviewed-by: Romain Naour <romain.naour@smile.fr>
>>>>>>
>>>>>> For some reason I get an error while building llvm package tools.
>>>>>>
>>>>>> x86_64-linux-g++: WARNING: unsafe header/library path used in cross-compilation:
>>>>>> '-I/usr/include/libxml2'
>>>>>>
>>>>>> Can you have a look?
>>>>>
>>>>> I went back and checked my logs on the clang compiler-rt run-test
>>>>> build for that warning and didn't find it.  I then checked and my
>>>>> config and it has the unsafe header/library as error.  Was your build
>>>>> test just applying my patches and doing an explicit 'make llvm'?
>>>>
>>>>
>>>> Indeed,
>>>> Some tools use libxml2, so you have to add target libxml2 package as build dependency.
>>>>
>>>
>>> Would you mind sharing your verbose output and equivalent of cmake
>>> config guess/status?
>>>
>>
>> I need to rebuild from scratch since I've fixed the build locally.
>> I'll restart a new one next week-end.
>>
> 
> Something like the following added to package/llvm/llvm.mk?  (Still
> haven't see this on my end.  I messed with my host system a bit to get
> libxml2 support and headers in place, no luck.)
> 
> # LLVM requires libxml2
> HOST_LLVM_CONF_OPTS += \
>        -DLIBXML2_LIBRARIES=$(HOST_DIR)/lib \
>        -DLIBXML2_INCLUDE_DIR=$(HOST_DIR)/include/libxml2
> HOST_LLVM_DEPENDENCIES += host-libxml2
> LLVM_CONF_OPTS += \
>        -DLIBXML2_LIBRARIES=$(STAGING_DIR)/usr/lib \
>        -DLIBXML2_INCLUDE_DIR=$(STAGING_DIR)/usr/include/libxml2
> LLVM_DEPENDENCIES += libxml2

I reproduced the issue: https://pastebin.com/s8PZvuGt

The CMakeCache.txt content seems interesting:

//Path to a file.
LIBXML2_INCLUDE_DIR:PATH=LIBXML2_INCLUDE_DIR-NOTFOUND

//Path to a library.
LIBXML2_LIBRARY:FILEPATH=LIBXML2_LIBRARY-NOTFOUND

//Path to a program.
LIBXML2_XMLLINT_EXECUTABLE:FILEPATH=/usr/bin/xmllint

//Use libxml2 if available. Can be ON, OFF, or FORCE_ON
LLVM_ENABLE_LIBXML2:STRING=ON

LLVM_ENABLE_LIBXML2 allow to define LLVM_LIBXML2_ENABLED

$ grep -r LLVM_LIBXML2_ENABLED in the build directory:
cmake/modules/CMakeFiles/LLVMConfig.cmake:set(LLVM_LIBXML2_ENABLED 0)
NATIVE/cmake/modules/CMakeFiles/LLVMConfig.cmake:set(LLVM_LIBXML2_ENABLED 1)
NATIVE/lib/cmake/llvm/LLVMConfig.cmake:set(LLVM_LIBXML2_ENABLED 1)
NATIVE/include/llvm/Config/config.h:#define LLVM_LIBXML2_ENABLED 1
lib/cmake/llvm/LLVMConfig.cmake:set(LLVM_LIBXML2_ENABLED 0)
include/llvm/Config/config.h:/* #undef LLVM_LIBXML2_ENABLED */

It seems that llvm try to build something for the host (NATIVE) while building
target llvm package. Sadly it use the cross-compiler to build them and that is
why we hit the paranoid wrapper.

> 
> The interesting thing is that it looks like just a windows manifest
> manager source file uses the libxml2.  Unsure of it's role....

Then we can just add -DLLVM_ENABLE_LIBXML2=OFF for host-llvm and llvm.

Best regards,
Romain

> 
> 
> Matt
>
Matt Weber Nov. 22, 2018, 3:14 a.m. UTC | #9
Romain,

On Wed, Nov 21, 2018 at 3:19 PM Romain Naour <romain.naour@gmail.com> wrote:
>
> Hi Matt,
>
> Le 21/11/2018 à 04:12, Matthew Weber a écrit :
> > On Tue, Nov 20, 2018 at 4:37 PM Romain Naour <romain.naour@gmail.com> wrote:
> >>
> >> Hi Matt,
> >>
> >> Le 19/11/2018 à 14:04, Matthew Weber a écrit :
> >>> Romain,
> >>>
> >>> On Mon, Nov 19, 2018 at 2:10 AM Romain Naour <romain.naour@gmail.com> wrote:
> >>>>
> >>>> Hi Matt,
> >>>>
> >>>> Le lun. 19 nov. 2018 à 02:48, Matthew Weber <matthew.weber@rockwellcollins.com> a écrit :
> >>>>>
> >>>>> Romain,
> >>>>>
> >>>>> On Sun, Nov 18, 2018 at 1:14 PM Romain Naour <romain.naour@smile.fr> wrote:
> >>>>>>
> >>>>>> Hi Matt,
> >>>>>>
> >>>>>> Le 17/11/2018 à 04:56, Matt Weber a écrit :
> >>>>>>> The compiler-rt fuzzer and address sanitizer tools require additional
> >>>>>>> LLVM binary tools installed to allow stack trace decoding actively during
> >>>>>>> executable analysis.
> >>>>>>>
> >>>>>>> https://github.com/google/sanitizers/wiki/AddressSanitizerCallStack
> >>>>>>>
> >>>>>>> Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
> >>>>>>> Reviewed-by: Romain Naour <romain.naour@smile.fr>
> >>>>>>
> >>>>>> For some reason I get an error while building llvm package tools.
> >>>>>>
> >>>>>> x86_64-linux-g++: WARNING: unsafe header/library path used in cross-compilation:
> >>>>>> '-I/usr/include/libxml2'
> >>>>>>
> >>>>>> Can you have a look?
> >>>>>
> >>>>> I went back and checked my logs on the clang compiler-rt run-test
> >>>>> build for that warning and didn't find it.  I then checked and my
> >>>>> config and it has the unsafe header/library as error.  Was your build
> >>>>> test just applying my patches and doing an explicit 'make llvm'?
> >>>>
> >>>>
> >>>> Indeed,
> >>>> Some tools use libxml2, so you have to add target libxml2 package as build dependency.
> >>>>
> >>>
> >>> Would you mind sharing your verbose output and equivalent of cmake
> >>> config guess/status?
> >>>
> >>
> >> I need to rebuild from scratch since I've fixed the build locally.
> >> I'll restart a new one next week-end.
> >>
> >
> > Something like the following added to package/llvm/llvm.mk?  (Still
> > haven't see this on my end.  I messed with my host system a bit to get
> > libxml2 support and headers in place, no luck.)
> >
> > # LLVM requires libxml2
> > HOST_LLVM_CONF_OPTS += \
> >        -DLIBXML2_LIBRARIES=$(HOST_DIR)/lib \
> >        -DLIBXML2_INCLUDE_DIR=$(HOST_DIR)/include/libxml2
> > HOST_LLVM_DEPENDENCIES += host-libxml2
> > LLVM_CONF_OPTS += \
> >        -DLIBXML2_LIBRARIES=$(STAGING_DIR)/usr/lib \
> >        -DLIBXML2_INCLUDE_DIR=$(STAGING_DIR)/usr/include/libxml2
> > LLVM_DEPENDENCIES += libxml2
>
> I reproduced the issue: https://pastebin.com/s8PZvuGt
>

Ah ok, I see you have the AMD GPU stuff enabled.  I'll enable that and
see if I can reproduce the path poisoning.  Then do some builds
with/without explicitly disabling via -DLLVM_ENABLE_LIBXML2.

Matt
Matt Weber Nov. 22, 2018, 4:05 a.m. UTC | #10
Romain,

On Wed, Nov 21, 2018 at 9:14 PM Matthew Weber
<matthew.weber@rockwellcollins.com> wrote:
>
> Romain,
>
> On Wed, Nov 21, 2018 at 3:19 PM Romain Naour <romain.naour@gmail.com> wrote:
> >
> > Hi Matt,
> >
> > Le 21/11/2018 à 04:12, Matthew Weber a écrit :
> > > On Tue, Nov 20, 2018 at 4:37 PM Romain Naour <romain.naour@gmail.com> wrote:
> > >>
> > >> Hi Matt,
> > >>
> > >> Le 19/11/2018 à 14:04, Matthew Weber a écrit :
> > >>> Romain,
> > >>>
> > >>> On Mon, Nov 19, 2018 at 2:10 AM Romain Naour <romain.naour@gmail.com> wrote:
> > >>>>
> > >>>> Hi Matt,
> > >>>>
> > >>>> Le lun. 19 nov. 2018 à 02:48, Matthew Weber <matthew.weber@rockwellcollins.com> a écrit :
> > >>>>>
> > >>>>> Romain,
> > >>>>>
> > >>>>> On Sun, Nov 18, 2018 at 1:14 PM Romain Naour <romain.naour@smile.fr> wrote:
> > >>>>>>
> > >>>>>> Hi Matt,
> > >>>>>>
> > >>>>>> Le 17/11/2018 à 04:56, Matt Weber a écrit :
> > >>>>>>> The compiler-rt fuzzer and address sanitizer tools require additional
> > >>>>>>> LLVM binary tools installed to allow stack trace decoding actively during
> > >>>>>>> executable analysis.
> > >>>>>>>
> > >>>>>>> https://github.com/google/sanitizers/wiki/AddressSanitizerCallStack
> > >>>>>>>
> > >>>>>>> Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
> > >>>>>>> Reviewed-by: Romain Naour <romain.naour@smile.fr>
> > >>>>>>
> > >>>>>> For some reason I get an error while building llvm package tools.
> > >>>>>>
> > >>>>>> x86_64-linux-g++: WARNING: unsafe header/library path used in cross-compilation:
> > >>>>>> '-I/usr/include/libxml2'
> > >>>>>>
> > >>>>>> Can you have a look?
> > >>>>>
> > >>>>> I went back and checked my logs on the clang compiler-rt run-test
> > >>>>> build for that warning and didn't find it.  I then checked and my
> > >>>>> config and it has the unsafe header/library as error.  Was your build
> > >>>>> test just applying my patches and doing an explicit 'make llvm'?
> > >>>>
> > >>>>
> > >>>> Indeed,
> > >>>> Some tools use libxml2, so you have to add target libxml2 package as build dependency.
> > >>>>
> > >>>
> > >>> Would you mind sharing your verbose output and equivalent of cmake
> > >>> config guess/status?
> > >>>
> > >>
> > >> I need to rebuild from scratch since I've fixed the build locally.
> > >> I'll restart a new one next week-end.
> > >>
> > >
> > > Something like the following added to package/llvm/llvm.mk?  (Still
> > > haven't see this on my end.  I messed with my host system a bit to get
> > > libxml2 support and headers in place, no luck.)
> > >
> > > # LLVM requires libxml2
> > > HOST_LLVM_CONF_OPTS += \
> > >        -DLIBXML2_LIBRARIES=$(HOST_DIR)/lib \
> > >        -DLIBXML2_INCLUDE_DIR=$(HOST_DIR)/include/libxml2
> > > HOST_LLVM_DEPENDENCIES += host-libxml2
> > > LLVM_CONF_OPTS += \
> > >        -DLIBXML2_LIBRARIES=$(STAGING_DIR)/usr/lib \
> > >        -DLIBXML2_INCLUDE_DIR=$(STAGING_DIR)/usr/include/libxml2
> > > LLVM_DEPENDENCIES += libxml2
> >
> > I reproduced the issue: https://pastebin.com/s8PZvuGt
> >
>
> Ah ok, I see you have the AMD GPU stuff enabled.  I'll enable that and
> see if I can reproduce the path poisoning.  Then do some builds
> with/without explicitly disabling via -DLLVM_ENABLE_LIBXML2.
>

I still can't reproduce it.  Would you mind sharing your defconfig?
I'll send a v4 with the -DLLVM_ENABLE_LIBXML2=off.  See where you get
with that.

Matt
diff mbox series

Patch

diff --git a/package/llvm/llvm.mk b/package/llvm/llvm.mk
index 1f9bd44..79477f0 100644
--- a/package/llvm/llvm.mk
+++ b/package/llvm/llvm.mk
@@ -197,8 +197,17 @@  HOST_LLVM_CONF_OPTS += \
 # We need to activate LLVM_INCLUDE_TOOLS, otherwise it does not generate
 # libLLVM.so
 LLVM_CONF_OPTS += \
-	-DLLVM_INCLUDE_TOOLS=ON \
+	-DLLVM_INCLUDE_TOOLS=ON
+
+# The llvm-symbolizer binary is used by the Compiler-RT Fuzzer
+# and AddressSanitizer tools for stack traces.
+ifeq ($(BR2_PACKAGE_COMPILER_RT),y)
+LLVM_CONF_OPTS += \
+	-DLLVM_BUILD_TOOLS=ON
+else
+LLVM_CONF_OPTS += \
 	-DLLVM_BUILD_TOOLS=OFF
+endif
 
 # Compiler-rt not in the source tree.
 # llvm runtime libraries are not in the source tree.