GNU Smalltalk 3.1

GNU Smalltalk 3.1 has been released at

Compared to the 3.0.x branch, focus on porting libraries from other Smalltalks, adding bindings to other external libraries, and facilitating the creation of C/Smalltalk interfaces.

More in detail, changes between 3.0.5 and 3.1 include the following.

New base class features

  • BlockClosure methods #cull:, #cull:cull:, #cull:cull:cull: evaluate blocks removing parameters that are not accepted by the block.
    • Thanks to this new functionality, the parameter to #on:do: and #ifNotNil: can be omitted.
    • RegexResults method #ifMatched:ifNotMatched:, and other similar methods, also accept either zero or one-argument blocks. In 3.0.x, #ifMatched: accepted a one-argument block, while #ifNotMatched: accepted a zero-argument block.
  • Collections and Streams have a common superclass, Iterable. The user-visible aspect of this is that Streams now enjoy a wider range of iteration methods, such as #anySatisfy:, #detect: and #count:.
  • CObjects can be backed with garbage-collected (as opposed to heap-allocated) storage. Using this is not always possible, for example for CObjects stored by external libraries or passed to functions that call back to Smalltalk or otherwise may cause garbage collections. If it is, however, it is easier to use, faster and more predictable than finalization. As an added benefit, accesses to garbage-collected CObjects are bounds-checked. Garbage-collected CObjects are created by sending #gcNew instead of #new to instances of CType.
  • It is possible to create C call-outs that are not attached to a function that the VM knows about, using the method CCallable class>>#for:returning:withArgs:. The returned object can then be used to create CompiledMethods using CompiledMethod class>>#cCall:numArgs:attributes:. The address however is reset to NULL on image restart and it is up to the user to reinitialize it. You can also subclass CCallable and override the #link method (the existing CFunctionDescriptor class is now implemented on top of this).
  • ObjectMemory>>#snapshot and ObjectMemory>>#snapshot: return false in the instance of GNU Smalltalk that produced the snapshot, and true in the instance of GNU Smalltalk that was restored from the snapshot. Note that this does not apply to CallinProcesses, since those are stopped in saved images.
  • Packages can specify start/stop scripts. Start scripts can be activated with gst-load, while both start and stop scripts are supported by the new tool gst-remote (see below).
  • Processes support thread-local variables, which are accessed through a special dictionary returned by ProcessorScheduler>>#processEnvironment.
  • Streams have a set of new methods that allow to eliminate useless copies when moving data from stream to stream, as well as to eliminate useless creation of collections to store the data read from a stream. Besides the standard methods #next, #nextPut: and #atEnd, three more methods can be implemented by Stream subclasses in order to achieve better performance on block transfers, namely #nextAvailable:into:startingAt:, #nextAvailable:putAllOn: and #next:putAll:startingAt:. Another set of new methods was added to Stream, in order to provide an easier to use API on top of the basic block-streaming API described above; you should not need to override them. These are #next:into:startingAt:, #next:putAllOn:, #nextAvailable:, #nextAvailablePutAllOn:.

New environment/language features

  • Error backtraces include line numbers and filenames.
  • Imports were added to namespaces (via the <import: ...> pragma, as for classes). Unlike the superspace, imports are not made visible through #at:. The design and implementation of this feature was done by Stephen Compall.
  • The order for searching pool dictionaries changed. The new order, codenamed "TwistedPools", builds on three ideas: 1) the environment of a class always has lower priority than the imports, so the environment is always excluded from the imports if the environment is a superspace of the imports; 2) apart from this, the imports are visited in topological order, so that if two imports have a superspace in common, the imports are always visited before the superspace; 3) each class in the inheritance order is visited separately, so the imports of a superclass have lower priority than the environment of the subclass. The design and implementation of this feature was also done by Stephen Compall.
  • The source code for methods loaded from Streams that are not FileStreams is stored directly in the image. This is actually a bugfix, but it was not possible to backport it to the 3.0.x series because the fix depends on the new virtual filesystem implementation (see below)

Incompatible changes

  • FileDescriptor and FileStream raise an exception if #next: cannot return the given number of bytes.
  • FileDescriptor is now a subclass of Stream.
  • Halt is now a subclass of Exception (rather than Error).
  • ObjectDumper now accepts normal String streams. The class ByteStream has been removed.
  • Stream>>#nextHunk was removed. Applications can use #nextAvailable: or, better, should be rewritten to use new stream-to-stream protocol such as #nextAvailablePutAllOn:.
  • The VFS subsystem was rewritten. Virtual filesystems are now accessible via special methods on File (such as File>>#zip, for example (File name: '') zip) and not anymore with special filenames that could conflict with real files. Incompatible changes caused by this include:
    • methods like File image and Directory kernel return a File object, not a String;
    • Directory objects are not created anymore and instead File objects also support the directory enumeration protocol;
    • Directory>>#do: passes File objects rather than file names to the block;
    • Directory>>#contents is now called Directory>>#entryNames;
    • virtual files are not anymore instances of File; extension methods that also apply to virtual files should be added in FilePath.
  • The semantics of #on:do: were changed: executing off the end of an exception handler will always return from the associated #on:do:. Older versions of GNU Smalltalk either returned or resumed depending on the resumability of the exception.

New VM features

  • Functions gst_async_signal and gst_async_signal_and_unregister are now thread-safe, *not* async-signal-safe. This is more useful, and is a feature more than an incompatible change. To trap signals from Smalltalk, you have to use ProcessorScheduler>>#signal:onInterrupt:.
  • If possible, the installation is made relocatable. To this end, the following conditions should be satisfied: 1) the exec-prefix and prefix should be identical; 2) the installation should reside entirely within the prefix; 3) on Windows, the bindir and libdir should be the same or shared libraries should be disabled; 4) if neither on Windows nor under a glibc-based system, shared libraries should be disabled. If the above conditions are satisfied, and you want a relocatable install, it is suggested that you configure with a non-existent prefix such as "--prefix=/nonexistent". To move the installation, you can install into a staging area and move it from there.

     ./configure --prefix=/nonexistent
     make install DESTDIR=`pwd`
     (cd nonexistent && tar cvf - .) | (cd $HOME && tar xvf -)
     (cd nonexistent && tar cvf - .) | (cd /usr/local && tar xvf -)

  • In order to support relocatable installation, libgst clients should call gst_set_executable_path *before* gst_initialize. Failure to do so won't cause any problem, except that relocatable installation will be disabled and the program will look for its files only in the configured prefix.

Packages changes

  • DBI:
    • DBI supports querying tables for schema information, and is integrated with the "ROE" (Relational Object Expression) package by Avi Bryant. ROE support is present for all back-ends (MySQL, PostgreSQL, SQLite).
    • The SQLite backend supports stored procedures (contributed by Daniele Sciascia).
  • Sockets (formerly TCP):
    • IPv6 and AF_UNIX sockets. IPv6 support is transparent if your system is configured appropriately. In order to use AF_UNIX sockets, just specify the socket name as the "port" and "Sockets.UnixAddress uniqueInstance" as the host.
    • The sockets package (and the namespace it is installed in) was renamed from TCP to Sockets. While the old namespace is still available for backwards compatibility, it is suggested to use the Sockets namespace instead.
    • Unbuffered sockets available from class Sockets.StreamSocket.

New goodies

  • A new installed tool gst-remote allows remote control of a GNU Smalltalk VM via a TCP socket, possibly via ssh.
  • Bindings to Cairo and LibSDL provided by Michael Bridgen, Tony Garnock-Jones and Brad Watson.
  • Bindings to OpenGL and GLUT contributed by Olivier Blanc.
  • Magritte object-model description framework by Lukas Renggli.
  • ROE (see above).
  • Seaside application server/web framework by Avi Bryant, Julian Fitzell, Philippe Marschall, Lukas Renggli and others. The version of Seaside included is a snapshot of 2.9 from last February, which is similar to 2.8 except for some deprecated APIs; a new release of GNU Smalltalk 3.1.x will be published supporting 2.9 final when it comes out.
  • Swazoo web server by Bruce Badger, Janko Mivsek and others.

Thanks to the above-mentioned contributors, and to Thomas Girard for testing of the prereleases.

building 3.1 (from ftp server) on Solaris 10 fails:

/bin/bash ../libtool --tag=LIBGST --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -DKERNEL_PATH=\""/usr/local/share/smalltalk/kernel"\" -DIMAGE_PATH=\""/usr/local/var/lib/smalltalk"\" -DMODULE_PATH=\""/usr/local/lib/smalltalk"\" -DLIBEXEC_PATH=\""/usr/local/libexec/smalltalk"\" -DDEFAULT_EXECUTABLE=\""/usr/local/bin/gst"\" -I../lib-src -I../lib-src -I../libffi/include -I../libffi/include -I../snprintfv -I../snprintfv -I../sigsegv/src -I../sigsegv/src -I../lightning -I../lightning -I.. -I.. -D_REENTRANT -I/usr/local/include -g -O2 -Wall -Wno-strict-aliasing -Wno-switch -fno-gcse -fstrict-aliasing -Wdeclaration-after-statement -Wno-format -Wpointer-arith -Wwrite-strings -MT security.lo -MD -MP -MF .deps/security.Tpo -c -o security.lo security.c

gcc -DHAVE_CONFIG_H -I. -I.. -DKERNEL_PATH=\"/usr/local/share/smalltalk/kernel\" -DIMAGE_PATH=\"/usr/local/var/lib/smalltalk\" -DMODULE_PATH=\"/usr/local/lib/smalltalk\" -DLIBEXEC_PATH=\"/usr/local/libexec/smalltalk\" -DDEFAULT_EXECUTABLE=\"/usr/local/bin/gst\" -I../lib-src -I../lib-src -I../libffi/include -I../libffi/include -I../snprintfv -I../snprintfv -I../sigsegv/src -I../sigsegv/src -I../lightning -I../lightning -I.. -I.. -D_REENTRANT -I/usr/local/include -g -O2 -Wall -Wno-strict-aliasing -Wno-switch -fno-gcse -fstrict-aliasing -Wdeclaration-after-statement -Wno-format -Wpointer-arith -Wwrite-strings -MT security.lo -MD -MP -MF .deps/security.Tpo -c security.c  -fPIC -DPIC -o .libs/security.o
gcc -DHAVE_CONFIG_H -I. -I.. -DKERNEL_PATH=\"/usr/local/share/smalltalk/kernel\" -DIMAGE_PATH=\"/usr/local/var/lib/smalltalk\" -DMODULE_PATH=\"/usr/local/lib/smalltalk\" -DLIBEXEC_PATH=\"/usr/local/libexec/smalltalk\" -DDEFAULT_EXECUTABLE=\"/usr/local/bin/gst\" -I../lib-src -I../lib-src -I../libffi/include -I../libffi/include -I../snprintfv -I../snprintfv -I../sigsegv/src -I../sigsegv/src -I../lightning -I../lightning -I.. -I.. -D_REENTRANT -I/usr/local/include -g -O2 -Wall -Wno-strict-aliasing -Wno-switch -fno-gcse -fstrict-aliasing -Wdeclaration-after-statement -Wno-format -Wpointer-arith -Wwrite-strings -MT security.lo -MD -MP -MF .deps/security.Tpo -c security.c -o security.o >/dev/null 2>&1

mv -f .deps/security.Tpo .deps/security.Plo
/bin/bash ../libtool --tag=LIBGST --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -DKERNEL_PATH=\""/usr/local/share/smalltalk/kernel"\" -DIMAGE_PATH=\""/usr/local/var/lib/smalltalk"\" -DMODULE_PATH=\""/usr/local/lib/smalltalk"\" -DLIBEXEC_PATH=\""/usr/local/libexec/smalltalk"\" -DDEFAULT_EXECUTABLE=\""/usr/local/bin/gst"\" -I../lib-src -I../lib-src -I../libffi/include -I../libffi/include -I../snprintfv -I../snprintfv -I../sigsegv/src -I../sigsegv/src -I../lightning -I../lightning -I.. -I.. -D_REENTRANT -I/usr/local/include -g -O2 -Wall -Wno-strict-aliasing -Wno-switch -fno-gcse -fstrict-aliasing -Wdeclaration-after-statement -Wno-format -Wpointer-arith -Wwrite-strings -MT re.lo -MD -MP -MF .deps/re.Tpo -c -o re.lo re.c
gcc -DHAVE_CONFIG_H -I. -I.. -DKERNEL_PATH=\"/usr/local/share/smalltalk/kernel\" -DIMAGE_PATH=\"/usr/local/var/lib/smalltalk\" -DMODULE_PATH=\"/usr/local/lib/smalltalk\" -DLIBEXEC_PATH=\"/usr/local/libexec/smalltalk\" -DDEFAULT_EXECUTABLE=\"/usr/local/bin/gst\" -I../lib-src -I../lib-src -I../libffi/include -I../libffi/include -I../snprintfv -I../snprintfv -I../sigsegv/src -I../sigsegv/src -I../lightning -I../lightning -I.. -I.. -D_REENTRANT -I/usr/local/include -g -O2 -Wall -Wno-strict-aliasing -Wno-switch -fno-gcse -fstrict-aliasing -Wdeclaration-after-statement -Wno-format -Wpointer-arith -Wwrite-strings -MT re.lo -MD -MP -MF .deps/re.Tpo -c re.c  -fPIC -DPIC -o .libs/re.o
gcc -DHAVE_CONFIG_H -I. -I.. -DKERNEL_PATH=\"/usr/local/share/smalltalk/kernel\" -DIMAGE_PATH=\"/usr/local/var/lib/smalltalk\" -DMODULE_PATH=\"/usr/local/lib/smalltalk\" -DLIBEXEC_PATH=\"/usr/local/libexec/smalltalk\" -DDEFAULT_EXECUTABLE=\"/usr/local/bin/gst\" -I../lib-src -I../lib-src -I../libffi/include -I../libffi/include -I../snprintfv -I../snprintfv -I../sigsegv/src -I../sigsegv/src -I../lightning -I../lightning -I.. -I.. -D_REENTRANT -I/usr/local/include -g -O2 -Wall -Wno-strict-aliasing -Wno-switch -fno-gcse -fstrict-aliasing -Wdeclaration-after-statement -Wno-format -Wpointer-arith -Wwrite-strings -MT re.lo -MD -MP -MF .deps/re.Tpo -c re.c -o re.o >/dev/null 2>&1

mv -f .deps/re.Tpo .deps/re.Plo
/bin/bash ../libtool --tag=LIBGST --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -DKERNEL_PATH=\""/usr/local/share/smalltalk/kernel"\" -DIMAGE_PATH=\""/usr/local/var/lib/smalltalk"\" -DMODULE_PATH=\""/usr/local/lib/smalltalk"\" -DLIBEXEC_PATH=\""/usr/local/libexec/smalltalk"\" -DDEFAULT_EXECUTABLE=\""/usr/local/bin/gst"\" -I../lib-src -I../lib-src -I../libffi/include -I../libffi/include -I../snprintfv -I../snprintfv -I../sigsegv/src -I../sigsegv/src -I../lightning -I../lightning -I.. -I.. -D_REENTRANT -I/usr/local/include -g -O2 -Wall -Wno-strict-aliasing -Wno-switch -fno-gcse -fstrict-aliasing -Wdeclaration-after-statement -Wno-format -Wpointer-arith -Wwrite-strings -MT interp.lo -MD -MP -MF .deps/interp.Tpo -c -o interp.lo interp.c
gcc -DHAVE_CONFIG_H -I. -I.. -DKERNEL_PATH=\"/usr/local/share/smalltalk/kernel\" -DIMAGE_PATH=\"/usr/local/var/lib/smalltalk\" -DMODULE_PATH=\"/usr/local/lib/smalltalk\" -DLIBEXEC_PATH=\"/usr/local/libexec/smalltalk\" -DDEFAULT_EXECUTABLE=\"/usr/local/bin/gst\" -I../lib-src -I../lib-src -I../libffi/include -I../libffi/include -I../snprintfv -I../snprintfv -I../sigsegv/src -I../sigsegv/src -I../lightning -I../lightning -I.. -I.. -D_REENTRANT -I/usr/local/include -g -O2 -Wall -Wno-strict-aliasing -Wno-switch -fno-gcse -fstrict-aliasing -Wdeclaration-after-statement -Wno-format -Wpointer-arith -Wwrite-strings -MT interp.lo -MD -MP -MF .deps/interp.Tpo -c interp.c  -fPIC -DPIC -o .libs/interp.o
gcc -DHAVE_CONFIG_H -I. -I.. -DKERNEL_PATH=\"/usr/local/share/smalltalk/kernel\" -DIMAGE_PATH=\"/usr/local/var/lib/smalltalk\" -DMODULE_PATH=\"/usr/local/lib/smalltalk\" -DLIBEXEC_PATH=\"/usr/local/libexec/smalltalk\" -DDEFAULT_EXECUTABLE=\"/usr/local/bin/gst\" -I../lib-src -I../lib-src -I../libffi/include -I../libffi/include -I../snprintfv -I../snprintfv -I../sigsegv/src -I../sigsegv/src -I../lightning -I../lightning -I.. -I.. -D_REENTRANT -I/usr/local/include -g -O2 -Wall -Wno-strict-aliasing -Wno-switch -fno-gcse -fstrict-aliasing -Wdeclaration-after-statement -Wno-format -Wpointer-arith -Wwrite-strings -MT interp.lo -MD -MP -MF .deps/interp.Tpo -c interp.c -o interp.o >/dev/null 2>&1

mv -f .deps/interp.Tpo .deps/interp.Plo
/bin/bash ../libtool --tag=LIBGST --tag=CC --mode=link gcc -g -O2 -Wall -Wno-strict-aliasing -Wno-switch -fno-gcse -fstrict-aliasing -Wdeclaration-after-statement -Wno-format -Wpointer-arith -Wwrite-strings -version-info 7:2:0 -no-undefined -export-symbols-regex "^gst_.*" -o -rpath /usr/local/lib gstpub.lo files.lo gst-parse.lo lex.lo str.lo tree.lo byte.lo comp.lo sym.lo dict.lo oop.lo opt.lo save.lo cint.lo heap.lo input.lo sysdep.lo callin.lo xlat.lo events.lo mpz.lo print.lo alloc.lo security.lo re.lo interp.lo ../lib-src/ ../sigsegv/src/ ../libffi/ ../snprintfv/snprintfv/ -lsocket -lm
generating symbol list for `'
/usr/local/bin/nm -B .libs/gstpub.o .libs/files.o .libs/gst-parse.o .libs/lex.o .libs/str.o .libs/tree.o .libs/byte.o .libs/comp.o .libs/sym.o .libs/dict.o .libs/oop.o .libs/opt.o .libs/save.o .libs/cint.o .libs/heap.o .libs/input.o .libs/sysdep.o .libs/callin.o .libs/xlat.o .libs/events.o .libs/mpz.o .libs/print.o .libs/alloc.o .libs/security.o .libs/re.o .libs/interp.o ../lib-src/.libs/library.a ../libffi/.libs/libffi.a ../snprintfv/snprintfv/.libs/libsnprintfvc.a | sed -n -e 's/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\(\)\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2\3 \3/p' | /usr/bin/sed 's/.* //' | sort | uniq > .libs/libgst.exp
/usr/local/bin/nm: v9.o: no symbols
/usr/local/bin/grep -E -e "^gst_.*" ".libs/libgst.exp" > ".libs/libgst.expT"
mv -f ".libs/libgst.expT" ".libs/libgst.exp"
gcc -shared .libs/gstpub.o .libs/files.o .libs/gst-parse.o .libs/lex.o .libs/str.o .libs/tree.o .libs/byte.o .libs/comp.o .libs/sym.o .libs/dict.o .libs/oop.o .libs/opt.o .libs/save.o .libs/cint.o .libs/heap.o .libs/input.o .libs/sysdep.o .libs/callin.o .libs/xlat.o .libs/events.o .libs/mpz.o .libs/print.o .libs/alloc.o .libs/security.o .libs/re.o .libs/interp.o -Wl,--whole-archive ../lib-src/.libs/library.a ../libffi/.libs/libffi.a ../snprintfv/snprintfv/.libs/libsnprintfvc.a -Wl,--no-whole-archive -Wl,--rpath -Wl,/home/kickclow/root/smalltalk-3.1/sigsegv/src/.libs -Wl,--rpath -Wl,/usr/local/lib -ldl ../sigsegv/src/.libs/ -lsocket -lm -Wl,-soname -Wl, -Wl,-retain-symbols-file -Wl,.libs/libgst.exp -o .libs/
../libffi/.libs/libffi.a(v9.o): could not read symbols: Memory exhausted
collect2: ld returned 1 exit status
make[3]: *** [] Error 1
make[3]: Leaving directory `/home/kickclow/root/smalltalk-3.1/libgst'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/kickclow/root/smalltalk-3.1/libgst'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/kickclow/root/smalltalk-3.1'
make: *** [all] Error 2

What can I do about that?

On Vista, after numerous cygwin-install efforts to get all that is needed, make ends with this complaint: "libtool: link: ERROR: object name conflicts: ...libgst.lax/library.a//cygdrive.../lib-src/.libs/library.a" I had the same problem with 3.0.5.

I would rather just grab binaries - the squeak model is dead simple in this regard. There is no way I will be able to share any applications I write in gnu-smalltalk with non-programmer friends ... not if they have to build smalltalk for their computer. [I will check the FAQs to see about moving binaries across computers.]

I want relocatable I guess -- as a starting point. I want openGL... did I see that I need special flags for that too? I want everything useful -- is there a flag for that? ;)

Before I start manually hacking and breaking Makefiles (which I haven't touched in 10 years), any tips you can offer?

I tried mingw as an alternative to cygwin (for lack of guidance), but in the middle of the compilation (of gnu smalltalk) the process failed saying nothing more than "gst-tool failed", and I see "[] Error 255.". Subsequent executions fail with the same error.
I concur with the guy that said it takes too long to build. I am on a fast computer with times running at one-third of his times [see some post on this site], but it is still painfully slow. I have just killed over four hours (between downloading cygwin, failed attempts at compiling, and waiting for an informative reply here) and I have no idea how much longer it will take to actually get it compiled, let alone working.

Thanks in advance,

Cygwin and mingw support broke recently, but it's on my todo list, and pretty high. Regarding the time it takes to build, I'll use Autoconf 2.64 (unreleased) for the next release, which will speed up noticeable (~30%) the configure time.

While trying to build 3.1 under the most recent version of Cygwin, I encountered a memory problem. This problem can arise on any platform where int is 32 bits and the getpagesize() function returns 65536.

Look at the function morecore(), found in the source file libgst/alloc.c. When the morecore function needs a new heap, it calls the function _gst_heap_create. In these _gst_heap_create calls, the macro MMAP_AREA_SIZE is used to specify the heap size. Now MMAP_AREA_SIZE is defined as

  #define MMAP_AREA_SIZE                (65536 * pagesize)

where pagesize is a static variable initialized with the getpagesize() function. Now if pagesize is 65536, MMAP_AREA_SIZE is 65536 * 65536, which is 0 when treated as a 32 bit integer. Hence we end up with heaps that are 0 bytes long, and any attempt to use these heaps will likely result in a segment fault.

Frank J. Lhota

thanks, paolo

In file included from interp.c:677:
interp-jit.inl: In function '_gst_interpret':
interp-jit.inl:383: error: 'jb' undeclared (first use in this function)
interp-jit.inl:383: error: (Each undeclared identifier is reported only once
interp-jit.inl:383: error: for each function it appears in.)
make[3]: *** [interp.lo] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

is this know problem of 3.1?

Thanks for the new release.

I got these errors while compiling on my windows machine: (part 1) (part 2)

My config sentence was:

$ ./configure --prefix=/small2 --bindir=/small2 --libdir=/small2 --with-moduledir=/small2/lib/smalltalk --with-tcl=/home/Canol/tcl8.4.19/win --with-tk=/home/Canol/tk8.4.19/win

Try using "gst_cv_opengl_libs='not found' ./configure --prefix=/small2 ...".


Please try adding

sockets_la_LIBADD = ../../lib-src/

to packages/sockets/ Also, please create an issue so that this conversation is tracked better and comments go to the mailing list too. Thanks!

User login