Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v1] valgrind: fix musl compile
@ 2015-10-31 18:59 Peter Seiderer
  2015-11-11 17:06 ` Romain Naour
  2015-12-19 13:22 ` Thomas Petazzoni
  0 siblings, 2 replies; 5+ messages in thread
From: Peter Seiderer @ 2015-10-31 18:59 UTC (permalink / raw)
  To: buildroot

Add patch disabling glibc version check and adding some tweaks
for musl support (based on OpenWRT patch [1]).

Fixes ([2]):
  checking the glibc version... unsupported version
  configure: error: Valgrind requires glibc version 2.2 or later

[1] https://dev.openwrt.org/browser/trunk/package/devel/valgrind/patches/200-musl_fix.patch?rev=46302
[2] http://autobuild.buildroot.org/results/7b0/7b048ba58918f0a08498c61327fcf35a85a84837/build-end.log

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
 ...bc-detection-for-musl-plus-some-adjusteme.patch | 77 ++++++++++++++++++++++
 package/valgrind/valgrind.mk                       |  3 +
 2 files changed, 80 insertions(+)
 create mode 100644 package/valgrind/0003-Disable-glibc-detection-for-musl-plus-some-adjusteme.patch

diff --git a/package/valgrind/0003-Disable-glibc-detection-for-musl-plus-some-adjusteme.patch b/package/valgrind/0003-Disable-glibc-detection-for-musl-plus-some-adjusteme.patch
new file mode 100644
index 0000000..0a2f660
--- /dev/null
+++ b/package/valgrind/0003-Disable-glibc-detection-for-musl-plus-some-adjusteme.patch
@@ -0,0 +1,77 @@
+From fcb21d1480c17da6c59422d8eebfdf42d967f441 Mon Sep 17 00:00:00 2001
+From: Peter Seiderer <ps.report@gmx.net>
+Date: Sat, 31 Oct 2015 19:45:04 +0100
+Subject: [PATCH] Disable glibc detection for musl (plus some adjustements).
+
+Patch based on the OpenWrt patch for valgrind/musl, see [1].
+
+[1] https://dev.openwrt.org/browser/trunk/package/devel/valgrind/patches/200-musl_fix.patch?rev=46302
+
+Signed-off-by: Peter Seiderer <ps.report@gmx.net>
+---
+ configure.ac             | 5 +++--
+ coregrind/vg_preloaded.c | 2 +-
+ include/pub_tool_redir.h | 9 ++++++++-
+ 3 files changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 8ab7f9b..378ba9f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1066,8 +1066,9 @@ case "${GLIBC_VERSION}" in
+ 	;;
+      2.0|2.1|*)
+ 	AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
+-	AC_MSG_ERROR([Valgrind requires glibc version 2.2 or later,])
+-	AC_MSG_ERROR([Darwin libc, Bionic libc or Solaris libc])
++	AC_MSG_WARN([Valgrind requires glibc version 2.2 or later,])
++	AC_MSG_WARN([Darwin libc, Bionic libc or Solaris libc])
++	GLIBC_VERSION=musl
+ 	;;
+ esac
+ 
+diff --git a/coregrind/vg_preloaded.c b/coregrind/vg_preloaded.c
+index 2ea7a7a..e49c832 100644
+--- a/coregrind/vg_preloaded.c
++++ b/coregrind/vg_preloaded.c
+@@ -56,7 +56,7 @@
+ void VG_NOTIFY_ON_LOAD(freeres)( void );
+ void VG_NOTIFY_ON_LOAD(freeres)( void )
+ {
+-#  if !defined(__UCLIBC__) \
++#  if !defined(__UCLIBC__) && defined(__GLIBC__) \
+       && !defined(VGPV_arm_linux_android) \
+       && !defined(VGPV_x86_linux_android) \
+       && !defined(VGPV_mips32_linux_android) \
+diff --git a/include/pub_tool_redir.h b/include/pub_tool_redir.h
+index bac00d7..b8cd97e 100644
+--- a/include/pub_tool_redir.h
++++ b/include/pub_tool_redir.h
+@@ -242,8 +242,11 @@
+ /* --- Soname of the standard C library. --- */
+ 
+ #if defined(VGO_linux) || defined(VGO_solaris)
++# if defined(__GLIBC__) || defined(__UCLIBC__)
+ #  define  VG_Z_LIBC_SONAME  libcZdsoZa              // libc.so*
+-
++#else
++#  define  VG_Z_LIBC_SONAME  libcZdZa              // libc.*
++#endif
+ #elif defined(VGO_darwin) && (DARWIN_VERS <= DARWIN_10_6)
+ #  define  VG_Z_LIBC_SONAME  libSystemZdZaZddylib    // libSystem.*.dylib
+ 
+@@ -274,7 +277,11 @@
+ /* --- Soname of the pthreads library. --- */
+ 
+ #if defined(VGO_linux)
++# if defined(__GLIBC__) || defined(__UCLIBC__)
+ #  define  VG_Z_LIBPTHREAD_SONAME  libpthreadZdsoZd0     // libpthread.so.0
++#else
++#  define  VG_Z_LIBPTHREAD_SONAME  libcZdZa              // libc.*
++#endif
+ #elif defined(VGO_darwin)
+ #  define  VG_Z_LIBPTHREAD_SONAME  libSystemZdZaZddylib  // libSystem.*.dylib
+ #elif defined(VGO_solaris)
+-- 
+2.1.4
+
diff --git a/package/valgrind/valgrind.mk b/package/valgrind/valgrind.mk
index 75d542a..a630125 100644
--- a/package/valgrind/valgrind.mk
+++ b/package/valgrind/valgrind.mk
@@ -12,6 +12,9 @@ VALGRIND_LICENSE_FILES = COPYING COPYING.DOCS
 VALGRIND_CONF_OPTS = --disable-tls --disable-ubsan
 VALGRIND_INSTALL_STAGING = YES
 
+# patch touching configure.ac
+VALGRIND_AUTORECONF = YES
+
 # When Valgrind detects a 32-bit MIPS architecture, it forcibly adds
 # -march=mips32 to CFLAGS; when it detects a 64-bit MIPS architecture,
 # it forcibly adds -march=mips64. This causes Valgrind to be built
-- 
2.1.4

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

* [Buildroot] [PATCH v1] valgrind: fix musl compile
  2015-10-31 18:59 [Buildroot] [PATCH v1] valgrind: fix musl compile Peter Seiderer
@ 2015-11-11 17:06 ` Romain Naour
  2015-11-11 23:31   ` Arnout Vandecappelle
  2015-11-12 21:48   ` Peter Seiderer
  2015-12-19 13:22 ` Thomas Petazzoni
  1 sibling, 2 replies; 5+ messages in thread
From: Romain Naour @ 2015-11-11 17:06 UTC (permalink / raw)
  To: buildroot

Hi Peter,

Le 31/10/2015 19:59, Peter Seiderer a ?crit :
> Add patch disabling glibc version check and adding some tweaks
> for musl support (based on OpenWRT patch [1]).
> 
> Fixes ([2]):
>   checking the glibc version... unsupported version
>   configure: error: Valgrind requires glibc version 2.2 or later
> 
> [1] https://dev.openwrt.org/browser/trunk/package/devel/valgrind/patches/200-musl_fix.patch?rev=46302
> [2] http://autobuild.buildroot.org/results/7b0/7b048ba58918f0a08498c61327fcf35a85a84837/build-end.log
> 
> Signed-off-by: Peter Seiderer <ps.report@gmx.net>
> ---
>  ...bc-detection-for-musl-plus-some-adjusteme.patch | 77 ++++++++++++++++++++++
>  package/valgrind/valgrind.mk                       |  3 +
>  2 files changed, 80 insertions(+)
>  create mode 100644 package/valgrind/0003-Disable-glibc-detection-for-musl-plus-some-adjusteme.patch
> 
> diff --git a/package/valgrind/0003-Disable-glibc-detection-for-musl-plus-some-adjusteme.patch b/package/valgrind/0003-Disable-glibc-detection-for-musl-plus-some-adjusteme.patch
> new file mode 100644
> index 0000000..0a2f660
> --- /dev/null
> +++ b/package/valgrind/0003-Disable-glibc-detection-for-musl-plus-some-adjusteme.patch
> @@ -0,0 +1,77 @@
> +From fcb21d1480c17da6c59422d8eebfdf42d967f441 Mon Sep 17 00:00:00 2001
> +From: Peter Seiderer <ps.report@gmx.net>
> +Date: Sat, 31 Oct 2015 19:45:04 +0100
> +Subject: [PATCH] Disable glibc detection for musl (plus some adjustements).
> +
> +Patch based on the OpenWrt patch for valgrind/musl, see [1].
> +
> +[1] https://dev.openwrt.org/browser/trunk/package/devel/valgrind/patches/200-musl_fix.patch?rev=46302
> +
> +Signed-off-by: Peter Seiderer <ps.report@gmx.net>
> +---
> + configure.ac             | 5 +++--
> + coregrind/vg_preloaded.c | 2 +-
> + include/pub_tool_redir.h | 9 ++++++++-
> + 3 files changed, 12 insertions(+), 4 deletions(-)
> +
> +diff --git a/configure.ac b/configure.ac
> +index 8ab7f9b..378ba9f 100644
> +--- a/configure.ac
> ++++ b/configure.ac
> +@@ -1066,8 +1066,9 @@ case "${GLIBC_VERSION}" in
> + 	;;
> +      2.0|2.1|*)
> + 	AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
> +-	AC_MSG_ERROR([Valgrind requires glibc version 2.2 or later,])
> +-	AC_MSG_ERROR([Darwin libc, Bionic libc or Solaris libc])
> ++	AC_MSG_WARN([Valgrind requires glibc version 2.2 or later,])
> ++	AC_MSG_WARN([Darwin libc, Bionic libc or Solaris libc])
> ++	GLIBC_VERSION=musl

This part of this patch break the glibc check for unsupported version 2.0 and 2.1.

If you want to upstream the patch, maybe you can check if GLIBC_VERSION is empty
and use the toolchain tuple instead ?

Something like:

# GLIBC_VERSION is empty if a musl libc is used, so use the toolchain tuple
# in this case.
if test x$GLIBC_VERSION = x; then
    TUPLE=`$CC -dumpmachine | grep musl`
    if test -n $TUPLE; then
        GLIBC_VERSION=musl
    fi
fi

AC_MSG_CHECKING([the glibc version])

case "${GLIBC_VERSION}" in
...
    musl)
	AC_MSG_RESULT(Musl)
	;;
...

Thoughts?

Best regards,
Romain Naour

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

* [Buildroot] [PATCH v1] valgrind: fix musl compile
  2015-11-11 17:06 ` Romain Naour
@ 2015-11-11 23:31   ` Arnout Vandecappelle
  2015-11-12 21:48   ` Peter Seiderer
  1 sibling, 0 replies; 5+ messages in thread
From: Arnout Vandecappelle @ 2015-11-11 23:31 UTC (permalink / raw)
  To: buildroot

On 11-11-15 18:06, Romain Naour wrote:
> Hi Peter,
> 
> Le 31/10/2015 19:59, Peter Seiderer a ?crit :
>> Add patch disabling glibc version check and adding some tweaks
>> for musl support (based on OpenWRT patch [1]).
>>
>> Fixes ([2]):
>>   checking the glibc version... unsupported version
>>   configure: error: Valgrind requires glibc version 2.2 or later
>>
>> [1] https://dev.openwrt.org/browser/trunk/package/devel/valgrind/patches/200-musl_fix.patch?rev=46302
>> [2] http://autobuild.buildroot.org/results/7b0/7b048ba58918f0a08498c61327fcf35a85a84837/build-end.log
>>
>> Signed-off-by: Peter Seiderer <ps.report@gmx.net>
>> ---
>>  ...bc-detection-for-musl-plus-some-adjusteme.patch | 77 ++++++++++++++++++++++
>>  package/valgrind/valgrind.mk                       |  3 +
>>  2 files changed, 80 insertions(+)
>>  create mode 100644 package/valgrind/0003-Disable-glibc-detection-for-musl-plus-some-adjusteme.patch
>>
>> diff --git a/package/valgrind/0003-Disable-glibc-detection-for-musl-plus-some-adjusteme.patch b/package/valgrind/0003-Disable-glibc-detection-for-musl-plus-some-adjusteme.patch
>> new file mode 100644
>> index 0000000..0a2f660
>> --- /dev/null
>> +++ b/package/valgrind/0003-Disable-glibc-detection-for-musl-plus-some-adjusteme.patch
>> @@ -0,0 +1,77 @@
>> +From fcb21d1480c17da6c59422d8eebfdf42d967f441 Mon Sep 17 00:00:00 2001
>> +From: Peter Seiderer <ps.report@gmx.net>
>> +Date: Sat, 31 Oct 2015 19:45:04 +0100
>> +Subject: [PATCH] Disable glibc detection for musl (plus some adjustements).
>> +
>> +Patch based on the OpenWrt patch for valgrind/musl, see [1].
>> +
>> +[1] https://dev.openwrt.org/browser/trunk/package/devel/valgrind/patches/200-musl_fix.patch?rev=46302
>> +
>> +Signed-off-by: Peter Seiderer <ps.report@gmx.net>
>> +---
>> + configure.ac             | 5 +++--
>> + coregrind/vg_preloaded.c | 2 +-
>> + include/pub_tool_redir.h | 9 ++++++++-
>> + 3 files changed, 12 insertions(+), 4 deletions(-)
>> +
>> +diff --git a/configure.ac b/configure.ac
>> +index 8ab7f9b..378ba9f 100644
>> +--- a/configure.ac
>> ++++ b/configure.ac
>> +@@ -1066,8 +1066,9 @@ case "${GLIBC_VERSION}" in
>> + 	;;
>> +      2.0|2.1|*)
>> + 	AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
>> +-	AC_MSG_ERROR([Valgrind requires glibc version 2.2 or later,])
>> +-	AC_MSG_ERROR([Darwin libc, Bionic libc or Solaris libc])
>> ++	AC_MSG_WARN([Valgrind requires glibc version 2.2 or later,])
>> ++	AC_MSG_WARN([Darwin libc, Bionic libc or Solaris libc])
>> ++	GLIBC_VERSION=musl
> 
> This part of this patch break the glibc check for unsupported version 2.0 and 2.1.
> 
> If you want to upstream the patch, maybe you can check if GLIBC_VERSION is empty
> and use the toolchain tuple instead ?
> 
> Something like:
> 
> # GLIBC_VERSION is empty if a musl libc is used, so use the toolchain tuple
> # in this case.
> if test x$GLIBC_VERSION = x; then
>     TUPLE=`$CC -dumpmachine | grep musl`
>     if test -n $TUPLE; then

 if $CC -dumpmachine | grep -q musl; then

would be simpler.

 Regards,
 Arnout

>         GLIBC_VERSION=musl
>     fi
> fi
> 
> AC_MSG_CHECKING([the glibc version])
> 
> case "${GLIBC_VERSION}" in
> ...
>     musl)
> 	AC_MSG_RESULT(Musl)
> 	;;
> ...
> 
> Thoughts?
> 
> Best regards,
> Romain Naour
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
> 


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [PATCH v1] valgrind: fix musl compile
  2015-11-11 17:06 ` Romain Naour
  2015-11-11 23:31   ` Arnout Vandecappelle
@ 2015-11-12 21:48   ` Peter Seiderer
  1 sibling, 0 replies; 5+ messages in thread
From: Peter Seiderer @ 2015-11-12 21:48 UTC (permalink / raw)
  To: buildroot

Hello Romain,

On Wed, 11 Nov 2015 18:06:25 +0100, Romain Naour <romain.naour@openwide.fr> wrote:

[...]

> > +--- a/configure.ac
> > ++++ b/configure.ac
> > +@@ -1066,8 +1066,9 @@ case "${GLIBC_VERSION}" in
> > + 	;;
> > +      2.0|2.1|*)
> > + 	AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
> > +-	AC_MSG_ERROR([Valgrind requires glibc version 2.2 or later,])
> > +-	AC_MSG_ERROR([Darwin libc, Bionic libc or Solaris libc])
> > ++	AC_MSG_WARN([Valgrind requires glibc version 2.2 or later,])
> > ++	AC_MSG_WARN([Darwin libc, Bionic libc or Solaris libc])
> > ++	GLIBC_VERSION=musl
> 
> This part of this patch break the glibc check for unsupported version 2.0 and 2.1.

Yes I know, its only a workaround for the buildroot build...

> 
> If you want to upstream the patch, maybe you can check if GLIBC_VERSION is empty
> and use the toolchain tuple instead ?
> 
> Something like:
> 
> # GLIBC_VERSION is empty if a musl libc is used, so use the toolchain tuple
> # in this case.
> if test x$GLIBC_VERSION = x; then
>     TUPLE=`$CC -dumpmachine | grep musl`
>     if test -n $TUPLE; then
>         GLIBC_VERSION=musl
>     fi
> fi
> 
> AC_MSG_CHECKING([the glibc version])
> 
> case "${GLIBC_VERSION}" in
> ...
>     musl)
> 	AC_MSG_RESULT(Musl)
> 	;;
> ...
> 
> Thoughts?
>

Many thanks for the suggestion, will try to cook up a patch...

Regards,
Peter

> Best regards,
> Romain Naour
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v1] valgrind: fix musl compile
  2015-10-31 18:59 [Buildroot] [PATCH v1] valgrind: fix musl compile Peter Seiderer
  2015-11-11 17:06 ` Romain Naour
@ 2015-12-19 13:22 ` Thomas Petazzoni
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Petazzoni @ 2015-12-19 13:22 UTC (permalink / raw)
  To: buildroot

Dear Peter Seiderer,

On Sat, 31 Oct 2015 19:59:02 +0100, Peter Seiderer wrote:
> Add patch disabling glibc version check and adding some tweaks
> for musl support (based on OpenWRT patch [1]).
> 
> Fixes ([2]):
>   checking the glibc version... unsupported version
>   configure: error: Valgrind requires glibc version 2.2 or later
> 
> [1] https://dev.openwrt.org/browser/trunk/package/devel/valgrind/patches/200-musl_fix.patch?rev=46302
> [2] http://autobuild.buildroot.org/results/7b0/7b048ba58918f0a08498c61327fcf35a85a84837/build-end.log
> 
> Signed-off-by: Peter Seiderer <ps.report@gmx.net>

You have been given a number of comments on this patch. Could you rework
to take into account the comments and send an updated version?

Note that you can also find some musl compatibility patches at
http://git.alpinelinux.org/cgit/aports/tree/main/valgrind/.

In the mean time, I'll mark your patch as Changes Requested in
patchwork.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

end of thread, other threads:[~2015-12-19 13:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-31 18:59 [Buildroot] [PATCH v1] valgrind: fix musl compile Peter Seiderer
2015-11-11 17:06 ` Romain Naour
2015-11-11 23:31   ` Arnout Vandecappelle
2015-11-12 21:48   ` Peter Seiderer
2015-12-19 13:22 ` Thomas Petazzoni

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