Re: Bug#881772: ruby2.5: FTBFS on ppc64(el): stack level too deep
This is a debdiff that fixes the problem. This is basically a cherry pick of
the patch that I got accepted upstream.
diff --git a/debian/changelog b/debian/changelog
index e8cc49ce..8af9b584 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+ruby2.5 (2.5.0~preview1-1.1) UNRELEASED; urgency=medium
+
+ * Fixed FTBFS on ppc64el (Closes: 881772).
+
+ -- Breno Leitao <leitao@debian.org> Tue, 05 Dec 2017 06:46:16 -0500
+
ruby2.5 (2.5.0~preview1-1) unstable; urgency=medium
[ Antonio Terceiro ]
diff --git a/debian/patches/0006-Fix-FTBFS-on-ppc64el.patch b/debian/patches/0006-Fix-FTBFS-on-ppc64el.patch
new file mode 100644
index 00000000..90b06212
--- /dev/null
+++ b/debian/patches/0006-Fix-FTBFS-on-ppc64el.patch
@@ -0,0 +1,49 @@
+From b2047f79cce41695b3a3f84d88afd1b586680f29 Mon Sep 17 00:00:00 2001
+From: hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
+Date: Tue, 5 Dec 2017 01:10:13 +0000
+Subject: [PATCH] vm_core.h: Increase the Fiber stack size on powerpc64
+
+Currently the Fiber stack size is small for powerpc64 and it causes
+test/ruby/test_backtrace.rb test to break, since it is using a 8kb stack
+size.
+
+It breaks on powerpc64 due to the fact that a frame in the stack is
+usually 50% bigger on powerpc64 compared to Intel, due to some
+considerations:
+
+ * The powerpc64 minimum frame is 2x bigger than on Intel
+ * Powerpc has more registers that might be saved in the frame compared
+ to Intel.
+
+I ran the same ruby test that is failing on both Intel and Powerpc, and
+each Fiber frame is ~50% bigger on powerpc64 for every single lambda
+function, thus, we need to increase the stack size on powerpc64 to
+accomodate the same tests/applications.
+
+This fixes bug#13757.
+
+Signed-off-by: Breno Leitao <leitao@debian.org>
+
+git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
+---
+ vm_core.h | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/vm_core.h b/vm_core.h
+index 73b552edd30f..b25c68125c5e 100644
+--- a/vm_core.h
++++ b/vm_core.h
+@@ -585,8 +585,12 @@ typedef struct rb_vm_struct {
+
+ #define RUBY_VM_FIBER_VM_STACK_SIZE ( 16 * 1024 * sizeof(VALUE)) /* 64 KB or 128 KB */
+ #define RUBY_VM_FIBER_VM_STACK_SIZE_MIN ( 2 * 1024 * sizeof(VALUE)) /* 8 KB or 16 KB */
+-#define RUBY_VM_FIBER_MACHINE_STACK_SIZE ( 64 * 1024 * sizeof(VALUE)) /* 256 KB or 512 KB */
++#define RUBY_VM_FIBER_MACHINE_STACK_SIZE ( 64 * 1024 * sizeof(VALUE)) /* 256 KB or 512 KB */
++#if defined(__powerpc64__)
++#define RUBY_VM_FIBER_MACHINE_STACK_SIZE_MIN ( 32 * 1024 * sizeof(VALUE)) /* 128 KB or 256 KB */
++#else
+ #define RUBY_VM_FIBER_MACHINE_STACK_SIZE_MIN ( 16 * 1024 * sizeof(VALUE)) /* 64 KB or 128 KB */
++#endif
+
+ /* optimize insn */
+ #define INTEGER_REDEFINED_OP_FLAG (1 << 0)
diff --git a/debian/patches/series b/debian/patches/series
index 96e4a00c..c83b68eb 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@
0003-Mark-Gemspec-reproducible-change-fixing-784225-too.patch
0004-Make-gemspecs-reproducible.patch
0005-Exclude-tests-that-fail-on-Debian-builds.patch
+0006-Fix-FTBFS-on-ppc64el.patch
Reply to: