[Vm-dev] Having FFI trouble with 4.2 on Linux

David T. Lewis lewis at mail.msen.com
Tue May 24 22:25:41 UTC 2011


On Tue, May 24, 2011 at 02:22:32PM -0700, Ken Causey wrote:
> 
> Matthew on #squeak was having trouble with FFI on Ubuntu so I thought I
> would give it a try on my Debian Testing system.  I should note that I
> am on X86_64 while Matthew is on i386/i686.  I think Matthew will follow
> up with details about his experience.
> 
> First I've not been Squeaking much in some time so all I have handy on
> my current development system is a 4.2-all-in-one in case I want to help
> answer a #squeak question.  So I started out using this image and VM. 
> The image is the stock 4.2 image unmodified.
> 
> I added 'source.squeak.org/FFI' to Monticello and installed
> 
> http://source.squeak.org/FFI/FFI-Pools-eem.3.mcz
> http://source.squeak.org/FFI/FFI-Kernel-mtf.23.mcz
> http://source.squeak.org/FFI/FFI-Examples-ar.1.mcz
> http://source.squeak.org/FFI/FFI-Tests-jcg.4.mcz
> http://source.squeak.org/FFI/FFI-Unix-mtf.4.mcz
> 
> in that order.
> 
> In this configuration if I run the tests I get 1 success, 1 failure, and
> 21 errors.  In the process I also tried earlier -ar versions of the
> packages with much the same result.
> 
> Watching with strace it appears it is unable to find the ffiTest*
> symbols in the supplied so.SqueakFFIPrims and if I look at it with
> objdump they do not appear to be there.  Note that this file is only
> 23572 bytes in size.
> 
> Next I tried building 4.4.7-2357 (the latest Unix VM and the same
> distributed in the all-in-one) myself.  After a few fumbles I got that
> build with an FFI plugin but when I try the tests with that build the
> image immediately crashes:
> 
> "Segmentation fault
> 
> 24014104 ExternalFunction>invokeWith:with:with:with:
> 24011904 FFIPluginTests>testConstructedCharCall
> 24011812 TestCase>performTest
> 24011708 TestCase>runCase
> 24011616 BlockClosure>on:do:
> 24011524 TestCase>timeout:after:
> 24011432 BlockClosure>ensure:
> ...."

Since you are on X86_64, make sure that you are compiling your VM in
32-bit mode (-m32 compiler flag). FFI does not work on 64-bit platforms,
details at http://bugs.squeak.org/view.php?id=7237.

FYI, this can definitely be fixed (the patches were done a few years ago),
but I would frankly be reluctant to try taking it on right now because it
is a complex set of changes that must be coordinated in the platform support
code, slang, and images, and there are quite a lot of other things going
on with VMs these days, including Eliot's work on a new FFI.

The status of the 64-bit fixes and testing as of May 2008 is in the thread
at http://lists.squeakfoundation.org/pipermail/vm-dev/2008-May/001945.html

Dave

> 
> I can provide more info if desired.  Note that the so.SqueakFFIPrims
> with my own build is 38353 bytes in size and I can confirm it has the
> ffiTest* symbols.  I have not as of yet tested this with strace.
> 
> As part of the process I also tried cog 2382 and it works just fine, all
> the tests pass.  I simply downloaded the linux binary tgz, extracted it,
> and ran it in place with the very same 4.2 stock image.  Oh, and cog's
> SqueakFFIPrims is 260838 in bytes.  Totally different implementation?
> 
> Note that in all cases I repeated the entire process of installing the
> FFI packages manually.
> 
> Ken


More information about the Vm-dev mailing list