* [Buildroot] [PATCH v3] valgrind: fix musl compile
@ 2016-02-09 22:53 Peter Seiderer
2016-02-09 23:26 ` Arnout Vandecappelle
0 siblings, 1 reply; 3+ messages in thread
From: Peter Seiderer @ 2016-02-09 22:53 UTC (permalink / raw)
To: buildroot
Add musl libc detection (based on suggestions by Romain Naour and
Arnout Vandecappelle) and add 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
Patch suggested upstream (see [3]).
[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
[3] https://bugs.kde.org/show_bug.cgi?id=359202
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
Changes v2 -> v3:
- change valgrind patch define logic (suggested by Arnout Vandecappelle)
Changes v1 -> v2:
- add proper musl libc detection (suggested by Romain Naour and
Arnout Vandecappelle)
---
package/valgrind/0004-Fixes-for-musl-libc.patch | 99 +++++++++++++++++++++++++
package/valgrind/valgrind.mk | 3 +
2 files changed, 102 insertions(+)
create mode 100644 package/valgrind/0004-Fixes-for-musl-libc.patch
diff --git a/package/valgrind/0004-Fixes-for-musl-libc.patch b/package/valgrind/0004-Fixes-for-musl-libc.patch
new file mode 100644
index 0000000..a36e91f
--- /dev/null
+++ b/package/valgrind/0004-Fixes-for-musl-libc.patch
@@ -0,0 +1,99 @@
+From 6916cc1b02ab271f04e925b8fce130c4833b9faf 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] Fixes for musl libc.
+
+- add musl libc detection (prevents configure error)
+- adjust preload and symbol names (based on the OpenWrt
+ patch, 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 | 16 ++++++++++++++--
+ coregrind/vg_preloaded.c | 2 +-
+ include/pub_tool_redir.h | 9 ++++++++-
+ 3 files changed, 23 insertions(+), 4 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 8ab7f9b..d1fa071 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1009,6 +1009,13 @@ if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
+ GLIBC_VERSION="solaris"
+ fi
+
++# 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
++ if $CC -dumpmachine | grep -q musl; then
++ GLIBC_VERSION=musl
++ fi
++fi
+
+ AC_MSG_CHECKING([the glibc version])
+
+@@ -1064,10 +1071,15 @@ case "${GLIBC_VERSION}" in
+ # DEFAULT_SUPP set in host_os switch-case above.
+ # No other suppression file is used.
+ ;;
++ musl)
++ AC_MSG_RESULT(Musl)
++ AC_DEFINE([MUSL_LIBC], 1, [Define to 1 if you're using Musl libc])
++ # no DEFAULT_SUPP file yet for musl libc.
++ ;;
+ 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_ERROR([Valgrind requires glibc version 2.2 or later, uclibc,])
++ AC_MSG_ERROR([musl libc, Darwin libc, Bionic libc or Solaris libc])
+ ;;
+ esac
+
+diff --git a/coregrind/vg_preloaded.c b/coregrind/vg_preloaded.c
+index 2ea7a7a..7b51aba 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(MUSL_LIBC) \
+ && !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..babcf9a 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(MUSL_LIBC)
++# define VG_Z_LIBC_SONAME libcZdZa // libc.*
++#else
+ # define VG_Z_LIBC_SONAME libcZdsoZa // libc.so*
+-
++#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(MUSL_LIBC)
++# define VG_Z_LIBPTHREAD_SONAME libcZdZa // libc.*
++#else
+ # define VG_Z_LIBPTHREAD_SONAME libpthreadZdsoZd0 // libpthread.so.0
++#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 5849b49..46ba13e 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-ubsan
VALGRIND_INSTALL_STAGING = YES
+# patch 0004-Fixes-for-musl-libc.patch touching configure.ac
+VALGRIND_AUTORECONF = YES
+
ifeq ($(BR2_GCC_ENABLE_TLS),y)
VALGRIND_CONF_OPTS += --enable-tls
else
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Buildroot] [PATCH v3] valgrind: fix musl compile
2016-02-09 22:53 [Buildroot] [PATCH v3] valgrind: fix musl compile Peter Seiderer
@ 2016-02-09 23:26 ` Arnout Vandecappelle
2016-02-11 20:18 ` Peter Seiderer
0 siblings, 1 reply; 3+ messages in thread
From: Arnout Vandecappelle @ 2016-02-09 23:26 UTC (permalink / raw)
To: buildroot
On 09-02-16 23:53, Peter Seiderer wrote:
> Add musl libc detection (based on suggestions by Romain Naour and
> Arnout Vandecappelle) and add 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
>
> Patch suggested upstream (see [3]).
>
> [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
> [3] https://bugs.kde.org/show_bug.cgi?id=359202
>
> Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
One small nit:
[snip]
> + 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_ERROR([Valgrind requires glibc version 2.2 or later, uclibc,])
It's uClibc (capital C).
> ++ AC_MSG_ERROR([musl libc, Darwin libc, Bionic libc or Solaris libc])
> + ;;
> + esac
> +
[snip]
I guess you'll update the upstream bug report as well?
Regards,
Arnout
--
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] 3+ messages in thread
* [Buildroot] [PATCH v3] valgrind: fix musl compile
2016-02-09 23:26 ` Arnout Vandecappelle
@ 2016-02-11 20:18 ` Peter Seiderer
0 siblings, 0 replies; 3+ messages in thread
From: Peter Seiderer @ 2016-02-11 20:18 UTC (permalink / raw)
To: buildroot
Hello Arnout,
On Wed, 10 Feb 2016 00:26:34 +0100, Arnout Vandecappelle <arnout@mind.be> wrote:
> On 09-02-16 23:53, Peter Seiderer wrote:
> > Add musl libc detection (based on suggestions by Romain Naour and
> > Arnout Vandecappelle) and add 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
> >
> > Patch suggested upstream (see [3]).
> >
> > [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
> > [3] https://bugs.kde.org/show_bug.cgi?id=359202
> >
> > Signed-off-by: Peter Seiderer <ps.report@gmx.net>
>
> Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
>
> One small nit:
>
> [snip]
> > + 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_ERROR([Valgrind requires glibc version 2.2 or later, uclibc,])
>
> It's uClibc (capital C).
O.k, fixed it (and many thanks for review patience)...
>
> > ++ AC_MSG_ERROR([musl libc, Darwin libc, Bionic libc or Solaris libc])
> > + ;;
> > + esac
> > +
> [snip]
>
> I guess you'll update the upstream bug report as well?
>
Yes, done now...
Regards,
Peter
> Regards,
> Arnout
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-02-11 20:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-09 22:53 [Buildroot] [PATCH v3] valgrind: fix musl compile Peter Seiderer
2016-02-09 23:26 ` Arnout Vandecappelle
2016-02-11 20:18 ` Peter Seiderer
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.