[Newbies] Running Squeak in a Unix shell

Nicola Mingotti nmingotti at gmail.com
Wed Oct 23 22:52:21 UTC 2019


Hi David,

thank you for your detailed mail. I was trying your procedure and I have 
a question.

I wrote this into file '~/download/test.st'
----------------
OSProcess thisOSProcess stdOut nextPutAll: 'Hello World'.
Smalltalk quitPrimitive.
----------------

Then tried to run the script with:
----------------
$> cd [squeak bin directory]
$> ./squeak -vm-display-null ../Squeak5.2-18229-64bit.image 
~/download/test.st
==== OUTOUT ======================
pthread_setschedparam failed: Operation not permitted
This VM uses a separate heartbeat thread to update its internal clock
and handle events.  For best operation, this thread should run at a
higher priority, however the VM was unable to change the priority. The
effect is that heavily loaded systems may experience some latency
issues.  If this occurs, please create the appropriate configuration
file in /etc/security/limits.d/ as shown below:

cat <<END | sudo tee /etc/security/limits.d/squeak.conf
*      hard    rtprio  2
*      soft    rtprio  2
END

and report to the squeak mailing list whether this improves behaviour.

You will need to log out and log back in for the limits to take effect.
For more information please see
https://github.com/OpenSmalltalk/opensmalltalk-vm/releases/tag/r3732#linux
===============================================
----------------

But I get nothing back except from info messages, the script does not 
end, it seems Squeak is ignoring the "quitPrimitive".

What is the simplest test script you recommend to start with ?

bye
Nicola




On 10/22/19 6:11 PM, David T. Lewis wrote:
> Hi Christoph,
>
> On Tue, Oct 22, 2019 at 10:41:16PM +0000, Thiede, Christoph wrote:
>> Hi,
>>
>> this a question by a shell noob: How can I use Squeak in a unix shell to run a command such as:
>>
>> ./squeak foo.image bar.st
>>
>> I would like to do this in my WSL shell (Windows Subsystem for Linux) as well as on Travis.
>>
>> WSL says:
>>
>> squeak: cannot execute binary file: Exec format error
>>
> The command line that you gave ("./squeak foo.image bar.st") would be
> appropriate on a Unix system (Linux, OS X, or whatever) if you have
> a file called "squeak" in your current directory, and if that file
> is an executable file such as a shell script or a compiled executable.
>
> I am not familiar with WSL, but assuming that it is trying to behave
> like a Unix shell, I would interpret the error message as follows:
>
> - The shell tried to execute the file "./squeak", where the "./"
> portion of the file path means "in the current directory", and "squeak"
> is the name of the file to be executed.
>
> - It found the file, and tried to open it. You did not see a "file
> not found" error, so there actually must be a file called "squeak" in
> your local directory, and the file has execute permissions, so all
> good so far.
>
> - The shell then tried to execute the "squeak" program. This means
> that the shell saw that the file was marked executable, and it asked
> the operating system to "exec" the file (on a Unix system, this will
> fork the shell process and overlay the executable in the new process,
> see http://man7.org/linux/man-pages/man3/exec.3.html).
>
> - For some reason, the file could not be executed ("Exec format error").
>
> This suggest to me that the WSL environment did not know how to
> execute the "squeak" file. Maybe it was a compiled binary (such as
> a compiled VM) that the WSL system did not recognize, or maybe WSL
> was not smart enough to figure out how to evaluate a shell script,
> I don't know.
>
>> Travis (without explicit OS setting, so I'm assuming unix as well) says:
>>
>> squeak: could not find any display driver
> Travis is probably running on a real Unix system (or Linux, which
> is very similar). Whatever it is, you can safely bet that it does
> not provide a graphical display system such as X11, because a CI
> system such as Travis is intended to run things remotely on a
> server with no graphical user interface. So most likely, you are
> trying to run a VM with graphical display on an operating system
> that does not provide display services.
>
> A Squeak VM will normally try to find a graphical display driver
> unless you explicitly tell it (with a command line option) not to
> do so. If you just run Squeak on a server with no X11 (or similar)
> installed, the VM will try to open a display module, and when it
> fails, it will give you an error message:
>
>      platforms/unix/vm/sqUnixMain.c:      fprintf(stderr, "squeak: could not find any display driver\n");
>
> The solution for this problem is specific to the Unix VM (in other
> words, don't try this on your Windows VM). You can run the VM without
> using an active display by using the '-vm-display-null' command
> line parameter. On a Unix system, run "squeak -help" to see the
> available options.
>
> Thus, if you had a command such as this for running Squeak:
>
> 	./squeak foo.image bar.st
>
> Then you can run it in "headless" mode like this:
>
> 	./squeak -vm-display-null foo.image bar.st
>
> The Unix Squeak VM has loadable VM modules for things like soound
> and the display, so -vm-display-null tells the VM to load the null
> display driver instead of the vm-display-X11 or vm-display-Quartz
> modules.
>
> HTH,
> Dave
>
>
>> To run a script in headless mode, I should not need any graphical output? How can I achieve this? I would greatly appreciate your help!
>>
>>
>> Best,
>>
>> Christoph
>> _______________________________________________
>> Beginners mailing list
>> Beginners at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/beginners/attachments/20191023/2a8949bf/attachment.html>


More information about the Beginners mailing list