6 ms·
Static Executables with SBCL v2
- nathell 6y agoHaven't used SBCL in a while, so just to confirm: is this a better alternative to SB-EXT:SAVE-LISP-AND-DIE?
- fisxoj 6y agoWithout looking at the details, this work probably still uses something like that, under the hood. In mainline sbcl, dumping an executable with save-lisp-and-die will create an executable that depends on a few dynamic libraries and, if you use the ffi, whatever dynamic libraries you're using though that. With the already existing static-program-op in one of the cffi packages (grovel, maybe?), you can get an executable with all of the libraries linked through the cffi linked in staticly (you won't need those .so files when you distribute the executable) but it will still need a few dynamic libraries when run. Glibc and libm at least, I think. As I understand it, this work is attempting to remove even those last few dynamic dependencies so you can distribute the dumped executable and be done. So, better if you want simpler distribution at the cost of larger executables.
- zulu-inuoe 6y ago`save-lisp-and-die` is still how you do the image dump, but the process here is: 1. compile & load all lisp code 2. dump list of external symbols 3. save-lisp-and-die into a .core file 4. build new SBCL w/ symbols from step #2 linked in (using sbcl.o, which is the SBCL runtime) 5. run new SBCL, using the core from step #3 6. save-lisp-and-die into an executable edit. fixed formatting
- eps 6y agoPSA: SBCL stands for Steel Bank Common Lisp - http://www.sbcl.org http://www.sbcl.org PSA: PSA stands for Public Service Announcement. Just in case.
- zoren 6y ago> The name "Steel Bank Common Lisp" is a reference to Carnegie Mellon University Common Lisp from which SBCL forked: Andrew Carnegie made his fortune in the steel industry and Andrew Mellon was a successful banker. https://en.wikipedia.org/wiki/Steel_Bank_Common_Lisp https://en.wikipedia.org/wiki/Steel_Bank_Common_Lisp
- oblio 6y agoWarning - rant ahead: I've been in this field for 15 years now. At some point the puns are a bit overbearing. We have enough cognitive overhead anyway, it's inherent in our field. They could have named it Carnegie Mellon Common Lisp, but hey, someone wanted to feel clever. Though this is super minor compared to Ruby (gems & co.) and especially to Chef (where you work with cookbooks, recipes, etc.) And of course, the granddaddy of them all, Unix. Because of course, less is more (all of my non-techie friends roll their eyes when I tell them about that one).
- mbeattie 6y agoWell it’s a fork of cmucl. Carnegie Mellon university Common Lisp. So they couldn’t have named it the same as the thing it was derived from.
- yellowapple 6y agoMaybe they should've called it Andrew Andrew Common Lisp?
- deleted 6y ago[deleted]
- dunefox 6y agoI think Steel Bank Common Lisp is a good name and the pun makes me like it even more. How is "Steel Bank" any different from a made up name? It's not.
- jwr 6y agoBack when I programmed in CL and participated in comp.lang.lisp, the topic of Static Executables was a recurring thing. I never understood why people were so obsessed with it, but somehow this became the Major Showstopper for wider CL adoption, in the eyes of some users. Most people who actually used CL for building stuff were somewhat amused, and tried to find out what was so important about encapsulating everything into a single executable and why other languages didn't have to do it, but CL absolutely did. I thought this was a red herring, but indeed for some reason it did affect acceptability. Glad to see a solution that looks fairly good.
- 7thaccount 6y agoSingle executables make distribution really easy. Sure, a lot of languages like Python don't have this, but it's also easier to tell someone to download and install Python to run a script than the SBCL process. The entire thing from emacs/slime to the package manager and so forth was just very complicated to me. Things like Portacle didn't help much either.
- jwr 6y agoYeah, I heard that argument — but seriously, how many people run or "install" single executables these days? What actually gets distributed as a single executable? I honestly can't think of anything, on any system, except perhaps ngrok which I use for development.
- jgalt212 6y agoI think that's true for the technical crowd, but much less so for the general populace.
- sidpatil 6y agoI don't see how, unless you're counting Windows application installers as single-file executables.
- phone8675309 6y ago
- jart 6y agoMusl is tired and Cosmopolitan wired, since it takes the fully static binary concept to a whole new level. SBCL should consider using it, since it lets your binaries run on Windows, Mac, FreeBSD, OpenBSD, and NetBSD too. https://github.com/jart/cosmopolitan https://github.com/jart/cosmopolitan See https://justine.lol/ape.html https://justine.lol/ape.html which talks about how the executable format is also a valid zip file, which was used to create a JavaScript interpreter that loads sources from itself in a single file. Another option for SBCL is to just use Cosmopolitan's research to implement the same thing from scratch. See files like https://github.com/jart/cosmopolitan/blob/master/libc/sysv/syscalls.sh https://github.com/jart/cosmopolitan/blob/master/libc/sysv/s... and https://github.com/jart/cosmopolitan/blob/master/libc/sysv/consts.sh https://github.com/jart/cosmopolitan/blob/master/libc/sysv/c...
- rcgorton 6y ago"tired and Cosmopolitan wired" This poster needs to be banned. Only relevant if you want an interpreter which runs an secondary interpreter, encapsulated in a .zip file.
- _roqj 6y agoCosmopolitan binaries aren't interpreted. They're just flat x86 binaries. It needs a 12kb runtime that's written in C. All the runtime does is (a) polyfills magic numbers for the SYSCALL instruction and (b) boot-load from BIOS to long mode on metal w/ linux kernel style negative memory page tables. So basically, it's just glue that takes care of the ugly low-level system details so you can bolt on whatever high level language interpreter you want. For example, the Wasm3 engine recently adopted it.
- rcgorton 6y agoFirst hit on google: SBLC == Stand By Letter of Credit. Clearly, Common LISP is not important/relevant according to google. It seems like "Common Lisp" implementations may be stuck in the mid 1980s and the implementors do not have any idea about how to use shared libraries. So sad