Opened 2 years ago

Closed 17 months ago

#65188 closed defect (fixed)

sbcl fails to build on PPC: fatal error encountered in SBCL pid 16153: dynamic space too small for core

Reported by: barracuda156 Owned by: easye
Priority: Normal Milestone:
Component: ports Version: 2.7.2
Keywords: powerpc Cc: kakuhen, acjones8 (Alex Jones), amock (Alan Mock)
Port: sbcl

Description

I am trying to get sbcl to build for PPC. This ticket is for @2.2.2, which is not the current version in Macports. However please bear with me here. I am pretty sure restoring PPC support into @2.2.4 is relatively trivial once @2.2.2 is confirmed to build (it is the last version having PPC code before it was removed). (In fact I have preliminary patches for @2.2.4.)

I need to get past the following error. I initially got it when using @1.2.8 to build @2.2.2. Then I built @1.5.9 with @1.2.8 and tried again, same failure.

//entering make-target-2.sh
//doing warm init - compilation phase
This is SBCL 2.2.2, 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.
fatal error encountered in SBCL pid 16153:
dynamic space too small for core: 31044KiB required, 0KiB available.

Command failed: SBCL_MACOSX_VERSION_MIN=10.6 CC=/usr/bin/gcc-4.2 CXX=/usr/bin/g++-4.2 CPP=/usr/bin/cpp-4.2 sh ./make.sh  --prefix=/opt/local --xc-host="/opt/local/share/sbcl-ppc/bin/sbcl --core /opt/local/share/sbcl-ppc/lib/sbcl/sbcl.core --disable-debugger --sysinit /dev/null --userinit /dev/null"  --dynamic-space-size=8Gb
Exit code: 1

I added --dynamic-space-size=8Gb following some suggestion online, it did not help. (At first I did not specify this flag.)

  1. S. A caveat: threads are broken (might be fixable), so my builds are without variants added.

Attachments (4)

sbcl-ppc-bootstrap.zip (11.8 KB) - added by barracuda156 2 years ago.
This should build 1.2.8 on Leopard or Snow Leopard PPC (Tiger and Rosetta fail). WIP version: I did a quick cleanup now, hopefully didn't delete anything necessary.
sbcl-ppc.zip (9.0 KB) - added by barracuda156 2 years ago.
Then this should build sbcl 1.5.9, using sbcl-ppc-bootstrap (tested on 10.6 PPC). Variants won't build. WIP, no clean-up
MacPorts-SBCL-PPC-Tiger.tar.bz2 (11.8 KB) - added by tomio-arisaka (Tomio Arisaka) 2 years ago.
old SBCL portfiles for PPC Tiger
SBCL LOG.tar.gz (127.9 KB) - added by kakuhen 2 years ago.
Compile logs of SBCL 2.2.2 on PowerPC Leopard, with TEST results and "port installed" output.

Download all attachments as: .zip

Change History (41)

comment:1 Changed 2 years ago by barracuda156

For the record, current test status on PPC.

sbcl 1.5.9 (tested on 10.6 PPC):

Finished running tests.
Status:
 Expected failure:   array.pure.lisp / CHECK-BOUND-SIGNED-BOUND-NOTES
 Failure:            compiler-2.pure.lisp / MODULAR-ARITH-TYPE-DERIVERS
 Failure:            compiler.pure.lisp / (ODDP BIGNUM NO-CONSING)
 Failure:            compiler.pure.lisp / (LOGTEST BIGNUM NO-CONSING)
 Failure:            compiler.pure.lisp / REDUCING-CONSTANTS
 Failure:            compiler.pure.lisp / REDUCING-CONSTANTS.2
 Failure:            defglobal.pure.lisp / DEFCONSTANT-EVALS
 Failure:            defglobal.pure.lisp / DEFGLOBAL-REFERS-TO-DEFGLOBAL
 Expected failure:   float.pure.lisp / (SCALE-FLOAT-OVERFLOW BUG-372)
 Expected failure:   float.pure.lisp / (ADDITION-OVERFLOW BUG-372)
 Expected failure:   float.pure.lisp / (ADDITION-OVERFLOW BUG-372 TAKE-2)
 Failure:            interface.pure.lisp / (SLEEP BUG-1194673)
 Skipped (broken):   interface.pure.lisp / RESTART-BOGUS-ARG-TO-VALUES-LIST-ERROR
 Failure:            octets.pure.lisp / COMPILE-FILE-POSITION-WITH-ENCODINGS
 Failure:            stream.pure.lisp / (STREAM LISTEN-VS-SELECT)
 Unhandled Error     backq.pure-cload.lisp
 Unhandled Error     compiler.pure-cload.lisp
 Failure:            compiler.impure.lisp / REGRESSION-1.0.29.54
 Expected failure:   compiler.impure.lisp / FTYPE-RETURN-TYPE-CONFLICT
 Failure:            deadline.impure.lisp / (WITH-DEADLINE SLEEP NO-SLEEP)
 Unexpected success: debug.impure.lisp / (TRACE ENCAPSULATE NIL)
 Unexpected success: debug.impure.lisp / (TRACE ENCAPSULATE NIL RECURSIVE)
 Expected failure:   debug.impure.lisp / PROPERLY-TAGGED-P-INTERNAL
 Expected failure:   dynamic-extent.impure.lisp / DX-COMPILER-NOTES
 Failure:            float.impure.lisp / (RANGE-REDUCTION PRECISE-PI)
 Expected failure:   fopcompiler.impure.lisp / FOPCOMPILER-DEPRECATED-VAR-WARNING
 Expected failure:   full-eval.impure.lisp / INLINE-FUN-CAPTURES-DECL
 Failure:            load.impure.lisp / LOAD-DEFAULT-OBSOLETE-FASL-RESTART-SOURCE
 Expected failure:   packages.impure.lisp / USE-PACKAGE-CONFLICT-SET
 Expected failure:   packages.impure.lisp / IMPORT-SINGLE-CONFLICT
 Failure:            timer.impure.lisp / (TIMER RELATIVE)
 Failure:            timer.impure.lisp / (TIMER ABSOLUTE)
 Failure:            timer.impure.lisp / (TIMER REPEAT-AND-UNSCHEDULE)
 Failure:            timer.impure.lisp / (TIMER RESCHEDULE)
 Failure:            timer.impure.lisp / (TIMER STRESS)
 Failure:            timer.impure.lisp / (TIMER STRESS2)
 Failure:            timer.impure.lisp / (WITH-TIMEOUT TIMEOUT)
 Failure:            timer.impure.lisp / (WITH-TIMEOUT NESTED-TIMEOUT-SMALLER)
 Failure:            timer.impure.lisp / (WITH-TIMEOUT NESTED-TIMEOUT-BIGGER)
 Skipped (broken):   timer.impure.lisp / (TIMER PARALLEL-UNSCHEDULE)
 (100 tests skipped for this combination of platform and features)

sbcl 1.2.8 (tested on 10.5.8 and 10.6 PPC):

:info:test Finished running tests.
:info:test Status:
:info:test  Expected failure:   compiler.pure.lisp / COPY-MORE-ARG
:info:test  Expected failure:   float.pure.lisp / (SCALE-FLOAT-OVERFLOW BUG-372)
:info:test  Expected failure:   float.pure.lisp / (ADDITION-OVERFLOW BUG-372)
:info:test  Expected failure:   float.pure.lisp / (ADDITION-OVERFLOW BUG-372 TAKE-2)
:info:test  Failure:            compiler.impure.lisp / REGRESSION-1.0.29.54
:info:test  Skipped (broken):   debug.impure.lisp / (TRACE ENCAPSULATE NIL)
:info:test  Skipped (broken):   debug.impure.lisp / (TRACE-RECURSIVE ENCAPSULATE NIL)
:info:test  Failure:            float.impure.lisp / (RANGE-REDUCTION PRECISE-PI)
:info:test  Expected failure:   packages.impure.lisp / USE-PACKAGE-CONFLICT-SET
:info:test  Expected failure:   packages.impure.lisp / IMPORT-SINGLE-CONFLICT
:info:test  Skipped (broken):   timer.impure.lisp / (TIMER PARALLEL-UNSCHEDULE)
:info:test  (59 tests skipped for this combination of platform and features)
Last edited 2 years ago by barracuda156 (previous) (diff)

comment:2 Changed 2 years ago by barracuda156

comment:3 Changed 2 years ago by barracuda156

Some test failures with 1.2.8 are not PPC-specific: https://sourceforge.net/p/sbcl/mailman/message/21453445/

comment:4 Changed 2 years ago by easye

@barracuda156 Thanks for the hard work here. Of course I wish I had access to a PPC system to help, but perhaps I can coordinate more fully with the SBCL crew on IRC <irc://libera.chat/#sbcl> or the SBCL bug tracker <https://launchpad.net/sbcl> if you need something? Feel free to contact me "out of band".

comment:5 in reply to:  4 ; Changed 2 years ago by barracuda156

Replying to easye:

@barracuda156 Thanks for the hard work here. Of course I wish I had access to a PPC system to help, but perhaps I can coordinate more fully with the SBCL crew on IRC <irc://libera.chat/#sbcl> or the SBCL bug tracker <https://launchpad.net/sbcl> if you need something? Feel free to contact me "out of band".

Thank you for replying! There are two immediate problems I face, and any help will be greatly appreciated here:

  1. There is a section in src/runtime/ppc-assem.S which has never been fixed for Darwin ABI:
    	/* Call out to obtain our TLS block. */
    	load(reg_NL0,CSYMBOL(specials))
    	/* This won't work on darwin: wrong fixup style.  And is it
    	 * supposed to be lis/ori or lis/addi?  Or does it differ
    	 * between darwin and everything else again? */
    	lis reg_CFUNC,CSYMBOL(pthread_getspecific)@h
    	ori reg_CFUNC,reg_CFUNC,CSYMBOL(pthread_getspecific)@l
    	mtctr reg_CFUNC
    	bctrl
    	mr reg_THREAD, reg_NL0
    

Those suffices @ are invalid, of course, and the code fails. However it is required in order to build with threads enabled. I tried patching it to:

+#ifdef LISP_FEATURE_DARWIN
+	lis reg_CFUNC,hi16(CSYMBOL(pthread_getspecific))
+	ori reg_CFUNC,reg_CFUNC,lo16(CSYMBOL(pthread_getspecific))
+#else
 	lis reg_CFUNC,CSYMBOL(pthread_getspecific)@h
 	ori reg_CFUNC,reg_CFUNC,CSYMBOL(pthread_getspecific)@l
+#endif

This fails however:

ld: absolute address to symbol _pthread_getspecific in a different linkage unit not supported in _call_into_lisp from ppc-assem.o
collect2: ld returned 1 exit status
make: *** [sbcl] Error 1

This is why I had to build without threads (well, I don't promise threads will work if this is fixed, but at least this must be fixed in some way in order to proceed). It has been broken forever: from @1.0.47 up to @2.2.2 this chunk of code remains unchanged, and in @2.2.3 upstream, sadly, just threw away Darwin-specific parts. (So I think it has never been built for PPC at all.)

  1. The issue in the ticket above:
    fatal error encountered in SBCL pid 16153:
    dynamic space too small for core: 31044KiB required, 0KiB available.
    

Since it is not pointing to a specific error in the code, I have no hint how to try fixing it.

comment:6 Changed 2 years ago by easye

Alright. AFK at the moment (and broadly "working" in CEST as a time zone, so will see what info I can dig up in the next 12 hours.

comment:7 in reply to:  6 ; Changed 2 years ago by barracuda156

Replying to easye:

Alright. AFK at the moment (and broadly "working" in CEST as a time zone, so will see what info I can dig up in the next 12 hours.

Great! Thank you very much!

comment:8 in reply to:  7 Changed 2 years ago by easye

Replying to barracuda156: Unfortunately no progress to report. Getting in touch with SBCL maintainers may take some time.

More when I know…

comment:9 Changed 2 years ago by easye

Support for Darwin/PPC was removed with sbcl-2.2.3 <http://sbcl.org/news.html>.

Gonna be kinda tricky to do this for a single Portfile, so I wonder if anyone can chime in on what should be done: a "new" port with the architecture in the name ('lang/sbcl-ppc')?

comment:10 in reply to:  9 ; Changed 2 years ago by easye

Replying to easye:

Support for Darwin/PPC was removed with sbcl-2.2.3 <http://sbcl.org/news.html>.

A statement from the SBCL maintainer via IRC:

<Krystof> easye: I think it's worth saying that if there are users willing to                                      
          step up and maintain our ppc/darwin support, we'd reinstate it on                                        
          that basis                                                    [13:20]                                    
<Krystof> the problem we were having is: no hardware, no access to hardware,                                       
          no demand from users, no ability to check whether changes for other                                      
          platforms cause breakage                                      [13:21]     

comment:11 in reply to:  9 Changed 2 years ago by barracuda156

Replying to easye:

Support for Darwin/PPC was removed with sbcl-2.2.3 <http://sbcl.org/news.html>.

Gonna be kinda tricky to do this for a single Portfile, so I wonder if anyone can chime in on what should be done: a "new" port with the architecture in the name ('lang/sbcl-ppc')?

What I had already done is sbcl-ppc-bootstrap port that uses 1.0.47 (the last available binary) to build 1.2.8 (maximum it can build, same for Intel), and then I used 1.2.8 to build 1.5.9. Versions 2.x.x do not build yet, however.

Yes, I am aware that upstream removed PPC code in 2.2.3, that’s why I refer to 2.2.2 in the ticket. However it seems not too hard to revert the removal.

comment:12 in reply to:  10 ; Changed 2 years ago by barracuda156

Replying to easye:

Replying to easye:

Support for Darwin/PPC was removed with sbcl-2.2.3 <http://sbcl.org/news.html>.

A statement from the SBCL maintainer via IRC:

<Krystof> easye: I think it's worth saying that if there are users willing to                                      
          step up and maintain our ppc/darwin support, we'd reinstate it on                                        
          that basis                                                    [13:20]                                    
<Krystof> the problem we were having is: no hardware, no access to hardware,                                       
          no demand from users, no ability to check whether changes for other                                      
          platforms cause breakage                                      [13:21]     

If the issue is purely technical, then it is not too hard to build PPC code on a modern Intel Mac. Set up 10.6.x in VM, make sure to install Rosetta, build Macports for PPC natively, run PPC binaries. I have such set up on my MacMini at home with Catalina.

But of course, the problem may rather be economical: upstream has limited time and may prefer use it for smth else. This is understandable, so my questions here do not imply I expect others to fix the thing and keep maintaining. It just might happen that for someone from developers errors I reported are known and trivial, while for me it may take days or weeks.

My general understanding (which can be wrong) is that compilers, if properly designed, are cross-platform, and we don’t need to change PPC assembler, it just has to be fixed once. If gcc11 builds, sbcl should ))

  1. S. I don’t want to create a burden for anyone, and lack of hardware or spare time is perfectly understandable. If someone comes up with a useful suggestion, great, otherwise I will try to fix it myself and update on success or failure.

I will look into assembler error, it’s two lines of code after all, should be fixable.

comment:13 in reply to:  12 ; Changed 2 years ago by easye

Replying to barracuda156:

Support for Darwin/PPC was removed with sbcl-2.2.3 <http://sbcl.org/news.html>.

A statement from the SBCL maintainer via IRC:

<Krystof> easye: I think it's worth saying that if there are users willing to                                      
          step up and maintain our ppc/darwin support, we'd reinstate it on                                        
          that basis                                                    [13:20]                                    
<Krystof> the problem we were having is: no hardware, no access to hardware,                                       
          no demand from users, no ability to check whether changes for other                                      
          platforms cause breakage                                      [13:21]     

If the issue is purely technical, then it is not too hard to build PPC code on a modern Intel Mac.

[…]

I might be leery of not understanding how Rosetta interacts with my debugging. But maybe I should give this a whirl on the 2013 iMac I have running Catalina.

But of course, the problem may rather be economical: upstream has limited time

[…] SBCL development doesn't have tons of resources. Krystof seems to be implying that they don't really have a demand from users.

Once you get something running in MacPorts we can perhaps assess the effort required to merge the patches upstream. Since they don't seem to have test coverage under ppc/darwin, figuring out how to give them a CI instance they can run to see when they break ppc/darwin would probably win over bonus points.

comment:14 in reply to:  13 Changed 2 years ago by barracuda156

Replying to easye:

I might be leery of not understanding how Rosetta interacts with my debugging. But maybe I should give this a whirl on the 2013 iMac I have running Catalina.

Please do not try it now, it won't work for sbcl-ppc, at least right-away. The problem is that we are forced to start with pre-built binary, and it fails, confusing the arch with x86_64. I have the same problem with other ports that rely on pre-built boot binary: my ghc-ppc-bootstrap works on 10.5.8 and 10.6 PPC, but fails on Rosetta, and the recent openjdk7 attempt also fails.

I tried now in order to let you know if it works. I get these funny errors:

CORRUPTION WARNING in SBCL pid 40193:
Memory fault at ebebebeb (pc=0x0, sp=0x0)
The integrity of this image is possibly compromised.

I tried to trick make-config.sh, forcing ppc, but it did not help.

So yeah, while 90% or more of ports build for PPC on Rosetta, few fail, and this is such a case.

SBCL development doesn't have tons of resources. Krystof seems to be implying that they don't really have a demand from users.

Well, Mac community have to blame themselves, honestly speaking, since they generally keep away from developers, and then developers get impression that no one uses PPC Macs for years. At the same time even more obscure archs like MIPS and SPARC remain supported. Like, how many users of SGI are there? (I wish I had Tezro, but it's just crazy expensive.)

Once you get something running in MacPorts we can perhaps assess the effort required to merge the patches upstream. Since they don't seem to have test coverage under ppc/darwin, figuring out how to give them a CI instance they can run to see when they break ppc/darwin would probably win over bonus points.

In principle, I can arrange remote access to my G5 Quad, if someone would really want to put some effort into this, but as I said, my hopes are very modest.

Changed 2 years ago by barracuda156

Attachment: sbcl-ppc-bootstrap.zip added

This should build 1.2.8 on Leopard or Snow Leopard PPC (Tiger and Rosetta fail). WIP version: I did a quick cleanup now, hopefully didn't delete anything necessary.

Changed 2 years ago by barracuda156

Attachment: sbcl-ppc.zip added

Then this should build sbcl 1.5.9, using sbcl-ppc-bootstrap (tested on 10.6 PPC). Variants won't build. WIP, no clean-up

comment:15 Changed 2 years ago by tomio-arisaka (Tomio Arisaka)

Thanks for your great efforts!

I'm interested in SBCL. So I tried to install SBCL on PPC Tiger. I modified the SBCL portfile based on the old one which is got from GitHub.

Then I was able to install SBCL-2.0.9. But I cannot install the later versions than 2.0.9.

("a_sbcl" variant means that the active SBCL is used to compile this version)

$ port installed sbcl
The following ports are currently installed:
  sbcl @1.1.6_1
  sbcl @1.2.11_0+a_sbcl
  sbcl @1.4.9_0+a_sbcl
  sbcl @1.5.9_0+a_sbcl
  sbcl @2.0.9_0+a_sbcl (active)
$ 
$ file `which sbcl`
/opt/local/bin/sbcl: Mach-O executable ppc
$ 
$ cat << EOF | sbcl --noinform --no-sysinit --no-userinit
> (machine-type)
> (machine-version)
> (software-type)
> (software-version)
> (lisp-implementation-type)
> (lisp-implementation-version)
> *features*
> *read-default-float-format*
> (+ 1 2 3 4 5 6 7 8 9 10)
> (expt 2.0 10)
> EOF
* "PowerPC"
* "PowerBook3,5"
* "Darwin"
* "8.11.0"
* "SBCL"
* "2.0.9"
* (:PPC :GENCGC :ANSI-CL :BIG-ENDIAN :BSD :COMMON-LISP :DARWIN
 :IEEE-FLOATING-POINT :MACH-O :PACKAGE-LOCAL-NICKNAMES :SB-LDB
 :SB-PACKAGE-LOCKS :SB-UNICODE :SBCL :UNIX)
* SINGLE-FLOAT
* 55
* 1024.0
* $ 

comment:16 in reply to:  15 ; Changed 2 years ago by barracuda156

Replying to tomio-arisaka:

Thanks for your great efforts!

I'm interested in SBCL. So I tried to install SBCL on PPC Tiger. I modified the SBCL portfile based on the old one which is got from GitHub.

Then I was able to install SBCL-2.0.9. But I cannot install the later versions than 2.0.9.

Awesome!

Could you describe the process step-wise? For me 1.5.9 failed on Tiger (on Leopard and SL PPC it builds fine).

Did you make any custom patches for these?

  1. S. I did not yet try building 2.0.9. 2.0.11 failed to build. I will try now with 2.0.9.
Last edited 2 years ago by barracuda156 (previous) (diff)

comment:17 in reply to:  15 Changed 2 years ago by barracuda156

Replying to tomio-arisaka:

Maybe you can suggest a better procedure than I have used in my portfiles above. Ideally we would want to minimize steps needed to get to the latest (or the latest feasible for PPC) version of sbcl. (In any case we will likely need a new port to bootstrap some working version of sbcl – what I have as sbcl-ppc-bootstrap or alike.)

comment:18 Changed 2 years ago by barracuda156

I confirm that sbcl 2.0.9 builds. In fact I built it with 1.2.8, which means no in-between steps: sbcl-ppc-bootstrap (1.2.8) → sbcl (2.0.9).

36-111% port -v installed | grep sbcl
  sbcl @1.5.9_0 requested_variants='' platform='darwin 10' archs='ppc' date='2022-05-16T17:16:23+0800'
  sbcl @2.0.9_0 (active) requested_variants='' platform='darwin 10' archs='ppc' date='2022-05-20T05:22:37+0800'
  sbcl-ppc @1.5.9_0 (active) requested_variants='' platform='darwin 10' archs='ppc' date='2022-05-16T17:56:36+0800'
  sbcl-ppc-bootstrap @1.2.8_0 (active) requested_variants='' platform='darwin 10' archs='ppc' date='2022-05-16T11:18:46+0800'

Changed 2 years ago by tomio-arisaka (Tomio Arisaka)

old SBCL portfiles for PPC Tiger

comment:19 in reply to:  16 ; Changed 2 years ago by tomio-arisaka (Tomio Arisaka)

Replying to barracuda156:

Replying to tomio-arisaka:

Thanks for your great efforts!

I'm interested in SBCL. So I tried to install SBCL on PPC Tiger. I modified the SBCL portfile based on the old one which is got from GitHub.

Then I was able to install SBCL-2.0.9. But I cannot install the later versions than 2.0.9.

Awesome!

Could you describe the process step-wise? For me 1.5.9 failed on Tiger (on Leopard and SL PPC it builds fine).

Did you make any custom patches for these?

  1. S. I did not yet try building 2.0.9. 2.0.11 failed to build. I will try now with 2.0.9.

"MacPorts-SBCL-PPC-Tiger.tar.bz2" file includes the old SBCL portfiles modified by me. I think they work, but they are not good scripts:)

The sequence of installing SBCL-2.0.9 is as follows:

$ port info sbcl
sbcl @1.1.6_1 (lang)
Variants:             fancy, html, pdf, threads
...
...

$ sudo port install sbcl

$ port installed
The following ports are currently installed:
  apple-gcc42 @5666.3_16+bootstrap (active)
  gcc_select @0.1_9 (active)
  sbcl @1.1.6_1 (active)

$ sudo port install apple-gcc42

$ port installed 
The following ports are currently installed:
  apple-gcc42 @5666.3_16+bootstrap
  apple-gcc42 @5666.3_16 (active)
  cctools @949.0.1_2 (active)
  gcc_select @0.1_9 (active)
  gettext @0.21_0 (active)
  gettext-runtime @0.21_0 (active)
  gettext-tools-libs @0.21_0 (active)
  gperf @3.1_0 (active)
  ld64 @3_4+ld64_97 (active)
  ld64-97 @97.17_9 (active)
  libiconv @1.16_1 (active)
  libmacho-headers @949.0.1_0 (active)
  libtextstyle @0.21_0 (active)
  libunwind-headers @5.0.1_0 (active)
  ncurses @6.3_0 (active)
  sbcl @1.1.6_1 (active)
  xz @5.2.5_1 (active)

$ port info sbcl
sbcl @1.2.11 (lang)
Variants:             a_sbcl, [+]fancy, html, pdf, threads
...
...

$ sudo port install sbcl +a_sbcl -fancy

$ port installed sbcl
The following ports are currently installed:
  sbcl @1.1.6_1
  sbcl @1.2.11_0+a_sbcl (active)

$ port info sbcl
sbcl @1.4.9 (lang)
Variants:             a_sbcl, [+]fancy, html, pdf, threads
...
...

$ sudo port install sbcl -fancy +a_sbcl 

$ port installed sbcl
The following ports are currently installed:
  sbcl @1.1.6_1
  sbcl @1.2.11_0+a_sbcl
  sbcl @1.4.9_0+a_sbcl (active)

$ port info sbcl 
sbcl @1.5.9 (lang)
Variants:             a_sbcl, [+]fancy, html, pdf, threads
...
...

$ sudo port install sbcl -fancy +a_sbcl

$ port installed sbcl
The following ports are currently installed:
  sbcl @1.1.6_1
  sbcl @1.2.11_0+a_sbcl
  sbcl @1.4.9_0+a_sbcl
  sbcl @1.5.9_0+a_sbcl (active)

$ port info sbcl
sbcl @2.0.9 (lang)
Variants:             a_sbcl, [+]fancy, html, pdf, threads
...
...

$ sudo port install sbcl -fancy +a_sbcl

$ port installed sbcl
The following ports are currently installed:
  sbcl @1.1.6_1
  sbcl @1.2.11_0+a_sbcl
  sbcl @1.4.9_0+a_sbcl
  sbcl @1.5.9_0+a_sbcl
  sbcl @2.0.9_0+a_sbcl (active)

comment:20 in reply to:  19 ; Changed 2 years ago by barracuda156

Replying to tomio-arisaka:

Thank you very much! I will look through these.

Do I get it right that I have built without threads and fancy variants? (For me these fail, and at least one reason I point above – a chunk of code invalid for Darwin ABI.)

comment:21 in reply to:  5 ; Changed 2 years ago by barracuda156

Replying to barracuda156:

Replying to easye:

  1. There is a section in src/runtime/ppc-assem.S which has never been fixed for Darwin ABI:
    	/* Call out to obtain our TLS block. */
    	load(reg_NL0,CSYMBOL(specials))
    	/* This won't work on darwin: wrong fixup style.  And is it
    	 * supposed to be lis/ori or lis/addi?  Or does it differ
    	 * between darwin and everything else again? */
    	lis reg_CFUNC,CSYMBOL(pthread_getspecific)@h
    	ori reg_CFUNC,reg_CFUNC,CSYMBOL(pthread_getspecific)@l
    	mtctr reg_CFUNC
    	bctrl
    	mr reg_THREAD, reg_NL0
    

There is some info on pthread_getspecific here: https://lifecs.likai.org/2010/05/mac-os-x-thread-local-storage.html

comment:22 in reply to:  21 Changed 2 years ago by tomio-arisaka (Tomio Arisaka)

Replying to barracuda156:

There is some info on pthread_getspecific here: https://lifecs.likai.org/2010/05/mac-os-x-thread-local-storage.html

On Tiger, gcc4 included in Xcode-2.5 cannot compile 'tls.c'. But gcc7 can compile 'tls.c' without any errors:

$ cat ./tls.c 
static int __thread x;
int main() { return 0; }
$ 
$ gcc-mp-7 --version
gcc-mp-7 (MacPorts gcc7 7.5.0_3) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ 
$ gcc-mp-7 ./tls.c 
$ 
$ otool -L ./a.out 
./a.out:
        /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
        /opt/local/lib/libgcc/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.1.12)
$ 

comment:23 in reply to:  20 ; Changed 2 years ago by tomio-arisaka (Tomio Arisaka)

Replying to barracuda156:

Replying to tomio-arisaka:

Thank you very much! I will look through these.

Do I get it right that I have built without threads and fancy variants? (For me these fail, and at least one reason I point above – a chunk of code invalid for Darwin ABI.)

The implementation of SBCL's threads has not been applied to PPC-Darwin. So I gave up using SBCL's threads on PPC-Darwin.

But I'm glad that SBCL-2.0.9 can compile Maxima on PPC-Tiger.

By the way, I'm trying to use another Lisp which has the functions of threads. (e.g. ECL-21.2.1 and CCL-1.2/MCL-6.0)

comment:24 in reply to:  6 Changed 2 years ago by barracuda156

Replying to easye:

I will have to take a break from this (and everything else) until the end of the month, as I will be away from PPC hardware. (Just letting you know that I did not give up.)

comment:25 in reply to:  9 Changed 2 years ago by barracuda156

Replying to easye:

Support for Darwin/PPC was removed with sbcl-2.2.3 <http://sbcl.org/news.html>.

Gonna be kinda tricky to do this for a single Portfile, so I wonder if anyone can chime in on what should be done: a "new" port with the architecture in the name ('lang/sbcl-ppc')?

We got two alternative pathways now, though both lead to 2.0.9 maximum, at the moment. Which, do you think, is more Macports-compatible?

And if you were able to get any hints from the upstream in the meanwhile, please update us. I can bring back ppc support into the latest sbcl, but we need to fix 2.2.2 first.

comment:26 in reply to:  23 Changed 2 years ago by barracuda156

Replying to tomio-arisaka:

The implementation of SBCL's threads has not been applied to PPC-Darwin. So I gave up using SBCL's threads on PPC-Darwin.

Thank you for clarifying this!

But I'm glad that SBCL-2.0.9 can compile Maxima on PPC-Tiger.

Good to know that. Hopefully, we at least can bring 2.0.9 for PPC into Macports soon.

By the way, I'm trying to use another Lisp which has the functions of threads. (e.g. ECL-21.2.1 and CCL-1.2/MCL-6.0)

I got clisp built on 10.6 PPC but did not try using it yet.

comment:27 in reply to:  10 Changed 2 years ago by barracuda156

Replying to easye:

Replying to easye:

Support for Darwin/PPC was removed with sbcl-2.2.3 <http://sbcl.org/news.html>.

A statement from the SBCL maintainer via IRC:

<Krystof> easye: I think it's worth saying that if there are users willing to                                      
          step up and maintain our ppc/darwin support, we'd reinstate it on                                        
          that basis                                                    [13:20]                                    
<Krystof> the problem we were having is: no hardware, no access to hardware,                                       
          no demand from users, no ability to check whether changes for other                                      
          platforms cause breakage                                      [13:21]     

Resurrecting the thread, where do we stand at the moment? I can restore PPC into the current code, for the most part, however there are two problems: a) threads supports apparently was always broken and b) versions of sbcl past 2.0.9 fail to build. Some advice on the errors I faced (described above) would be very much helpful, since otherwise it is not clear what to try fixing :) It’s understandable that the upstream cannot test PPC builds, but if it is possible to consult with someone, that gonna be great. For example, what has changed in 2.0.10 substantially enough as to break PPC build?

comment:28 Changed 2 years ago by kakuhen

Cc: kakuhen added

comment:29 Changed 2 years ago by kakuhen

Although performed outside of a MacPorts build environment, I was able to successfully compile SBCL 2.2.2 using SBCL 1.0.47 on Mac OS X 10.5.8. I will attach an archive to this ticket. Attached to this archive is the full compilation together with the test suite and "port installed" output.

I do not have the time right now to attempt patching lang/sbcl/Portfile, but this demonstrates a proof of concept.

Changed 2 years ago by kakuhen

Attachment: SBCL LOG.tar.gz added

Compile logs of SBCL 2.2.2 on PowerPC Leopard, with TEST results and "port installed" output.

comment:30 in reply to:  29 Changed 2 years ago by barracuda156

Replying to kakuhen:

Although performed outside of a MacPorts build environment, I was able to successfully compile SBCL 2.2.2 using SBCL 1.0.47 on Mac OS X 10.5.8. I will attach an archive to this ticket. Attached to this archive is the full compilation together with the test suite and "port installed" output.

I do not have the time right now to attempt patching lang/sbcl/Portfile, but this demonstrates a proof of concept.

Thank you very much! I will look into logs and try to figure out how we can patch the Portfile. If that works, then we can restore PPC support into 2.2.6, perhaps.

comment:31 Changed 2 years ago by acjones8 (Alex Jones)

Cc: acjones8 added

comment:32 Changed 2 years ago by amock (Alan Mock)

Cc: amock added

comment:33 Changed 22 months ago by barracuda156

I have built sbcl 2.3.0 up to this point, and there it freezes:

; SB-Loader: (166+3670) methods/other
SB-XC:*FEATURES* =
(:PPC :GENCGC :ALIEN-CALLBACKS :ANSI-CL :ANSI-COMPLIANT-LOAD-TRUENAME
 :BIG-ENDIAN :BSD :COMMON-LISP :COMPARE-AND-SWAP-VOPS :DARWIN
 :IEEE-FLOATING-POINT :MACH-O :OS-PROVIDES-BLKSIZE-T :OS-PROVIDES-DLADDR
 :OS-PROVIDES-DLOPEN :OS-PROVIDES-SUSECONDS-T :PACKAGE-LOCAL-NICKNAMES :SB-DOC
 :SB-EVAL :SB-LDB :SB-PACKAGE-LOCKS :SB-SOURCE-LOCATIONS :SB-UNICODE :SBCL
 :UNIX)
[building initial core file in "output/cold-sbcl.core": 
writing 4096 bytes [1 page] from #<SB-FASL::GSPACE @#x4100000 :STATIC>
writing 28422144 bytes [6939 pages] from #<SB-FASL::GSPACE @#x10000000 :DYNAMIC>
writing 0 bytes [0 pages] from #<SB-FASL::GSPACE @#x4000000 :READ-ONLY>
movable dynamic space: 534 + 3383 + 3022 cons/code/mixed pages
/INITIAL-FUN=#X119FC1B5
done]
//testing for consistency of first and second GENESIS passes
//header files match between first and second GENESIS -- good

real	9m16.123s
user	7m7.247s
sys	1m22.682s
//entering make-target-2.sh
//doing warm init - compilation phase
This is SBCL 2.3.0, 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    534      0   3383      0   3022      0      0      0    0.5    28271184     2000000    3383   0  0.0000
Tot      0      0      0      0      0    534      0   3383      0   3022      0      0      0    0.5    28271184 [5.3% of 536870912 max]

Why could that be?

Last edited 22 months ago by barracuda156 (previous) (diff)

comment:34 Changed 22 months ago by barracuda156

Above was with 1.5.9; I tried now to build with ancient 1.0.47, and it fails with a variation of a known error:

; file: /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_sbcl/sbcl/work/sbcl-2.3.0/src/compiler/generic/genesis.lisp
; in: DEFUN (SETF BVREF-WORD)
;     (SETF (SB-FASL::ACCESS SB-FASL::BYTES SB-INT:INDEX T) SB-FASL::NEW-VAL)
; 
; caught ERROR:
;   during macroexpansion of (SETF # NEW-VAL). Use *BREAK-ON-SIGNALS* to intercept:
;   
;    The assertion (AND SB-COLD::RESULT (NOT (CDR SB-COLD::RESULT))) failed.

;     (DEFUN (SETF SB-FASL::BVREF-WORD)
;            (SB-FASL::NEW-VAL SB-FASL::BYTES SB-INT:INDEX)
;       (DECLARE (TYPE SB-XC:FIXNUM SB-INT:INDEX))
;       (SB-INT:AVER (NOT (LOGTEST SB-INT:INDEX (ASH SB-VM:LOWTAG-MASK -1))))
;       (SETF (SB-FASL::ACCESS SB-FASL::BYTES SB-INT:INDEX T) SB-FASL::NEW-VAL))
; --> PROGN EVAL-WHEN 
; ==>
;   (HOST-SB-IMPL::%DEFUN '(SETF SB-FASL::BVREF-WORD)
;                         (HOST-SB-INT:NAMED-LAMBDA (SETF SB-FASL::BVREF-WORD)
;                             (SB-FASL::NEW-VAL SB-FASL::BYTES SB-INT:INDEX)
;                           (DECLARE (TYPE SB-XC:FIXNUM SB-INT:INDEX))
;                           (BLOCK SB-FASL::BVREF-WORD
;                             (SB-INT:AVER (NOT #))
;                             (SETF # SB-FASL::NEW-VAL)))
;                         NIL 'NIL (HOST-SB-C:SOURCE-LOCATION))
; 
; caught STYLE-WARNING:
;   The variable NEW-VAL is defined but never used.
; 
; caught STYLE-WARNING:
;   The variable BYTES is defined but never used.

; in: DEFUN BVREF-WORD
;     (SB-FASL::ACCESS SB-FASL::BYTES SB-INT:INDEX T)
; 
; caught ERROR:
;   during macroexpansion of (ACCESS BYTES INDEX ...). Use *BREAK-ON-SIGNALS* to
;   intercept:
;   
;    The assertion (AND SB-COLD::RESULT (NOT (CDR SB-COLD::RESULT))) failed.

;     (DEFUN SB-FASL::BVREF-WORD (SB-FASL::BYTES SB-INT:INDEX)
;       (DECLARE (TYPE SB-XC:FIXNUM SB-INT:INDEX))
;       (SB-INT:AVER (NOT (LOGTEST SB-INT:INDEX (ASH SB-VM:LOWTAG-MASK -1))))
;       (SB-FASL::ACCESS SB-FASL::BYTES SB-INT:INDEX T))
; --> PROGN EVAL-WHEN 
; ==>
;   (HOST-SB-IMPL::%DEFUN 'SB-FASL::BVREF-WORD
;                         (HOST-SB-INT:NAMED-LAMBDA SB-FASL::BVREF-WORD
;                             (SB-FASL::BYTES SB-INT:INDEX)
;                           (DECLARE (TYPE SB-XC:FIXNUM SB-INT:INDEX))
;                           (BLOCK SB-FASL::BVREF-WORD
;                             (SB-INT:AVER (NOT #))
;                             (SB-FASL::ACCESS SB-FASL::BYTES SB-INT:INDEX T)))
;                         NIL 'NIL (HOST-SB-C:SOURCE-LOCATION))
; 
; caught STYLE-WARNING:
;   The variable BYTES is defined but never used.

; /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_sbcl/sbcl/work/sbcl-2.3.0/obj/from-host/src/compiler/generic/genesis.fasl-tmp written
; compilation finished in 0:00:11.403

debugger invoked on a SIMPLE-ERROR:
  FAILURE-P was set when creating "obj/from-host/src/compiler/generic/genesis.fasl".

Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [RECOMPILE  ] Recompile file "src/compiler/generic/genesis.lisp"
  1: [CONTINUE   ] Continue, using possibly bogus file "obj/from-host/src/compiler/generic/genesis.fasl"
  2:               Recompile
  3: [ABORT-BUILD] Abort building SBCL.
  4: [ABORT      ] Exit debugger, returning to top level.

(COMPILE-STEM "src/compiler/generic/genesis" NIL :HOST-COMPILE)
0] 1
Command failed: SBCL_MACOSX_VERSION_MIN=10.6 CC=/opt/local/bin/gcc-mp-12 CXX=/opt/local/bin/g++-mp-12 CPP=/opt/local/bin/cpp-mp-12 sh ./make.sh  --prefix=/opt/local --xc-host="/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_sbcl/sbcl/work/sbcl-1.0.47-powerpc-darwin/src/runtime/sbcl --core /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_sbcl/sbcl/work/sbcl-1.0.47-powerpc-darwin/output/sbcl.core --sysinit /dev/null --userinit /dev/null" 
Exit code: 128
Error: Failed to build sbcl: command execution failed
Error: See /opt/local/var/macports/logs/_opt_PPCSnowLeopardPorts_lang_sbcl/sbcl/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there
is a bug.

comment:35 Changed 21 months ago by kencu (Ken)

Keywords: powerpc added
Summary: sbcl: fatal error encountered in SBCL pid 16153: dynamic space too small for coresbcl fails to build on PPC: fatal error encountered in SBCL pid 16153: dynamic space too small for core

comment:36 in reply to:  33 Changed 18 months ago by barracuda156

Replying to barracuda156:

I have built sbcl 2.3.0 up to this point, and there it freezes:

; SB-Loader: (166+3670) methods/other
SB-XC:*FEATURES* =
(:PPC :GENCGC :ALIEN-CALLBACKS :ANSI-CL :ANSI-COMPLIANT-LOAD-TRUENAME
 :BIG-ENDIAN :BSD :COMMON-LISP :COMPARE-AND-SWAP-VOPS :DARWIN
 :IEEE-FLOATING-POINT :MACH-O :OS-PROVIDES-BLKSIZE-T :OS-PROVIDES-DLADDR
 :OS-PROVIDES-DLOPEN :OS-PROVIDES-SUSECONDS-T :PACKAGE-LOCAL-NICKNAMES :SB-DOC
 :SB-EVAL :SB-LDB :SB-PACKAGE-LOCKS :SB-SOURCE-LOCATIONS :SB-UNICODE :SBCL
 :UNIX)
[building initial core file in "output/cold-sbcl.core": 
writing 4096 bytes [1 page] from #<SB-FASL::GSPACE @#x4100000 :STATIC>
writing 28422144 bytes [6939 pages] from #<SB-FASL::GSPACE @#x10000000 :DYNAMIC>
writing 0 bytes [0 pages] from #<SB-FASL::GSPACE @#x4000000 :READ-ONLY>
movable dynamic space: 534 + 3383 + 3022 cons/code/mixed pages
/INITIAL-FUN=#X119FC1B5
done]
//testing for consistency of first and second GENESIS passes
//header files match between first and second GENESIS -- good

real	9m16.123s
user	7m7.247s
sys	1m22.682s
//entering make-target-2.sh
//doing warm init - compilation phase
This is SBCL 2.3.0, 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    534      0   3383      0   3022      0      0      0    0.5    28271184     2000000    3383   0  0.0000
Tot      0      0      0      0      0    534      0   3383      0   3022      0      0      0    0.5    28271184 [5.3% of 536870912 max]

Why could that be?

36-55% sudo gdb-apple attach 82530
Password:
GNU gdb 6.3.50.20050815-cvs (Wed Apr 13 04:55:50 UTC 2022)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=powerpc-apple-darwin10.0.0d2 --target="...File 'attach' does not exist or is not a regular file.

/Users/svacchanda/82530: No such file or directory
Attaching to process 82530.
Reading symbols for shared libraries . done
Reading symbols for shared libraries ... done
0xbffff410 in ?? ()
(gdb) next
Cannot find bounds of current function
(gdb) where
#0  0xbffff410 in ?? ()
#1  0x0002cc78 in _call_into_c () at ppc-assem.S:531
#2  0x000012e4 in ?? ()
#3  0x8fe3342c in __dyld__ZN4dyld8gLogAPIsE ()
#4  0x8fe0c558 in __dyld_dlsym ()
#5  0x0001a484 in create_main_lisp_thread (function=1110249391) at thread.c:375
#6  0x0001708c in initialize_lisp (argc=<value temporarily unavailable, due to optimizations>, argv=0xc24bc195, envp=<value temporarily unavailable, due to optimizations>) at runtime.c:813
#7  0x00034f7c in main (argc=<value temporarily unavailable, due to optimizations>, argv=<value temporarily unavailable, due to optimizations>, envp=<value temporarily unavailable, due to optimizations>) at main.c:6
(gdb) disassemble $pc-0x10 $pc+0x10
Dump of assembler code from 0xbffff400 to 0xbffff420:
0xbffff400:	.long 0x35dc4
0xbffff404:	.long 0x35dc0
0xbffff408:	stmw    r31,-2220(r31)
0xbffff40c:	lbzu    r31,14012(r3)
0xbffff410:	.long 0x11a54830
0xbffff414:	.long 0x35dc0
0xbffff418:	stmw    r31,-2220(r31)
0xbffff41c:	lbzu    r31,14012(r3)
End of assembler dump.
(gdb) info registers
r0             0x0	0
r1             0xbffff390	3221222288
r2             0x364fc	222460
r3             0x2	2
r4             0x11a54830	296044592
r5             0xd	13
r6             0x0	0
r7             0x4000030	67108912
r8             0x11a54830	296044592
r9             0x11a54830	296044592
r10            0x34	52
r11            0x0	0
r12            0xbffff410	3221222416
r13            0x330	816
r14            0x1200008	18874376
r15            0x1000108	16777480
r16            0x1000128	16777512
r17            0x1400000	20971520
r18            0x4100033	68157491
r19            0x10816007	276914183
r20            0x0	0
r21            0x34	52
r22            0x10000e8	16777448
r23            0x108161ff	276914687
r24            0x8	8
r25            0x11a5482f	296044591
r26            0x0	0
r27            0x34	52
r28            0xbffff3f0	3221222384
r29            0x11a5482f	296044591
r30            0x4100033	68157491
r31            0x10816330	276914992
pc             0xbffff410	3221222416
ps             0x100000000008d030	1152921504607424560
cr             0x24002200	603988480
lr             0x2cc78	183416
ctr            0xbffff410	3221222416
xer            0x0	0
mq             0x0	0
fpscr          0x82002000	2181046272
vscr           0x10000	65536
vrsave         0x0	0

comment:37 Changed 17 months ago by catap (Kirill A. Korinsky)

Resolution: fixed
Status: assignedclosed

In a3cf7fd3e526e62a9437521c1b34228447249293/macports-ports (master):

sbcl: update to 2.3.5; pin for old macOS; add myself as co-maintainer

I also fixed build on old macOS

Closes: #61717
Closes: #65188
Closes: #65484
Closes: #66002

Note: See TracTickets for help on using tickets.