Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Native standalone executable with smalltalk?

I really like live smalltalk environment (though I only experimented a bit with Pharo), but there is one thing why I can't really use it for everyday development. It seems that it is not possible to create a native standalone executable from smalltalk system. The native standalone executable means to create a single executable file (PE on windows, ELF on linux, Mach-O on macosx), that a user could run by double clicking it without the need to install any additional execution environments. Am I missing something and it is in fact possible to create native standalone executable with smalltalk?

If we talk about Pharo specifically. I know that Pharo's environment includes efficient just in time compiler (that generates true native code from Pharo's VM bytecode), I know that the VM image can be stripped down by cutting of the code that my application won't ever need. So basically we already have almost everything (except the linker I guess) to be able to create native standalone executables. Cross-compilation shouldn't be a problem too, if we put all code generation stuff (for all target processors) in the image.

I know that in smalltalk world it is considered to be a good thing to deliver the whole VM image separately from the runtime environment, so the user can hack on software he/she is using. However I don't see any good reasons why it shouldn't be possible to deliver your smalltalk software as fully compiled native standalone executable. Could you please explain me why it is not a common thing to do in smalltalk world? Is there any good smalltalk implementation that allow to do it?

To sum all this. I dream of a live smalltalk environment, where I could develop and test my software, but then (when the software is actually ready for delivery) cross-compile it to native executables for windows, linux and macosx from my single development machine. That would be really awesome.

like image 516
user2102508 Avatar asked Aug 03 '15 18:08

user2102508


3 Answers

ironically enough there is one thing that an exe needs to be preloaded. Your OS. See the thing is that C/C++ can be so light because already your OS acts pretty much as the image acts with a ton of preloaded libraries. You need to waste several GBs of memory just get a simple calculator starting. Your OS is a collection of C/C++ libraries.

Things are not any prettier with other languages like python, java etc , even if the app is smaller, they still depend on this libs and they come will quite big libraries that would need installation whether your app use them or not.

Pharo and Smalltalk in general is diffirent case because they aspire to be a virtual OS by itself. The diffirence with a real OS , the smalltalk image is made to be hacked the easy way by a user .

Saying that you can rename the pharo executable, change its icon, disable to IDE tools inside Pharo so your user sees only the GUI of your App. Applications like Dr. Geo and Phratch already do this.

Compiling a Pharo project to a native executable will not make much difference, because a) Pharo is already compiled to a native executable b) you dont need to do that since Pharo is already standalone does not need to even be installed.

My advice is stop worrying about things that do not really matter and enjoy learning how powerful and fun Pharo can be.

like image 61
Kilon Avatar answered Nov 13 '22 20:11

Kilon


You might also check out Dolphin from Object Arts.

It is windows only, but the very best IDE, bar none. If you do anything in Smalltalk, you should buy a copy. (They also have a free non-commercial version, but you will want to support the kind of craftsmanship behind it by buying the Pro version. An absolutely kick-ass product, IMHO).

It will produce a standalone exe, if that's what you want. I made an exe of a medium-featured wiki with it - the exe was less than 1 MB. That is not a typo.

-Jim

like image 39
Jim Sawyer Avatar answered Nov 13 '22 20:11

Jim Sawyer


Not Pharo, but native, compiled (through ANSI C or its own JIT) smalltalk [applications] (with ability to load pre-compiled DLLs or [JIT-]compile code on demand):

Smalltalk/X

http://www.exept.de/en/products/smalltalk-x.html

or (unofficial enhanced development version):

Smalltalk/X JV branch - https://swing.fit.cvut.cz/projects/stx-jv/

Nearly completely open-source. Everything except librun (core runtime - memory management, JIT, etc.) and stc (smalltalk-to-c) compiler is already open-source. Claus Gittinger / Exept also promised/confirmed they would release remaining sources were they to stop further development (AFAIK, those parts are closed only because of concerns of existing clients).

I highly recommend everyone to check it out, it is a wonder such a great implementation is so little known.

like image 8
Miloslav Raus Avatar answered Nov 13 '22 18:11

Miloslav Raus