Having FFI trouble with 4.2 on Linux

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

Having FFI trouble with 4.2 on Linux

Ken Causey-3

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:
...."

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

Reply | Threaded
Open this post in threaded view
|

Re: Having FFI trouble with 4.2 on Linux

Ken Causey-3

Correction: The slightly large so.SqueakFFIPrims in my self-built
4.4.7-2357 unix VM DOES NOT have any ffiTest* functions.  I apologize,
I'm starting to mix up the various cases I have tried.  The much larger
SqueakFFIPrims from Cog does have these.

Ken

Reply | Threaded
Open this post in threaded view
|

Re: Having FFI trouble with 4.2 on Linux

Tapple Gao
In reply to this post by Ken Causey-3

On Tue, May 24, 2011 at 5:22 PM, Ken Causey <[hidden email]> 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.
>
> 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.

My experience was much the same as ken's, but I got squeak errors
"unable to find function address" where he got segfaults. We also
tried the example distributed with ffi: X11Display coloredRectangles ,
with the same result (segfalt or externalCallFailed, specifically). I
think the reason we got different error messages is because he is
running a 64-bit system, and I a 32-bit system. Also, all tests worked
on cog. The X11 example gave a different error on cog: "External
module not found"

Why don't they work on the interpreter VM? I know they worked for me
before I upgraded ubuntu (from 10.04 to 11.04)
Reply | Threaded
Open this post in threaded view
|

Re: Having FFI trouble with 4.2 on Linux

David T. Lewis
In reply to this post by Ken Causey-3
 
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
Reply | Threaded
Open this post in threaded view
|

Re: Having FFI trouble with 4.2 on Linux

Levente Uzonyi-2
In reply to this post by Ken Causey-3
 
On Tue, 24 May 2011, Ken Causey wrote:

snip

> 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?

Yes, the implementation is different. IIRC it also includes debug symbols.


Levente

>
> Note that in all cases I repeated the entire process of installing the
> FFI packages manually.
>
> Ken
>
>