Running Squeak in a Unix shell

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Running Squeak in a Unix shell

Christoph Thiede

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


Travis (without explicit OS setting, so I'm assuming unix as well) says:

squeak: could not find any display driver

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
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: Running Squeak in a Unix shell

David T. Lewis
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
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Running Squeak in a Unix shell

Nicola Mingotti
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
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Running Squeak in a Unix shell

David T. Lewis
Hi Nicola,

Based on the error message you are seeing, I would guess that you are
running a Cog/Spur VM with heartbeat thread. That VM requires some specific
installation configurations on a unix system in order to work properly.

The error message is trying to let you know what to do, and in this case
it is saying that you need to use sudo (root privilege access) to add a
file called /etc/security/limits.d/squeak.conf, and that the file needs
to contain two lines that specify allowing rtprio privilege when running
the "squeak" program (i.e. the Squeak VM).

This is a specific Linux security setup that is required for certain
versions of the Squeak VM. I would suggest that you add the file to your
system, so that if you run a VM that requires the heartbeat thread, it
will work as expected.

As far as the test.st script that you are using, I would suggest changing
it slightly to make sure that it produces the console output that you
expect. First, have it write <lf> to make sure that you can see the
output on a separate line on the console. Second, add a #flush to make
sure that the output is fully written to the console before #quitPrimitive
causes the VM exit.

With those two small changes, your script might look like this:

  OSProcess thisOSProcess stdOut nextPutAll: 'Hello World'; lf ; flush.
  Smalltalk quitPrimitive.

Dave


On Wed, Oct 23, 2019 at 03:52:21PM -0700, Nicola Mingotti wrote:

> 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
> >>[hidden email]
> >>http://lists.squeakfoundation.org/mailman/listinfo/beginners
> >_______________________________________________
> >Beginners mailing list
> >[hidden email]
> >http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Running Squeak in a Unix shell

Nicola Mingotti
Hi Dave,

i will need to fight a bit. I am running Squeak most of the time in FreeBSD through the Linux emulation layer.  Ive got it working with the GUI, but i tweaked the startup script, now it bites back ;)

bye
nicola

Sent from my iPad

> On Oct 23, 2019, at 5:55 PM, David T. Lewis <[hidden email]> wrote:
>
> Hi Nicola,
>
> Based on the error message you are seeing, I would guess that you are
> running a Cog/Spur VM with heartbeat thread. That VM requires some specific
> installation configurations on a unix system in order to work properly.
>
> The error message is trying to let you know what to do, and in this case
> it is saying that you need to use sudo (root privilege access) to add a
> file called /etc/security/limits.d/squeak.conf, and that the file needs
> to contain two lines that specify allowing rtprio privilege when running
> the "squeak" program (i.e. the Squeak VM).
>
> This is a specific Linux security setup that is required for certain
> versions of the Squeak VM. I would suggest that you add the file to your
> system, so that if you run a VM that requires the heartbeat thread, it
> will work as expected.
>
> As far as the test.st script that you are using, I would suggest changing
> it slightly to make sure that it produces the console output that you
> expect. First, have it write <lf> to make sure that you can see the
> output on a separate line on the console. Second, add a #flush to make
> sure that the output is fully written to the console before #quitPrimitive
> causes the VM exit.
>
> With those two small changes, your script might look like this:
>
>  OSProcess thisOSProcess stdOut nextPutAll: 'Hello World'; lf ; flush.
>  Smalltalk quitPrimitive.
>
> Dave
>
>
>> On Wed, Oct 23, 2019 at 03:52:21PM -0700, Nicola Mingotti wrote:
>> 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
>>>> [hidden email]
>>>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>> _______________________________________________
>>> Beginners mailing list
>>> [hidden email]
>>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Running Squeak in a Unix shell

Nicola Mingotti
Hi guys,

I discovered why it does not work. [Test made in Linux Debian]

To cut  it short, errors do not get printed in the shell, so whatever mistake you do in your code, it is going to (probably) open a debugger somewhere you can't see it, and, by consequence, in the shell you will see only  a hung program that never ends.

Example: just insert this as first line of your script  
1 + 'a'. 

Question. Is there a way to tell Squeak we do not want the debugger to fire up and instead to print the stacktrace to in stderr? After that the pogram should die. Scripts are supposed to run unattended. 

bye
Nicola





On Thu, Oct 24, 2019 at 3:05 AM Nicola Mingotti <[hidden email]> wrote:
Hi Dave,

i will need to fight a bit. I am running Squeak most of the time in FreeBSD through the Linux emulation layer.  Ive got it working with the GUI, but i tweaked the startup script, now it bites back ;)

bye
nicola

Sent from my iPad

> On Oct 23, 2019, at 5:55 PM, David T. Lewis <[hidden email]> wrote:
>
> Hi Nicola,
>
> Based on the error message you are seeing, I would guess that you are
> running a Cog/Spur VM with heartbeat thread. That VM requires some specific
> installation configurations on a unix system in order to work properly.
>
> The error message is trying to let you know what to do, and in this case
> it is saying that you need to use sudo (root privilege access) to add a
> file called /etc/security/limits.d/squeak.conf, and that the file needs
> to contain two lines that specify allowing rtprio privilege when running
> the "squeak" program (i.e. the Squeak VM).
>
> This is a specific Linux security setup that is required for certain
> versions of the Squeak VM. I would suggest that you add the file to your
> system, so that if you run a VM that requires the heartbeat thread, it
> will work as expected.
>
> As far as the test.st script that you are using, I would suggest changing
> it slightly to make sure that it produces the console output that you
> expect. First, have it write <lf> to make sure that you can see the
> output on a separate line on the console. Second, add a #flush to make
> sure that the output is fully written to the console before #quitPrimitive
> causes the VM exit.
>
> With those two small changes, your script might look like this:
>
>  OSProcess thisOSProcess stdOut nextPutAll: 'Hello World'; lf ; flush.
>  Smalltalk quitPrimitive.
>
> Dave
>
>
>> On Wed, Oct 23, 2019 at 03:52:21PM -0700, Nicola Mingotti wrote:
>> 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
>>>> [hidden email]
>>>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>> _______________________________________________
>>> Beginners mailing list
>>> [hidden email]
>>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Running Squeak in a Unix shell

Christoph Thiede
In reply to this post by David T. Lewis

Hi Dave,


thank you for the detailed answer!


Actually, WSL is emulating a real unix system and it uses bash, so things like `cowsay Hello world` work indeed.

Is it possible that squeak does not support unix in general, but only certain distributions? It would be very nice to use it from WSL, which is becoming more important on Windows compared to the classic cmd.exe.


Regarding Travis: I found a few scripts such as https://github.com/hpi-swa/vivide/blob/master/scripts/prepare_image.sh#L64 that are calling Smalltalk as well. Why does that work, I would not assume that each Travis execution environment comes with a display driver, does it?


@Nicola Maybe you will want to have a look at CommandLineToolSet?


Best,

Christoph


Von: Beginners <[hidden email]> im Auftrag von David T. Lewis <[hidden email]>
Gesendet: Mittwoch, 23. Oktober 2019 03:11:16
An: A friendly place to get answers to even the most basic questions about Squeak.
Betreff: Re: [Newbies] Running Squeak in a Unix shell
 
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
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: Running Squeak in a Unix shell

Nicola Mingotti
Hi Christoph,

at the moment i dont have a Windows system to play with. Too slow in VMWare, i deleted the image. So i can t check anything related. 

... sorry for typos last Apple update crippled the capability of correcting single characters, blame on them for this gross mistake. 

If you want to try Unix in Windows i highly reccomend you try Cygwin. I could not live in Windows without a decent ssh, Cygwin solved as far as i remember. Once you are ready to do the real thing install the Unix in a virtual machine. VirtualBox works well and is free.

Unix is hard but logical. it has a view of the world and follows it. IMO BSD are cleaner and more well thought than Linux, great documentation. Linux has other benefits, better driver support, larger userbase, higher momentum. BTW, linux means nothing, you need to choose a distribution. My favourite was always Debian, clean and solid. 

I still din t have a clear view on this, but i feel Squeak may not the be the most appropriate tool for Unix scripting. Parobably GNUSmalltalk is the wise way to go down that path. 

bye
nicola




Sent from my iPad

On Oct 29, 2019, at 1:27 AM, Thiede, Christoph <[hidden email]> wrote:



Hi Dave,


thank you for the detailed answer!


Actually, WSL is emulating a real unix system and it uses bash, so things like `cowsay Hello world` work indeed.

Is it possible that squeak does not support unix in general, but only certain distributions? It would be very nice to use it from WSL, which is becoming more important on Windows compared to the classic cmd.exe.


Regarding Travis: I found a few scripts such as https://github.com/hpi-swa/vivide/blob/master/scripts/prepare_image.sh#L64 that are calling Smalltalk as well. Why does that work, I would not assume that each Travis execution environment comes with a display driver, does it?


@Nicola Maybe you will want to have a look at CommandLineToolSet?


Best,

Christoph


Von: Beginners <[hidden email]> im Auftrag von David T. Lewis <[hidden email]>
Gesendet: Mittwoch, 23. Oktober 2019 03:11:16
An: A friendly place to get answers to even the most basic questions about Squeak.
Betreff: Re: [Newbies] Running Squeak in a Unix shell
 
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
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Running Squeak in a Unix shell

David T. Lewis
In reply to this post by Christoph Thiede
Hi Christoph,


On Tue, Oct 29, 2019 at 08:27:50AM +0000, Thiede, Christoph wrote:
> Hi Dave,
>
> thank you for the detailed answer!
>
> Actually, WSL is emulating a real unix system and it uses bash, so things like `cowsay Hello world` work indeed.
>
> Is it possible that squeak does not support unix in general, but only certain distributions? It would be very nice to use it from WSL, which is becoming more important on Windows compared to the classic cmd.exe.
>

The Unix VM for Squeak is portable across a wide range of Unix and
Unix-like systems. But "portable" means different things to different
people. In your case, I think you'll just need to dig into it to find
out what that error message is telling you.

I can't guess the exact problem, but I am certain that the error message
(squeak: cannot execute binary file: Exec format error) will lead you
to it. It might be the "squeak" shell script, or it might be the
compiled binary VM (probably also called "squeak"), or it might be
something about how it is installed, I don't know. But one way or
another, WSL is trying to tell you that it does not know how to execute
one of those files.

A command that may be helpful for you to track this down is the Unix
"file" command (for example, "file squeak"). If the file you are testing
with this command is an executable file (such as the compiled VM), the
"file" command will explain what it is. If the "file" command cannot
figure out what the file is, then it probably is not a file that WSL
knows about.

HTH,
Dave


>
> Regarding Travis: I found a few scripts such as https://github.com/hpi-swa/vivide/blob/master/scripts/prepare_image.sh#L64 that are calling Smalltalk as well. Why does that work, I would not assume that each Travis execution environment comes with a display driver, does it?
>

I don't know, but I would assume the opposiste, that the Travis execution
environment probably does not come with a display driver.

Dave


>
> @Nicola Maybe you will want to have a look at CommandLineToolSet?
>
>
> Best,
>
> Christoph
>
> ________________________________
> Von: Beginners <[hidden email]> im Auftrag von David T. Lewis <[hidden email]>
> Gesendet: Mittwoch, 23. Oktober 2019 03:11:16
> An: A friendly place to get answers to even the most basic questions about Squeak.
> Betreff: Re: [Newbies] Running Squeak in a Unix shell
>
> 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
> > [hidden email]
> > http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Running Squeak in a Unix shell

Christoph Thiede

Hi Dave,


thank you very much!


The `file` command gave me the hint that I was trying to run a 32-bit squeak on a 64-bit system. Now it works!


Best,

Christoph


Von: Beginners <[hidden email]> im Auftrag von David T. Lewis <[hidden email]>
Gesendet: Dienstag, 29. Oktober 2019 12:56:20
An: A friendly place to get answers to even the most basic questions about Squeak.
Betreff: Re: [Newbies] Running Squeak in a Unix shell
 
Hi Christoph,


On Tue, Oct 29, 2019 at 08:27:50AM +0000, Thiede, Christoph wrote:
> Hi Dave,
>
> thank you for the detailed answer!
>
> Actually, WSL is emulating a real unix system and it uses bash, so things like `cowsay Hello world` work indeed.
>
> Is it possible that squeak does not support unix in general, but only certain distributions? It would be very nice to use it from WSL, which is becoming more important on Windows compared to the classic cmd.exe.
>

The Unix VM for Squeak is portable across a wide range of Unix and
Unix-like systems. But "portable" means different things to different
people. In your case, I think you'll just need to dig into it to find
out what that error message is telling you.

I can't guess the exact problem, but I am certain that the error message
(squeak: cannot execute binary file: Exec format error) will lead you
to it. It might be the "squeak" shell script, or it might be the
compiled binary VM (probably also called "squeak"), or it might be
something about how it is installed, I don't know. But one way or
another, WSL is trying to tell you that it does not know how to execute
one of those files.

A command that may be helpful for you to track this down is the Unix
"file" command (for example, "file squeak"). If the file you are testing
with this command is an executable file (such as the compiled VM), the
"file" command will explain what it is. If the "file" command cannot
figure out what the file is, then it probably is not a file that WSL
knows about.

HTH,
Dave


>
> Regarding Travis: I found a few scripts such as https://github.com/hpi-swa/vivide/blob/master/scripts/prepare_image.sh#L64 that are calling Smalltalk as well. Why does that work, I would not assume that each Travis execution environment comes with a display driver, does it?
>

I don't know, but I would assume the opposiste, that the Travis execution
environment probably does not come with a display driver.

Dave


>
> @Nicola Maybe you will want to have a look at CommandLineToolSet?
>
>
> Best,
>
> Christoph
>
> ________________________________
> Von: Beginners <[hidden email]> im Auftrag von David T. Lewis <[hidden email]>
> Gesendet: Mittwoch, 23. Oktober 2019 03:11:16
> An: A friendly place to get answers to even the most basic questions about Squeak.
> Betreff: Re: [Newbies] Running Squeak in a Unix shell
>
> 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
> > [hidden email]
> > http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Carpe Squeak!