Bug#977223: guile-3.0: FTBFS on hppa - segmentation faults

2022-02-28 Thread John Paul Adrian Glaubitz
Hi Rob!

On 2/28/22 19:18, John Paul Adrian Glaubitz wrote:
> The attached patch seems to work correctly. I had to escape the whole 
> statements
> so that they are not interpreted by automake.

I have verified that the attached patch fixes the build on 32-bit PowerPC 
(powerpc).

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



Bug#977223: guile-3.0: FTBFS on hppa - segmentation faults

2022-02-28 Thread John Paul Adrian Glaubitz
Hi Rob!

The attached patch seems to work correctly. I had to escape the whole statements
so that they are not interpreted by automake.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
--- guile-3.0-3.0.8.orig/bootstrap/Makefile.am
+++ guile-3.0-3.0.8/bootstrap/Makefile.am
@@ -22,7 +22,11 @@
 
 
 GUILE_WARNINGS = -W0
-GUILE_OPTIMIZATIONS = -O1
+$(ifeq($SCM_PREBUILT_BINARIES,"32-bit-little-endian") \
+	GUILE_OPTIMIZATIONS = -O1 -Oresolve-primitives -Ocps \
+else \
+	GUILE_OPTIMIZATIONS = -O1 \
+endif)
 
 include $(top_srcdir)/am/bootstrap.am
 
--- guile-3.0-3.0.8.orig/stage0/Makefile.am
+++ guile-3.0-3.0.8/stage0/Makefile.am
@@ -22,7 +22,12 @@
 
 
 GUILE_WARNINGS = -W0
-GUILE_OPTIMIZATIONS = -O1
+$(ifeq($SCM_PREBUILT_BINARIES,"32-bit-little-endian") \
+	GUILE_OPTIMIZATIONS = -O1 -Oresolve-primitives -Ocps \
+else \
+	GUILE_OPTIMIZATIONS = -O1 \
+endif)
+
 GUILE_BOOTSTRAP_STAGE = stage0
 
 include $(top_srcdir)/am/bootstrap.am


Bug#977223: guile-3.0: FTBFS on hppa - segmentation faults

2022-02-28 Thread John Paul Adrian Glaubitz
Hi!

On 2/28/22 11:16, John Paul Adrian Glaubitz wrote:
> On 2/28/22 09:53, John Paul Adrian Glaubitz wrote:
>> I tested your proposed patch on the porterbox perotto.debian.net in a powerpc
>> chroot, but unfortunately it didn't work:
> 
> I think this check is wrong:
> 
> diff --git a/configure.ac b/configure.ac
> index 827e1c09d..dec060414 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -369,6 +369,9 @@ else
>  fi
>  AC_SUBST([SCM_I_GSC_T_PTRDIFF])
>  
> +AM_CONDITIONAL([DEB_GUILE_32_BIT_BIG_ENDIAN],
> +  [test "$ac_cv_words_bigendian" && test "$ac_cv_sizeof_void_p" -lt 8])
> +
>  AC_CHECK_HEADERS([stdatomic.h])
>  
>  AC_MSG_CHECKING([for which prebuilt binary set to use during bootstrap])
> 
> It looks like the correct variable name for the big-endian check is
> 
>   $ac_cv_c_bigendian

Why not just use the result of this check?

AC_MSG_CHECKING([for which prebuilt binary set to use during bootstrap])
SCM_PREBUILT_BINARIES=
case "$ac_cv_c_bigendian-$ac_cv_sizeof_void_p" in
  yes-8) SCM_PREBUILT_BINARIES=64-bit-big-endian;;
  yes-4) SCM_PREBUILT_BINARIES=32-bit-big-endian;;
  no-8) SCM_PREBUILT_BINARIES=64-bit-little-endian;;
  no-4) SCM_PREBUILT_BINARIES=32-bit-little-endian;;
  *) AC_MSG_ERROR([Unexpected endianness+pointer size combination.])
esac
AC_MSG_RESULT($SCM_PREBUILT_BINARIES)
AC_SUBST([SCM_PREBUILT_BINARIES])

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



Bug#977223: guile-3.0: FTBFS on hppa - segmentation faults

2022-02-28 Thread John Paul Adrian Glaubitz
Hi Rob!

On 2/28/22 09:53, John Paul Adrian Glaubitz wrote:
> I tested your proposed patch on the porterbox perotto.debian.net in a powerpc
> chroot, but unfortunately it didn't work:

I think this check is wrong:

diff --git a/configure.ac b/configure.ac
index 827e1c09d..dec060414 100644
--- a/configure.ac
+++ b/configure.ac
@@ -369,6 +369,9 @@ else
 fi
 AC_SUBST([SCM_I_GSC_T_PTRDIFF])
 
+AM_CONDITIONAL([DEB_GUILE_32_BIT_BIG_ENDIAN],
+  [test "$ac_cv_words_bigendian" && test "$ac_cv_sizeof_void_p" -lt 8])
+
 AC_CHECK_HEADERS([stdatomic.h])
 
 AC_MSG_CHECKING([for which prebuilt binary set to use during bootstrap])

It looks like the correct variable name for the big-endian check is

$ac_cv_c_bigendian

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



Bug#977223: guile-3.0: FTBFS on hppa - segmentation faults

2022-02-28 Thread John Paul Adrian Glaubitz
Hi Rob!

On 2/28/22 05:13, Rob Browning wrote:
> Oh, and I'm not sure it's working exactly right yet, but I'd been toying
> with a more selective approach that works with automake's if/then
> restrictions via an AM_CONDITIONAL.  Of course we'll still need to
> figure out which Makefiles we need to adjust.

I tested your proposed patch on the porterbox perotto.debian.net in a powerpc
chroot, but unfortunately it didn't work:

In unknown file:
  13 (_ # # #)
  12 (_ # # #)
In ice-9/eval.scm:
619:8 11 (_ #(#(# # ?)))
   196:35 10 (_ #(#(# ?) #))
In unknown file:
   9 (_ # # #)
   8 (_ # # #)
   7 (_ # # #)
In ice-9/eval.scm:
   202:35  6 (_ #(#(# ?) ?))
In language/tree-il/optimize.scm:
 56:6  5 (_ _ #)
In language/tree-il.scm:
   573:16  4 make[4]: *** [Makefile:2419: language/cps/intset.go] Segmentation 
fault

FWIW, you can access the porterbox yourself using your Debian SSH account.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



Bug#977223: guile-3.0: FTBFS on hppa - segmentation faults

2022-02-27 Thread Rob Browning
John Paul Adrian Glaubitz  writes:

> Could you include this patch or a possible better version in the next 
> guile-3.0 upload?

As mentioned, I'm working on 3.0.8, and the bootstrap process has
changed somewhat to support reproducible builds.  So I went ahead and
uploaded 3.0.8-1 without this patch, and then I hoped, if you have time,
you might be able to test that and see if we need to make adjustments to
the fix.  In particular, guile now has
{bootstrap,stage0,stage1,stage2}/Makefile.am.

It may be that we only need to adjust a subset of these (say bootstrap
and/or stage0)...

Oh, and I'm not sure it's working exactly right yet, but I'd been toying
with a more selective approach that works with automake's if/then
restrictions via an AM_CONDITIONAL.  Of course we'll still need to
figure out which Makefiles we need to adjust.

commit 6c1173b3a96d65159062b2ba82afb7264a01591e
Author: Rob Browning 
Date:   Sun Feb 27 12:55:42 2022 -0600

Adjust GUILE_OPTIMIZATION to avoid 32-bit BE build crashes

diff --git a/bootstrap/Makefile.am b/bootstrap/Makefile.am
index a4634c447..0aa548c26 100644
--- a/bootstrap/Makefile.am
+++ b/bootstrap/Makefile.am
@@ -22,7 +22,14 @@
 
 
 GUILE_WARNINGS = -W0
-GUILE_OPTIMIZATIONS = -O1
+
+if !DEB_GUILE_32_BIT_BIG_ENDIAN
+  $(info Note: not adjusting GUILE_OPTIMIZATIONS for 32-bit big-endian architecture)
+  GUILE_OPTIMIZATIONS = -O1
+else
+  $(info Note: adjusting GUILE_OPTIMIZATIONS for 32-bit big-endian architecture)
+  GUILE_OPTIMIZATIONS = -O1 -Oresolve-primitives -Ocps
+endif
 
 include $(top_srcdir)/am/bootstrap.am
 
diff --git a/configure.ac b/configure.ac
index 827e1c09d..dec060414 100644
--- a/configure.ac
+++ b/configure.ac
@@ -369,6 +369,9 @@ else
 fi
 AC_SUBST([SCM_I_GSC_T_PTRDIFF])
 
+AM_CONDITIONAL([DEB_GUILE_32_BIT_BIG_ENDIAN],
+  [test "$ac_cv_words_bigendian" && test "$ac_cv_sizeof_void_p" -lt 8])
+
 AC_CHECK_HEADERS([stdatomic.h])
 
 AC_MSG_CHECKING([for which prebuilt binary set to use during bootstrap])
diff --git a/stage0/Makefile.am b/stage0/Makefile.am
index 12029fb45..4228f607d 100644
--- a/stage0/Makefile.am
+++ b/stage0/Makefile.am
@@ -22,7 +22,15 @@
 
 
 GUILE_WARNINGS = -W0
-GUILE_OPTIMIZATIONS = -O1
+
+if !DEB_GUILE_32_BIT_BIG_ENDIAN
+  $(info Note: not adjusting GUILE_OPTIMIZATIONS for 32-bit big-endian architecture)
+  GUILE_OPTIMIZATIONS = -O1
+else
+  $(info Note: adjusting GUILE_OPTIMIZATIONS for 32-bit big-endian architecture)
+  GUILE_OPTIMIZATIONS = -O1 -Oresolve-primitives -Ocps
+endif
+
 GUILE_BOOTSTRAP_STAGE = stage0
 
 include $(top_srcdir)/am/bootstrap.am

Oh, and you should be able to see those $(info ...) messages in the
build output, so we'll be able to see if it's picking the right setting.
(I just verified that it picks the right one for amd64, at least.)

Thanks
-- 
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4


Bug#977223: guile-3.0: FTBFS on hppa - segmentation faults

2022-02-26 Thread Rob Browning
John Paul Adrian Glaubitz  writes:

> Any chance this patch could be included for the next upload?
>
> This bug is currently blocking package builds on powerpc.

I'm working on 3.0.8, and I'll see about including it there, either in
the initial upload, or subsequently.  I also plan to add the other
"disable threads" fix for the relevant architectures.

Thanks, and apologies for the delay.
-- 
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4



Bug#977223: guile-3.0: FTBFS on hppa - segmentation faults

2022-02-16 Thread John Paul Adrian Glaubitz
Hello!

On 10/3/21 12:43, John Paul Adrian Glaubitz wrote:
> The attached patch fixes the problem for me. It was suggested by Efraim 
> Flashner
> in the corresponding upstream bug report [1].
> 
> It simply adds "-Oresolve-primitives -Ocps" to GUILE_OPTIMIZATIONS in 
> bootstrap/
> Makefile.am. I have tried coming up a with a solution to add these flags on 
> hppa,
> m68k and powerpc only but I couldn't find any suitable solution.
> 
> However, I would assume that passing these flags to the bootstrap build won't 
> hurt
> as the second stage is built with -O2 anyway and the above flags are not 
> being used
> in this case.

Any chance this patch could be included for the next upload?

This bug is currently blocking package builds on powerpc.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



Bug#977223: guile-3.0: FTBFS on hppa - segmentation faults

2021-10-03 Thread John Paul Adrian Glaubitz
Control: retitle -1 guile-3.0: Please include patch to fix FTBFS on 32-bit BE 
systems
Control: tags -1 +patch

Hello!

The attached patch fixes the problem for me. It was suggested by Efraim Flashner
in the corresponding upstream bug report [1].

It simply adds "-Oresolve-primitives -Ocps" to GUILE_OPTIMIZATIONS in bootstrap/
Makefile.am. I have tried coming up a with a solution to add these flags on 
hppa,
m68k and powerpc only but I couldn't find any suitable solution.

However, I would assume that passing these flags to the bootstrap build won't 
hurt
as the second stage is built with -O2 anyway and the above flags are not being 
used
in this case.

Could you include this patch or a possible better version in the next guile-3.0 
upload?

Adrian

> [1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=45214

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913--- guile-3.0-3.0.7.orig/bootstrap/Makefile.am
+++ guile-3.0-3.0.7/bootstrap/Makefile.am
@@ -22,7 +22,7 @@
 
 
 GUILE_WARNINGS = -W0
-GUILE_OPTIMIZATIONS = -O1
+GUILE_OPTIMIZATIONS = -O1 -Oresolve-primitives -Ocps
 
 include $(top_srcdir)/am/bootstrap.am
 


Bug#977223: guile-3.0: FTBFS on hppa - segmentation faults

2020-12-12 Thread John David Anglin
Source: guile-3.0
Version: 3.0.4-3
Severity: normal

Dear Maintainer,

Since version 3.0.4-1, guile-3.0 fails to build due to segmentation faults
in libguile.  See:
https://buildd.debian.org/status/logs.php?pkg=guile-3.0=hppa

The first fault is here:
Core was generated by 
`/home/dave/debian/guile-3.0/guile-3.0-3.0.4/libguile/.libs/guile -e (@@ 
(guild)'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0xf75c31cc in iprin1 (exp=0xf3d127f0, port=0xf7a61190, pstate=0xf7a676cc)
at print.c:633
633 if (SCM_OBJ_CLASS_FLAGS (exp) & SCM_CLASSF_GOOPS)
[Current thread is 1 (Thread 0xf7afdb40 (LWP 2407))]
(gdb) bt
#0  0xf75c31cc in iprin1 (exp=0xf3d127f0, port=0xf7a61190, pstate=0xf7a676cc)
at print.c:633
#1  0xf75c2728 in scm_prin1 (exp=0xf3d127f0, port=,
writingp=-140085516) at print.c:840
#2  0xf75c3f0c in scm_simple_format (destination=0xf3d127f0,
message=0xf6e84800, args=0xf114cdd0) at print.c:1198
#3  0xf7579a1c in scm_apply_subr (sp=, idx=,
nslots=) at gsubr.c:482
#4  0xf760d120 in vm_regular_engine (thread=0x41) at vm-engine.c:972
#5  0xf761018c in scm_call_n (proc=0xf7a61190, argv=0xf3d127f0,
nargs=4154881740) at vm.c:1608
#6  0xf755d458 in scm_call_4 (proc=, arg1=,
arg2=, arg3=, arg4=)
at eval.c:517
#7  0xf754a7ac in scm_print_exception (port=0xf7a676cc, frame=0xf3d127f0,
key=0xf114cdd0, args=0xf7a61190) at backtrace.c:121
#8  0xf7556620 in print_exception_and_backtrace (args=0xf114cdd0,
tag=0xf3d127f0, port=0xf7a61190) at continuations.c:415
#9  pre_unwind_handler (error_port=0xf7a61190, tag=0xf3d127f0, args=0xf114cdd0)
at continuations.c:453
#10 0xf7601740 in catch_pre_unwind_handler (data=0xf7a676b8, exn=0xf3d127f0)
at throw.c:135
#11 0xf755eeec in call_exception_handler (clo=,
--Type  for more, q to quit, c to continue without paging--
exn=) at exceptions.c:100
#12 0xf75d2f38 in apply_1 (smob=, a=)
at smob.c:144
#13 0xf7579a00 in scm_apply_subr (sp=, idx=,
nslots=) at gsubr.c:480
#14 0xf760d120 in vm_regular_engine (thread=0x41) at vm-engine.c:972
#15 0xf761018c in scm_call_n (proc=0xf7a61190, argv=0xf3d127f0,
nargs=4154881740) at vm.c:1608
#16 0xf755d764 in scm_apply_0 (proc=0xf114cdd0, args=0xf7a676cc) at eval.c:603
[...]

(gdb) disass $pc-16,$pc+16
Dump of assembler code from 0xf75c31bc to 0xf75c31dc:
   0xf75c31bc :ldw 24(r5),r20
   0xf75c31c0 :cmpb,= r20,ret0,0xf75c3a98 
   0xf75c31c4 :ldo 28(r5),r9
   0xf75c31c8 :ldw 0(r3),ret0
=> 0xf75c31cc :ldw 7(ret0),ret0
   0xf75c31d0 :bb,>=,n ret0,16,0xf75c3a04 
   0xf75c31d4 :ldw 8(r5),ret0
   0xf75c31d8 :cmpib,= 0,ret0,0xf75c3a3c 
End of assembler dump.
(gdb) p/x $ret0
$1 = 0x1
(gdb) p/x exp
$2 = 0xf3d127f0
(gdb) p/x $r3
$3 = 0xf3d127f0
(gdb) x/x $r3
0xf3d127f0: 0x0001
(gdb) ptype exp
type = struct scm_unused_struct {
char scm_unused_field;
} *
(gdb) Quit

There are some complex casting games going on here that might not work
on a big-endian target that requires strict alignment.  Nominally, exp
points to a char, yet the generated code implies that exp points to a
word that contains a pointer to some flag bits. 

Regards,
Dave Anglin

-- System Information:
Debian Release: bullseye/sid
  APT prefers buildd-unstable
  APT policy: (500, 'buildd-unstable'), (500, 'unstable')
Architecture: hppa (parisc64)

Kernel: Linux 5.9.14+ (SMP w/4 CPU threads)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)