[Sbcl-help] SBCL 2.3.7 on NetBSD/sparc64?

3 views
Skip to first unread message

Alexander Schreiber

unread,
Aug 14, 2023, 3:30:31 PM8/14/23
to sbcl...@lists.sourceforge.net
(resending as previous message is stuck in moderator queue due to size)

Hi,

I've been trying to build SBCL 2.37 on NetBSD 9.3 on a sparc64 machine.
The standard "helper lisp" is CLisp, which doesn't work all that well
on that platform. After some digging and experimenting, I managed to
get the build going with ecl (version ecl-21.2.1nb1, straight from
pkgsrc). It first failed with a compiler error about undeclared use
of general registers in src/runtime/sparc-assem.S which is fixed with
the attached trivial patch.

The it got all the way to writing the cold core and getting to warm
init, greeting me with:
This is SBCL 2.3.7, an implementation of ANSI Common Lisp.
only to die because it didn't like the core magic:
invalid magic number in core: 5342434c00000f14 should have been 5342434c
which is defined in tools-for-build/corefile.lisp as
(defconstant core-magic #x5342434C)
and written into the genesis config C headers as
#define CORE_MAGIC 0x5342434C
by src/compiler/generic/genesis.lisp
(format t "#define CORE_MAGIC 0x~X~%" core-magic)

Given that LISP_FEATURE_64_BIT is not set for this build (which I see
on a Linux/amd64 build) and that the register use complaint seems to
be specific to sparcv9 (aka sparc64), I assume I'm looking at a 32bit
build that is somewhat confused by the 64bit platform it finds itself
on (e.g. trying to compare a 32bit magic number to a 64bit int fished
out of the core file which is what obviously happens).

Of course, ignorantly taking the (>> 32) hacksaw to a corner of coreparse.c
went about as well as I expected, with SBCL dying with an unknown header
entry. I assume force-flipping LISP_FEATURE_64_BIT is going to be equally
successful without the necessary groundwork to actually work properly
on what appears to be a not really supported platform. Any comments from
folks that actually understand the system (SBCL I mean)?

Register use patch and complete build log (well, as far as I got) is
here:
https://www.thangorodrim.ch/sbcl/register-use_runtime_src_sparc-assem.S.diff
https://www.thangorodrim.ch/sbcl/sbcl-2.3.7.log


Kind regards,
Alex.
--
"Opportunity is missed by most people because it is dressed in overalls and
looks like work." -- Thomas A. Edison


_______________________________________________
Sbcl-help mailing list
Sbcl...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-help

Stas Boukarev

unread,
Aug 14, 2023, 3:40:33 PM8/14/23
to Alexander Schreiber, sbcl...@lists.sourceforge.net
Can you pass -m32 to the c compiler?

Alexander Schreiber

unread,
Sep 21, 2023, 2:01:30 PM9/21/23
to Stas Boukarev, sbcl...@lists.sourceforge.net
On Mon, Aug 14, 2023 at 10:40:01PM +0300, Stas Boukarev wrote:
> Can you pass -m32 to the c compiler?

Update: I've managed to get a 32bit build going on the NetBSD/sparc64
machine, but that now dies in the C part of the garbage collector:

------- snip -----------

//testing for consistency of first and second GENESIS passes
//header files match between first and second GENESIS -- good
26050.66 real 15560.13 user 859.36 sys
//entering make-target-2.sh
//doing warm init - compilation phase


This is SBCL 2.3.7, an implementation of ANSI Common Lisp.

More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
Initial page table:
Immobile Object Counts
Gen layout fdefn symbol code Boxed Cons Raw Code SmMix Mixed LgRaw LgCode LgMix Waste% Alloc Trig Dirty GCs Mem-age
6 0 0 0 0 0 231 0 1855 0 1545 0 0 0 0.3 29664264 2000000 1855 0 0.0000
Tot 0 0 0 0 0 231 0 1855 0 1545 0 0 0 0.3 29664264 [5.5% of 536870912 max]
fatal error encountered in SBCL pid 24591:
GC invariant lost, file "gencgc.c", line 4659

Welcome to LDB, a low-level debugger for the Lisp runtime environment.
ldb> 18700.62 real 0.02 user 0.07 sys

------- snip -----------

I've also spun up a virtual SparcStation20 via qemu-system-space to
try to build on NetBSD/sparc (== 32bit env). That already failed with
trying to get any of the bootstrap systems (clisp, tried ecl, didn't
try abcl due to horrible slowness) to actually build - all failed in
ways that imply nobody has tried them on 32bit sparc in a long time
(such as trying to map, from userspace, a memory address that belongs
to the kernel).

It _did_ find a sbcl-1.0.26.1-sparc-netbsd-4.0.tar.gz that I scraped
out of the WaybackMachine, but that crashes with illegal instruction
early in the SBCL build process. I have zero idea how _that_ was built back
then. I can't current spin up a NetBSD 4.0 sparc system, because
archive.netbsd.org is currently broken and the install images are nowhere
else to be found.

So, with that I'm giving up my fools quest ;-)

Given that NetBSD/sparc is marked as "available and supported" on
https://sbcl.org/platform-table.html that this be updated to "used
to work, bit but not anymore" (or something along those lines) as
I do not expect anybody with sufficient SCBL internals knowledge
to expend any of their limited time on digging into an old and obsolete
platform.

As a sidenote: I've just built SBCL 2.3.8 on my Pinebook (NetBSD/evbarm,
an aarch64 machine) and it seems to work very well. Thanks to the folks
who made that possible!

Kind regards,
Alex.

Reply all
Reply to author
Forward
0 new messages