Skip to contentSkip to conversation

package/mono: fix build with libunwind

PATCH New Fabrice Fontaine 2 participants 4 messages Jan 20, 2021 – Jan 21, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/mono: fix build with libunwind

Commit 4be06fa8aa054e59d97866dc5568f4e10762e353 wrongly removed this patch which was rejected by upstream (and so not merged). Moreover, there is no way to disable unwind backtrace on mono. An interested party could try to send this patch again or work with upstream to add an option to disable backtrace.

Fixes:
- http://autobuild.buildroot.org/results/17f1282abda00aedaea1f3edbcae1b216b70552a

---
 ...01-configure-ac-checks-for-libunwind.patch | 38 +++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 package/mono/0001-configure-ac-checks-for-libunwind.patch
package/mono/0001-configure-ac-checks-for-libunwind.patch new file +38 -0
new file mode 100644
index 0000000000..3d9d8a249f
@@ -0,0 +1,38 @@
+From 05c9f2d51e74e847ebfa1efdd495d2b146803a07 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+Date: Wed, 15 May 2019 22:30:01 +0200
+Subject: [PATCH] configure.ac: checks for libunwind
+
+_Unwind_GetIP is used in build_stack_trace however this function can be
+provided by libunwind so check for it to avoid the following build
+failure:
+
+/home/buildroot/autobuild/run/instance-1/output/host/lib/gcc/arm-buildroot-linux-musleabihf/7.4.0/../../../../arm-buildroot-linux-musleabihf/bin/ld: ./.libs/libmini.a(libmini_la-mini-exceptions.o): in function `build_stack_trace':
+/home/buildroot/autobuild/run/instance-1/output/build/mono-5.20.1.27/mono/mini/mini-exceptions.c:365: undefined reference to `_Unwind_GetIP'
+collect2: error: ld returned 1 exit status
+
+Fixes:
+ - http://autobuild.buildroot.net/results/dbd64c89815d393a4e28b312d74fd80ee6de92da
+
+Signed-off-by: Fabrice Fontaine <[email protected]>
+[Upstream status: rejected (https://github.com/mono/mono/pull/18648)]
+---
+ configure.ac | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index d724f9e2d27d..b323ca1b14bd 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -2206,6 +2206,11 @@ if test x$host_win32 = xno; then
+ 	dnl *****************************
+ 	AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
+ 
++	dnl *****************************
++	dnl *** Checks for libunwind  ***
++	dnl *****************************
++	AC_CHECK_LIB(unwind, _Unwind_GetIP, LIBS="$LIBS -lunwind")
++
+ 	case "$host" in
+ 		*-*-*freebsd*)
+ 			dnl *****************************
Signature · 1 line
2.29.2
#1 lore raw

PATCH 2/2 package/mono: disable boehm

mono uses the Unity fork of recent Boehm since version 6.10.0.65 and
https://github.com/mono/mono/commit/cc137237d86b0553e844dc34c9a3cbc5b20782c0

However, this raises the following build failure:

/tmp/instance-0/output-1/per-package/mono/host/arm-buildroot-linux-gnueabi/sysroot/usr/include/bits/string3.h:81: warning: memset used with constant zero length parameter; this could be due to transposed parameters ../../external/bdwgc/.libs/libgc.a(gc.o): In function `GC_steal_mark_stack':
gc.c:(.text+0x1d18): undefined reference to `AO_store_full_emulation'

So just disable boehm

Fixes:
- http://autobuild.buildroot.org/results/f921db5824b3062ba37c91af0ac07835c6e1b34c

---
 package/mono/mono.mk | 1 +
 1 file changed, 1 insertion(+)
package/mono/mono.mk +1 -0
index df3481a498..dc11e744e8 100644
@@ -22,6 +22,7 @@ MONO_COMMON_CONF_OPTS = --with-mcs-docs=no \
 	--with-ikvm-native=no \
 	--enable-minimal=profiler,debug \
 	--enable-static \
+	--disable-boehm \
 	--disable-btls \
 	--disable-system-aot
 
Signature · 1 line
2.29.2
#2 lore raw

PATCH 2/2 package/mono: disable boehm

Quoted 8 lines · On Wed, 20 Jan 2021 18:54:43 +0100 Fabrice Fontaine…

mono uses the Unity fork of recent Boehm since version 6.10.0.65 and
https://github.com/mono/mono/commit/cc137237d86b0553e844dc34c9a3cbc5b20782c0

However, this raises the following build failure:

/tmp/instance-0/output-1/per-package/mono/host/arm-buildroot-linux-gnueabi/sysroot/usr/include/bits/string3.h:81: warning: memset used with constant zero length parameter; this could be due to transposed parameters ../../external/bdwgc/.libs/libgc.a(gc.o): In function `GC_steal_mark_stack':
gc.c:(.text+0x1d18): undefined reference to `AO_store_full_emulation'

Well, isn't it simply forgetting to link with libatomic_ops ?

Look at your patch from 2018 on bdgwc:
http://lists.busybox.net/pipermail/buildroot/2018-November/235145.html,
the issue was the same, and was caused by the fact that it wasn't linking with libatomic_ops.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH 1/2 package/mono: fix build with libunwind

In reply to Fabrice Fontaine
Quoted 29 lines · On Wed, 20 Jan 2021 18:54:42 +0100 Fabrice Fontaine…

Commit 4be06fa8aa054e59d97866dc5568f4e10762e353 wrongly removed this patch which was rejected by upstream (and so not merged). Moreover, there is no way to disable unwind backtrace on mono. An interested party could try to send this patch again or work with upstream to add an option to disable backtrace.

Fixes:
- http://autobuild.buildroot.org/results/17f1282abda00aedaea1f3edbcae1b216b70552a

---
 ...01-configure-ac-checks-for-libunwind.patch | 38 +++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 package/mono/0001-configure-ac-checks-for-libunwind.patch
package/mono/0001-configure-ac-checks-for-libunwind.patch new file +8 -0
new file mode 100644
index 0000000000..3d9d8a249f
@@ -0,0 +1,38 @@
+From 05c9f2d51e74e847ebfa1efdd495d2b146803a07 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+Date: Wed, 15 May 2019 22:30:01 +0200
+Subject: [PATCH] configure.ac: checks for libunwind
+
+_Unwind_GetIP is used in build_stack_trace however this function can be
+provided by libunwind so check for it to avoid the following build
+failure:

package/mono/0001-configure-ac-checks-for-libunwind.patch line 18

Quoted 10 lines
package/mono/0001-configure-ac-checks-for-libunwind.patch new file +10 -0
+
+/home/buildroot/autobuild/run/instance-1/output/host/lib/gcc/arm-buildroot-linux-musleabihf/7.4.0/../../../../arm-buildroot-linux-musleabihf/bin/ld: ./.libs/libmini.a(libmini_la-mini-exceptions.o): in function `build_stack_trace':
+/home/buildroot/autobuild/run/instance-1/output/build/mono-5.20.1.27/mono/mini/mini-exceptions.c:365: undefined reference to `_Unwind_GetIP'
+collect2: error: ld returned 1 exit status
+
+Fixes:
+ - http://autobuild.buildroot.net/results/dbd64c89815d393a4e28b312d74fd80ee6de92da
+
+Signed-off-by: Fabrice Fontaine <[email protected]>
+[Upstream status: rejected (https://github.com/mono/mono/pull/18648)]

Well, it was not rejected, they made some comments and you didn't follow-up, so they closed for inactivity.

In fact, I remember discussing/researching this issue a while ago with Angelo, and Arnout also looked into this. See
http://lists.buildroot.org/pipermail/buildroot/2019-May/250772.html. I don't remember if we reached a conclusion back then.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com