Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/mesa3d: add valgrind support
@ 2020-04-28  5:22 James Hilliard
  2020-04-28  5:40 ` Thomas Petazzoni
  2020-04-28  5:45 ` Thomas Petazzoni
  0 siblings, 2 replies; 7+ messages in thread
From: James Hilliard @ 2020-04-28  5:22 UTC (permalink / raw)
  To: buildroot

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
 package/mesa3d/mesa3d.mk | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/package/mesa3d/mesa3d.mk b/package/mesa3d/mesa3d.mk
index 22eff24c56..ab10194a6a 100644
--- a/package/mesa3d/mesa3d.mk
+++ b/package/mesa3d/mesa3d.mk
@@ -25,8 +25,7 @@ MESA3D_DEPENDENCIES = \
 
 MESA3D_CONF_OPTS = \
 	-Dgallium-omx=disabled \
-	-Dpower8=false \
-	-Dvalgrind=false
+	-Dpower8=false
 
 ifeq ($(BR2_PACKAGE_MESA3D_LLVM),y)
 MESA3D_DEPENDENCIES += host-llvm llvm
@@ -242,6 +241,13 @@ else
 MESA3D_CONF_OPTS += -Dgallium-xvmc=false
 endif
 
+ifeq ($(BR2_PACKAGE_VALGRIND),y)
+MESA3D_CONF_OPTS += -Dvalgrind=true
+MESA3D_DEPENDENCIES += valgrind
+else
+MESA3D_CONF_OPTS += -Dvalgrind=false
+endif
+
 ifeq ($(BR2_PACKAGE_LIBUNWIND),y)
 MESA3D_CONF_OPTS += -Dlibunwind=true
 MESA3D_DEPENDENCIES += libunwind
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/1] package/mesa3d: add valgrind support
  2020-04-28  5:22 [Buildroot] [PATCH 1/1] package/mesa3d: add valgrind support James Hilliard
@ 2020-04-28  5:40 ` Thomas Petazzoni
  2020-04-28  5:45 ` Thomas Petazzoni
  1 sibling, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2020-04-28  5:40 UTC (permalink / raw)
  To: buildroot

On Mon, 27 Apr 2020 23:22:25 -0600
James Hilliard <james.hilliard1@gmail.com> wrote:

> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> ---
>  package/mesa3d/mesa3d.mk | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/1] package/mesa3d: add valgrind support
  2020-04-28  5:22 [Buildroot] [PATCH 1/1] package/mesa3d: add valgrind support James Hilliard
  2020-04-28  5:40 ` Thomas Petazzoni
@ 2020-04-28  5:45 ` Thomas Petazzoni
  2020-04-28  5:47   ` James Hilliard
  1 sibling, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2020-04-28  5:45 UTC (permalink / raw)
  To: buildroot

On Mon, 27 Apr 2020 23:22:25 -0600
James Hilliard <james.hilliard1@gmail.com> wrote:

> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> ---
>  package/mesa3d/mesa3d.mk | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)

Speaking of mesa3d/valgrind, we have this:

  http://autobuild.buildroot.net/results/1b5/1b58d73ecbbe1af2c3e140563d696cf32d1c4a5a/build-end.log

Seems like mesa3d is trying to link with some static libraries from
valgrind, which are not built with -fPIC. Have you looked into this?

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/1] package/mesa3d: add valgrind support
  2020-04-28  5:45 ` Thomas Petazzoni
@ 2020-04-28  5:47   ` James Hilliard
  2020-06-10 13:41     ` Romain Naour
  0 siblings, 1 reply; 7+ messages in thread
From: James Hilliard @ 2020-04-28  5:47 UTC (permalink / raw)
  To: buildroot

On Mon, Apr 27, 2020 at 11:45 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> On Mon, 27 Apr 2020 23:22:25 -0600
> James Hilliard <james.hilliard1@gmail.com> wrote:
>
> > Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> > ---
> >  package/mesa3d/mesa3d.mk | 10 ++++++++--
> >  1 file changed, 8 insertions(+), 2 deletions(-)
>
> Speaking of mesa3d/valgrind, we have this:
>
>   http://autobuild.buildroot.net/results/1b5/1b58d73ecbbe1af2c3e140563d696cf32d1c4a5a/build-end.log
>
> Seems like mesa3d is trying to link with some static libraries from
> valgrind, which are not built with -fPIC. Have you looked into this?
Yeah, I had added this trying to fix that but it didn't seem to help.
>
> Thanks!
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/1] package/mesa3d: add valgrind support
  2020-04-28  5:47   ` James Hilliard
@ 2020-06-10 13:41     ` Romain Naour
  2020-06-10 15:45       ` James Hilliard
  0 siblings, 1 reply; 7+ messages in thread
From: Romain Naour @ 2020-06-10 13:41 UTC (permalink / raw)
  To: buildroot

Hi James, Thomas,

Le 28/04/2020 ? 07:47, James Hilliard a ?crit?:
> On Mon, Apr 27, 2020 at 11:45 PM Thomas Petazzoni
> <thomas.petazzoni@bootlin.com> wrote:
>>
>> On Mon, 27 Apr 2020 23:22:25 -0600
>> James Hilliard <james.hilliard1@gmail.com> wrote:
>>
>>> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
>>> ---
>>>  package/mesa3d/mesa3d.mk | 10 ++++++++--
>>>  1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> Speaking of mesa3d/valgrind, we have this:
>>
>>   http://autobuild.buildroot.net/results/1b5/1b58d73ecbbe1af2c3e140563d696cf32d1c4a5a/build-end.log
>>
>> Seems like mesa3d is trying to link with some static libraries from
>> valgrind, which are not built with -fPIC. Have you looked into this?
> Yeah, I had added this trying to fix that but it didn't seem to help.

I spent some time investigating this issue but the problem is that mesa try to
link with libcoregrind-<arch>-linux.a to build libgbm.so. But even by hacking
the valgrind build system, the build is still failing.

I tried with several toolchain (glibc and uclibc).

Out of curiosity, what's your use case that require valgrind in mesa3d ?

Note: The valgrind support is enabled in archlinux and fedora

https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/mesa

https://src.fedoraproject.org/rpms/valgrind/blob/master/f/valgrind.spec

But no problem on their side ?

Any idea ? otherwise we have to revert this patch because the build is still
failing in the autobuilder.

Best regards,
Romain


>>
>> Thanks!
>>
>> Thomas
>> --
>> Thomas Petazzoni, CTO, Bootlin
>> Embedded Linux and Kernel engineering
>> https://bootlin.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/1] package/mesa3d: add valgrind support
  2020-06-10 13:41     ` Romain Naour
@ 2020-06-10 15:45       ` James Hilliard
  2020-06-10 20:03         ` Romain Naour
  0 siblings, 1 reply; 7+ messages in thread
From: James Hilliard @ 2020-06-10 15:45 UTC (permalink / raw)
  To: buildroot

On Wed, Jun 10, 2020 at 7:41 AM Romain Naour <romain.naour@gmail.com> wrote:
>
> Hi James, Thomas,
>
> Le 28/04/2020 ? 07:47, James Hilliard a ?crit :
> > On Mon, Apr 27, 2020 at 11:45 PM Thomas Petazzoni
> > <thomas.petazzoni@bootlin.com> wrote:
> >>
> >> On Mon, 27 Apr 2020 23:22:25 -0600
> >> James Hilliard <james.hilliard1@gmail.com> wrote:
> >>
> >>> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> >>> ---
> >>>  package/mesa3d/mesa3d.mk | 10 ++++++++--
> >>>  1 file changed, 8 insertions(+), 2 deletions(-)
> >>
> >> Speaking of mesa3d/valgrind, we have this:
> >>
> >>   http://autobuild.buildroot.net/results/1b5/1b58d73ecbbe1af2c3e140563d696cf32d1c4a5a/build-end.log
> >>
> >> Seems like mesa3d is trying to link with some static libraries from
> >> valgrind, which are not built with -fPIC. Have you looked into this?
> > Yeah, I had added this trying to fix that but it didn't seem to help.
>
> I spent some time investigating this issue but the problem is that mesa try to
> link with libcoregrind-<arch>-linux.a to build libgbm.so. But even by hacking
> the valgrind build system, the build is still failing.
>
> I tried with several toolchain (glibc and uclibc).
>
> Out of curiosity, what's your use case that require valgrind in mesa3d ?
Well I sometimes use valgrind for tracing certain bugs, figured since
mesa3d has a valgrind option we should use it when building valgrind.
>
> Note: The valgrind support is enabled in archlinux and fedora
>
> https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/mesa
>
> https://src.fedoraproject.org/rpms/valgrind/blob/master/f/valgrind.spec
>
> But no problem on their side ?
>
> Any idea ? otherwise we have to revert this patch because the build is still
> failing in the autobuilder.
The builds were failing before this patch so I don't see how reverting
would help.
>
> Best regards,
> Romain
>
>
> >>
> >> Thanks!
> >>
> >> Thomas
> >> --
> >> Thomas Petazzoni, CTO, Bootlin
> >> Embedded Linux and Kernel engineering
> >> https://bootlin.com
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/1] package/mesa3d: add valgrind support
  2020-06-10 15:45       ` James Hilliard
@ 2020-06-10 20:03         ` Romain Naour
  0 siblings, 0 replies; 7+ messages in thread
From: Romain Naour @ 2020-06-10 20:03 UTC (permalink / raw)
  To: buildroot

Hi James,

Le 10/06/2020 ? 17:45, James Hilliard a ?crit?:
> On Wed, Jun 10, 2020 at 7:41 AM Romain Naour <romain.naour@gmail.com> wrote:
>>
>> Hi James, Thomas,
>>
>> Le 28/04/2020 ? 07:47, James Hilliard a ?crit :
>>> On Mon, Apr 27, 2020 at 11:45 PM Thomas Petazzoni
>>> <thomas.petazzoni@bootlin.com> wrote:
>>>>
>>>> On Mon, 27 Apr 2020 23:22:25 -0600
>>>> James Hilliard <james.hilliard1@gmail.com> wrote:
>>>>
>>>>> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
>>>>> ---
>>>>>  package/mesa3d/mesa3d.mk | 10 ++++++++--
>>>>>  1 file changed, 8 insertions(+), 2 deletions(-)
>>>>
>>>> Speaking of mesa3d/valgrind, we have this:
>>>>
>>>>   http://autobuild.buildroot.net/results/1b5/1b58d73ecbbe1af2c3e140563d696cf32d1c4a5a/build-end.log
>>>>
>>>> Seems like mesa3d is trying to link with some static libraries from
>>>> valgrind, which are not built with -fPIC. Have you looked into this?
>>> Yeah, I had added this trying to fix that but it didn't seem to help.
>>
>> I spent some time investigating this issue but the problem is that mesa try to
>> link with libcoregrind-<arch>-linux.a to build libgbm.so. But even by hacking
>> the valgrind build system, the build is still failing.
>>
>> I tried with several toolchain (glibc and uclibc).
>>
>> Out of curiosity, what's your use case that require valgrind in mesa3d ?
> Well I sometimes use valgrind for tracing certain bugs, figured since
> mesa3d has a valgrind option we should use it when building valgrind.

Ok

>>
>> Note: The valgrind support is enabled in archlinux and fedora
>>
>> https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/mesa
>>
>> https://src.fedoraproject.org/rpms/valgrind/blob/master/f/valgrind.spec
>>
>> But no problem on their side ?
>>
>> Any idea ? otherwise we have to revert this patch because the build is still
>> failing in the autobuilder.
> The builds were failing before this patch so I don't see how reverting
> would help.

Indeed it's not directly this patch, I thought that because it's a new issue
related to valgrind... but it's more complicated than that. Actually It's a
mesa/valgrind bug. mesa try to build the shared library libgbm.so using the
valgrind static libraries. This should only be possible if valgrind static
libraries are built with -fPIC.

As soon we have BR2_PACKAGE_VALGRIND=y and BR2_PACKAGE_MESA3D_GBM=y, the build
issue should be reproducible.

I can reproduce it with the following defconfig:
BR2_aarch64=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_PACKAGE_VALGRIND=y
BR2_PACKAGE_VALGRIND_SGCHECK=y
BR2_PACKAGE_VALGRIND_BBV=y
BR2_PACKAGE_VALGRIND_LACKEY=y
BR2_PACKAGE_VALGRIND_NULGRIND=y
BR2_PACKAGE_MESA3D=y
BR2_PACKAGE_MESA3D_DRI_DRIVER_SWRAST=y

Even before your patch, the problem can be reproduced due to libdrm built with
valgrind support. Added long time ago [1].

Even if -Dvalgrind=false on meson command line to build mesa, the valgrind
libraries come from pkg-config libdrm...

output/host/bin/pkg-config libdrm --libs --static
-L[...]/sysroot/usr/lib -ldrm -lm -L[...]/sysroot/usr/lib/valgrind
-lcoregrind-arm64-linux -lvex-arm64-linux -lgcc

... and break the build.

I tried to modify the valgrind build system to add -fPIC but the problem is
still present.

I don't know how yet how to fix the problem.

[1]
https://git.buildroot.net/buildroot/commit/?id=da3805186a582fc42ec1b935da0ef87529284c6a

Best regards,
Romain

>>
>> Best regards,
>> Romain
>>
>>
>>>>
>>>> Thanks!
>>>>
>>>> Thomas
>>>> --
>>>> Thomas Petazzoni, CTO, Bootlin
>>>> Embedded Linux and Kernel engineering
>>>> https://bootlin.com
>>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-06-10 20:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-28  5:22 [Buildroot] [PATCH 1/1] package/mesa3d: add valgrind support James Hilliard
2020-04-28  5:40 ` Thomas Petazzoni
2020-04-28  5:45 ` Thomas Petazzoni
2020-04-28  5:47   ` James Hilliard
2020-06-10 13:41     ` Romain Naour
2020-06-10 15:45       ` James Hilliard
2020-06-10 20:03         ` Romain Naour

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox