Native standalone executable with smalltalk?
Asked Answered
G

7

13

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.

Glairy answered 3/8, 2015 at 18:29 Comment(1)
This is not specific to Smalltalk, but to certain dialects. There are several Smalltalk products that come in an .exe file (for example).Turpeth
D
8

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.

Dairymaid answered 4/8, 2015 at 21:17 Comment(2)
The SqueakNOS project takes this philosophy even further but requiring no Operating System at all(!)Turpeth
You are correct in that it makes no real difference to the size of the download. It makes a large difference to the end-user of the application. It also can make a difference for protecting proprietary aspects of the code.Bute
T
8

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.

Tectonic answered 24/8, 2015 at 16:47 Comment(0)
R
5

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

Reverse answered 27/8, 2015 at 1:7 Comment(1)
Dolphin has become open source. You can have it for free and also look up the source! ;) (object-arts.com/blog/files/…)Kraal
O
2

The problem is that Pharo, in that case, cannot be compared to any native compiler like C, C++ or others, but more like java, python, ruby and other languages with a Virtual Machine around.

In these languages, you produce jars, eggs or gems to distribute your project.

In Pharo, you produce a "production image" following technics you already mentioned. But nothing prevents you to deliver an artefact including also the PharoVM (it is 2m large, after all), and you can prepare your apps to detect and open your production image (without having to ask for it).

Ottar answered 4/8, 2015 at 10:8 Comment(1)
Other VM+image based Smalltalks can do this. The comparison is possible. This is not a restriction of the use of images or VMs. It is simply an issue of Pharo's maturity.Bute
C
2

It is about as practical with Smalltalk as with other languages: not very much. As soon as you create a somewhat larger application, you start depending on other libraries/applications being installed. If you compile them statically with the application, you have now created a much larger application that takes longer to download, and needs to be updated at least as soon as a security problem is found in one of the dependencies. If not, your application is no longer double-click startable.

There are two directions for solutions: web applications, and installers and package managers.

Squeak still maintains its one-click installer, allowing the same set of files to work on windows, mac and linux. Pharo used to have that too, but moved to having separate builds. The need hasn't been so large that the one-click build has been reinstated. It is mostly seen as useful to be able to carry around a cross-platform environment on an usb-stick. With the move to the 64-bit spur vm the dependency problems will lessen as more of the needed libraries will come pre-installed on those platforms.

Coping answered 11/8, 2015 at 12:6 Comment(0)
B
1

Dolphin Smalltalk can produce a standalone .exe for Windows.

This is a key feature of the Pro version.

Bute answered 3/12, 2015 at 21:35 Comment(0)
E
0

Your dream has been around since the mid-80's and it is called Smalltalk/X.

Enfield answered 15/8, 2015 at 12:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.