Re: sbcl for RISC-V?

Faried Nawaz <[email protected]> Sat, 11 Oct 2025 01:28:06 +0500
Newsgroups gmane.lisp.steel-bank.general
Message-ID <[email protected]>
Douglas Katzman via Sbcl-help <[email protected]> writes:

> We need to see the specific errors rather than merely a report that it
> doesn't work
> I just built for risc-v at the latest commit. This was on cfarm95 on the
> gcc farm. cfarm94 which is Alpine doesn't compile the C runtime.

I used to build sbcl for a couple of years with "make.sh
--without-sb-thread" and a small change to riscv/parms.lisp, and it
would build and run the tests without crashing.  Now, if I build with
that flag, I end up at an ldb prompt during the build; without that
flag, I see the memory corruption for some of the tests (and the tests
end prematurely).

Part of this is probably self-inflicted, and I can move the discussion
to -devel.

First, the good news.  I can build 2.5.4 and 2.5.9 using 2.5.3.  2.5.3's
*features* is

(:RISCV :GENCGC :64-BIT :ANSI-CL :COMMON-LISP :ELF :IEEE-FLOATING-POINT :LINUX
 :LITTLE-ENDIAN :PACKAGE-LOCAL-NICKNAMES :SB-LDB :SB-PACKAGE-LOCKS :SB-THREAD
 :SB-UNICODE :SBCL :UNIX)

2.5.9's *features* is the same, as expected.

My build command:

git clean -fx && rm -fr obj/* output/* && git checkout sbcl-2.5.9 && sh ./make.sh

Neither 2.5.4 nor 2.5.9 will pass the tests (sh run-tests.sh) without
crashing.

For 2.5.4:

// Running /home/fn/repos/sbcl/tests/gethash-concurrency.pure.lisp in COMPILE evaluator mode
::: SKIPPED-BROKEN (HASH-TABLE :UNSYNCHRONIZED) Test broken on this platform
::: Running (HASH-TABLE :SYNCHRONIZED)
::: Success (HASH-TABLE :SYNCHRONIZED)
::: Running (HASH-TABLE :PARALLEL-READERS-EQ-TABLE)
CORRUPTION WARNING in SBCL pid 2041481 tid 2041549:
Memory fault at 0xd (pc=0x4fc99b58)
The integrity of this image is possibly compromised.
Exiting.
   0: [I]0x7fffa76ce8a0 pc=0x4fc99b58 {0x4fc993c0+0798} RANDOM
   1:     0x7fffa76ce7c0 pc=0x52036f80 {0x7fffa7acc7a0+aa56a7e0} {code_serialno=a7acd180}
   2:     0x7fffa76ce648 pc=0x4f03deb0
   3:     0x7fffa76ce4d0 pc=0x4f03ee20
   4:     0x7fffa76ce2f0 pc=0x4f03d7b0
   5:     0x7fffa76ce178 pc=0x4f03e520
   6:     0x7fffa76ce000 pc=0x4f03d310 {0x4100010+4af3d300} CORRUPTION WARNING in SBCL pid 2041481 tid 2041549:
Memory fault at 0x820002b (pc=0x5555698be90c)
The integrity of this image is possibly compromised.
Exiting.
test failed, expected 104 return code, got 1

2.5.9:

// Running /home/fn/repos/sbcl/tests/gethash-concurrency.pure.lisp in COMPILE evaluator mode
::: SKIPPED-BROKEN (HASH-TABLE :UNSYNCHRONIZED) Test broken on this platform
::: Running (HASH-TABLE :SYNCHRONIZED)
::: Success (HASH-TABLE :SYNCHRONIZED)
::: Running (HASH-TABLE :PARALLEL-READERS-EQ-TABLE)
CORRUPTION WARNING in SBCL pid 2043123 tid 2043277:
Memory fault at 0x7fffbae4d7d0 (pc=0x4fc9fa28)
The integrity of this image is possibly compromised.
Exiting.
   0: [I]0x7fffbb6448a0 pc=0x4fc9fa28 {0x4fc9f930+00f8} RANDOM
   1:     0x7fffbb6447c0 pc=0x510a1100 {0x7fffbba427b0+9565e950} {code_serialno=bba43180}
   2:     0x7fffbb644648 pc=0x4f03dda0
   3:     0x7fffbb6444d0 pc=0x4f03ee40
   4:     0x7fffbb6442f0 pc=0x4f03d690
   5:     0x7fffbb644178 pc=0x4f03e350
   6:     0x7fffbb644000 pc=0x4f03d2a0
Note: [I] = interrupted
test failed, expected 104 return code, got 1

parallel-readers-eql-table and parallel-readers-equal-table are marked
broken on riscv; what happens if i skip parallel-readers-eq-table by
marking it broken as well?  On 2.5.9, it fails immediately after that:

// Running /home/fn/repos/sbcl/tests/gethash-concurrency.pure.lisp in COMPILE evaluator mode
::: SKIPPED-BROKEN (HASH-TABLE :UNSYNCHRONIZED) Test broken on this platform
::: Running (HASH-TABLE :SYNCHRONIZED)
::: Success (HASH-TABLE :SYNCHRONIZED)
::: SKIPPED-BROKEN (HASH-TABLE :PARALLEL-READERS-EQ-TABLE)
    Test broken on this platform
::: SKIPPED-BROKEN (HASH-TABLE :PARALLEL-READERS-EQL-TABLE)
    Test broken on this platform
::: SKIPPED-BROKEN (HASH-TABLE :PARALLEL-READERS-EQUAL-TABLE)
    Test broken on this platform
::: Running (HASH-TABLE :SINGLE-ACCESSOR :PARALLEL-GC)
CORRUPTION WARNING in SBCL pid 2045003 tid 2045163:
Memory fault at 0x7fff885f5be0 (pc=0x4f371fc0)
The integrity of this image is possibly compromised.
Exiting.
   0: [I]0x7fff8983f870 pc=0x4f371fc0 {0x4f371f00+00c0} SB-IMPL::GETHASH/EQL-HASH
   1:     0x7fff8983f7c0 pc=0x51470bf0 {0x4f7b90c0+1cb7b30} CORRUPTION WARNING in SBCL pid 2045003 tid 2045163:
Memory fault at 0x9e801b37 (pc=0x555593935e06)
The integrity of this image is possibly compromised.
Exiting.
test failed, expected 104 return code, got 1

The failure is erratic; running "sh ./run-tests.sh gethash-concurrency.pure.lisp" works sometimes.

What about turning threading off?  I end up dropped into the debugger
during the build.  I've uploaded my 2.5.4 and 2.5.9 build outputs to

https://node.pk/tmp/sbcl-builds/

I typed "ba" at the ldb prompt and it didn't have a backtrace to print.
Unfortunately, my interaction with ldb wasn't captured in the build
files.

This is on a vendor distribution based on Debian sid; uname -a:

Linux rockos-eswin 6.6.66-win2030 #2025.01.14.09.00+4683e0f56 SMP Tue Jan 14 09:09:40 UTC 2025 riscv64 GNU/Linux

with libc6 2.40-3

No vector support on this processor (eswin 7700x), but it builds sbcl in
about 12 minutes (cfarm95 might be 30 minutes if it has the Spacemit K1
processor?).


Faried.