11 ms·
MIT Scheme on Apple Silicon
- montmorency88 5y agoVery cool how much interest there is in mit-scheme and sicm. On the csail website I think the '.com' binary for scmutils only works with v10 and was released about a year ago. Does anyone know where there are instructions for finding/compiling a version that works with the latest version of mit scheme?
- thomasjudge 5y agoJust a UI comment, the white highlighting of white text on a black/grey background is pretty unreadable in my browser
- malf 5y agoJust turn off dark mode. So many sites have css that claims to support dark mode but doesn’t. The other direction seems less common.
- abstractbeliefs 5y agoWe should really expect better from someone who's about page says they are an interface designer, though.
- kennethfriedman 5y agoWe should expect better, and you deserve better! Luckily, the issue has been fixed :)
- deleted 5y ago[deleted]
- mark_l_watson 5y agoI got MIT Scheme running on my M1 MacBook Pro about 6 months ago when I bought the book "Software Design for Flexibility" and although I can't find my notes for that, I think I remember building from source natively, not via Rosetta - but I may remember incorrectly. I also remember it taking a while to get Gerbil Scheme running on M1.
- bigdict 5y agoHow did you like the book?
- mark_l_watson 5y agoI like it, but I have only worked about 1/3 of the way through it.
- bigdict 5y agoWhat would someone who has worked through SICP learn from it (based on the first third that you've read)?
- kkylin 5y agoI've also gotten through about the first 1/3. Based on this, and the table of contents, it goes into much more depth (both in terms of implementation and non-trivial illustrative examples) into a number of topics that are either only touched upon in SICP, or not discussed at all. These include combinators, generic functions, pattern matching, etc. There's a chapter on propagators, which didn't even exist when the last edition of SICP was written, though I think SICP does discuss related (but simpler) ideas on constraint propagation.
- bigdict 5y agoThank you.
- rcarmo 5y agoNice. FYI, I've been using Fennel on Monterey (via brew), and it's also great for that extra LISPy feeling.
- carreau 5y agoI find it a bit disingenuous to say that it runs on apple silicon if you need to modify source code. Also it's not because it compiles and starts that it's fully functional. The main MIT Scheme page say that it's not possible and need significant efforts, so I would be curious to get a description as to why one claim it's impossible while the other show that it compiles and starts. Are the original authors too much against M1/Apple and justify themselves ? Or does compiling on M1 sort-of works until you hit more complex features that will crash or misbehave ?
- smoldesu 5y agoIt's also a bit disingenuous to say it's "on Apple Silicon" when you're running it through a translation layer that won't exist in a few year's time. I'd wager the reason why the GNU folks say it doesn't run on ARM is because... it doesn't. Running it as an x86 program is mandatory, apparently.
- carreau 5y agoWell they do say that they need rosetta just to compile, that once compiled it "works", though I agree it's still too shallow of an article.
- deleted 5y ago[deleted]
- cyberge99 5y agoIs it not running on Apple Silicon?
- maratc 5y agoSo Java, Groovy, Scala, Kotlin and Clojure aren't running on x86, nor ARM, nor Apple Silicon?
- smoldesu 5y agoIn a lot of ways, yes. Their runtimes are so massive that saying they "run" on any of those architectures is a stretch of what is actually happening at a lower level.
- sritchie 5y agoI've been engaged in a 1.5 year long (so far) project to port the entirety of GJS's "scmutils" package over to Clojure, and the erratic behavior of MIT Scheme over Rosetta has been a pain I've consigned myself to for months. I keep an old machine handy when I need to test functions that can't work on the M1. I am SO HAPPY to see this work! Major timesaver for me and anyone looking to run the executable versions of Functional Differential Geometry[1] and Structure and Interpretation of Classical Mechanics[2] in the original language. [0] https://github.com/sicmutils/sicmutils https://github.com/sicmutils/sicmutils [1] https://github.com/sicmutils/fdg-book https://github.com/sicmutils/fdg-book [2] https://github.com/sicmutils/sicm-book https://github.com/sicmutils/sicm-book
- kjander79 5y agoI have to ask, how far along is this project? Is it good enough to run all of the examples in the books? I have run into the issue where the provided compiled version of scmutils from GJS' website doesn't run on recent versions of MIT Scheme (version 11 and up) and there's not much info on compiling it yourself.
- sritchie 5y agoIt is good enough! Almost all code forms from the book live in the tests (see the FDG directory[0], for example), and there are a few nice environments like Nextjournal[1] where everything from the books works in the browser. The Clojure port is quite fast, faster than the original for all benchmarks GJS has sent me, and more fleshed out. (That will change, as I've been pushing bugfixes and performance improvements back upstream as I go, as a meager gift to GJS for making this huge, amazing library in the first place.) I actually wrote to GJS this morning asking for instructions on how to compile the original "scmutils", since I have the same problem. He responded saying he'll get back to me this afternoon, so I'll post here once I have details. If you are still interested in getting the books going with MIT-Scheme, I put a decent amount of work into the exercises using the original codebase here[2], including a dockerized version of mit-scheme[3] and the scmutils package[4] that might be useful. - [0] https://github.com/sicmutils/sicmutils/tree/main/test/sicmutils/fdg https://github.com/sicmutils/sicmutils/tree/main/test/sicmut... - [1] https://nextjournal.com/try/samritchie/sicmutils/ https://nextjournal.com/try/samritchie/sicmutils/ - [2] https://github.com/sicmutils/sicm-exercises https://github.com/sicmutils/sicm-exercises - [3] https://hub.docker.com/r/sritchie/mit-scheme https://hub.docker.com/r/sritchie/mit-scheme - [4] https://hub.docker.com/r/sritchie/mechanics https://hub.docker.com/r/sritchie/mechanics
- jeroenhd 5y agoWhat's stopping people from just compiling Scheme for ARM? The website has a separate aarch64 download it seems, so why not patch that instead of relying on Rosetta2? The vfork/fork issue and the compiler upgrade issue don't seem to be too problematic to work around, so there must be some kind of ARM limitation that's preventing Scheme from working, but what?
- spijdar 5y agoMacOS on the M1 processor is the first to use, and require, the W^X bit in memory, meaning that pages of memory are either writable, or can be executed from, but not both. MIT Scheme's front page says this is fundamentally incompatible with their design, and therefore it won't build. When running in the emulator, this requirement would be relaxed for compatibility reasons. There is an escape hatch for writing JIT compilers (essentially what MIT Scheme is in this case), described here https://developer.apple.com/documentation/apple-silicon/porting-just-in-time-compilers-to-apple-silicon https://developer.apple.com/documentation/apple-silicon/port... although it's fairly cumbersome and would almost certainly require a lot of extra, MacOS specific code. I assume that's why no-one has bothered so far to port it.
- usmannk 5y agoWow really? A common intro to security exercise (think CTFs and university courses) is to write increasingly complicated C programs that leverage W&X. Classic buffer overflow into the stack kind of stuff. On M1 it’s now impossible to exploit even a self-compiled toy in this way?
- softwarebeware 5y agoJust fyi in dark mode on this site, the code snippets are almost unreadable
- kennethfriedman 5y agoThanks for the heads up. I blame our site's Chief CSS Officer (me). It has been fixed!
- nneonneo 5y agoBoth of the compilation errors identified in this article were just fixed in the master branch of MIT/GNU Scheme five hours ago: https://git.savannah.gnu.org/cgit/mit-scheme.git/commit/?id=350be6720bce76eec23b551c720adc3570c0a608 https://git.savannah.gnu.org/cgit/mit-scheme.git/commit/?id=..., https://git.savannah.gnu.org/cgit/mit-scheme.git/commit/?id=013fad016413e582d769e5d1b7e6bd15006554c4 https://git.savannah.gnu.org/cgit/mit-scheme.git/commit/?id=.... So, if you grab the current master branch, it should just build for x86 without any fixes needed.
- ofrzeta 5y agoOk, but how do you compile it? When you pull the repo you need to run autoconf to create the configure script but that tells me "This script needs an existing MIT/GNU Scheme installation to function".
- wyclif 5y agoI wish I had known this before I recently installed Racket because I'm currently reading SICP.
- jeffrallen 5y agoRule of thumb: don't take advice from people who can't explain why they suggest you comment code out.
- kennethfriedman 5y agoAs the OP here, I could not agree more.
- Koshkin 5y agoThat MIT Scheme includes an emacs clone that uses Scheme instead of elisp is a nice touch.
- School-Cotton 5y agoThere’s a fork of Emacs itself that can run scheme, by replacing the internal lisp engine with Guile (which can run both scheme and elisp). It doesn’t seem to have gotten a lot of love in the last few years, but did mostly work at one point.
- pupdroid 5y agoThe Racket fork of Chez Scheme runs natively on Apple ARM (AFAIK these changes have not yet been merged into the main branch of Chez Scheme) https://github.com/racket/ChezScheme/ https://github.com/racket/ChezScheme/