FFI examples on Linux don't work

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

FFI examples on Linux don't work

Annick
Hi,

I have posted a bug about this in fogbugz.
FFI example on Linux don’t work

X11Display coloredRectangles

raises an error « coud not coerce arguments ».
In fogbugz, I was asked to raise this question in the mailing list, to know if it comes from the VM or from FFI.

Annick
Reply | Threaded
Open this post in threaded view
|

Re: FFI examples on Linux don't work

Ben Coman
Annick Fron wrote:

> Hi,
>
> I have posted a bug about this in fogbugz.
> FFI example on Linux don’t work
>
> X11Display coloredRectangles
>
> raises an error « coud not coerce arguments ».
> In fogbugz, I was asked to raise this question in the mailing list, to know if it comes from the VM or from FFI.
>
> Annick
>
>  
Hi Annick,

Sorry I don't know anything about this topic to help, just a minor
observation that a link to the fogbugz issue would help streamline
things for someone who does.
:)
cheers -ben


Reply | Threaded
Open this post in threaded view
|

Re: FFI examples on Linux don't work

philippeback
I've been able to reproduce this.

Well, my CentOS thing requires me for some reason to put /usr/lib/libX11.so.6 in the module name (doing these kind of things looks like usual for lib names with FFI from what I saw from old Squeak threads).


XCreateGC: xDisplay with: aDrawable with: valueMask with: values
<cdecl: X11GC 'XCreateGC' (X11Display* X11Drawable ulong long*) module: '/usr/lib/libX11.so.6'>

Now, other internal FFIPrims tests do work.

So, it is X11 or something else, I do not know.

Phil


On Mon, Sep 22, 2014 at 4:39 PM, Ben Coman <[hidden email]> wrote:
Annick Fron wrote:
Hi,

I have posted a bug about this in fogbugz.
FFI example on Linux don’t work

X11Display coloredRectangles
raises an error « coud not coerce arguments ».
In fogbugz, I was asked to raise this question in the mailing list, to know if it comes from the VM or from FFI.

Annick

 
Hi Annick,
Sorry I don't know anything about this topic to help, just a minor observation that a link to the fogbugz issue would help streamline things for someone who does.
:)
cheers -ben




Reply | Threaded
Open this post in threaded view
|

Re: FFI examples on Linux don't work

philippeback
More on the story.

So, the X11 example may not be the best one to have in FFI. It is interesting but complicated.

A basic call, like:

Sample class>>callC: aString
<cdecl: short 'puts' (char*) module: '/lib/libc-2.12.so'>
^self externalCallFailed

works nicely.

Sample callC: 'Hello'.

prints Hello on stdout.

Phil



On Mon, Sep 22, 2014 at 6:10 PM, [hidden email] <[hidden email]> wrote:
I've been able to reproduce this.

Well, my CentOS thing requires me for some reason to put /usr/lib/libX11.so.6 in the module name (doing these kind of things looks like usual for lib names with FFI from what I saw from old Squeak threads).


XCreateGC: xDisplay with: aDrawable with: valueMask with: values
<cdecl: X11GC 'XCreateGC' (X11Display* X11Drawable ulong long*) module: '/usr/lib/libX11.so.6'>

Now, other internal FFIPrims tests do work.

So, it is X11 or something else, I do not know.

Phil


On Mon, Sep 22, 2014 at 4:39 PM, Ben Coman <[hidden email]> wrote:
Annick Fron wrote:
Hi,

I have posted a bug about this in fogbugz.
FFI example on Linux don’t work

X11Display coloredRectangles
raises an error « coud not coerce arguments ».
In fogbugz, I was asked to raise this question in the mailing list, to know if it comes from the VM or from FFI.

Annick

 
Hi Annick,
Sorry I don't know anything about this topic to help, just a minor observation that a link to the fogbugz issue would help streamline things for someone who does.
:)
cheers -ben





Reply | Threaded
Open this post in threaded view
|

Re: FFI examples on Linux don't work

philippeback

On Mon, Sep 22, 2014 at 6:50 PM, [hidden email] <[hidden email]> wrote:
More on the story.

So, the X11 example may not be the best one to have in FFI. It is interesting but complicated.

A basic call, like:

Sample class>>callC: aString
<cdecl: short 'puts' (char*) module: '/lib/libc-2.12.so'>
^self externalCallFailed

works nicely.

Sample callC: 'Hello'.

prints Hello on stdout.

Phil



On Mon, Sep 22, 2014 at 6:10 PM, [hidden email] <[hidden email]> wrote:
I've been able to reproduce this.

Well, my CentOS thing requires me for some reason to put /usr/lib/libX11.so.6 in the module name (doing these kind of things looks like usual for lib names with FFI from what I saw from old Squeak threads).


XCreateGC: xDisplay with: aDrawable with: valueMask with: values
<cdecl: X11GC 'XCreateGC' (X11Display* X11Drawable ulong long*) module: '/usr/lib/libX11.so.6'>

Now, other internal FFIPrims tests do work.

So, it is X11 or something else, I do not know.

Phil


On Mon, Sep 22, 2014 at 4:39 PM, Ben Coman <[hidden email]> wrote:
Annick Fron wrote:
Hi,

I have posted a bug about this in fogbugz.
FFI example on Linux don’t work

X11Display coloredRectangles
raises an error « coud not coerce arguments ».
In fogbugz, I was asked to raise this question in the mailing list, to know if it comes from the VM or from FFI.

Annick

 
Hi Annick,
Sorry I don't know anything about this topic to help, just a minor observation that a link to the fogbugz issue would help streamline things for someone who does.
:)
cheers -ben






Reply | Threaded
Open this post in threaded view
|

Re: FFI examples on Linux don't work

Nicolai Hess
In reply to this post by philippeback

2014-09-22 18:10 GMT+02:00 [hidden email] <[hidden email]>:
I've been able to reproduce this.

Well, my CentOS thing requires me for some reason to put /usr/lib/libX11.so.6 in the module name (doing these kind of things looks like usual for lib names with FFI from what I saw from old Squeak threads).

Yes, I read this threads too, I solved it by
LD_LIBRARY_PATH=<YOUR_PATH_TO_X11> ./pharo ....

but no matter which of this (LD_LIBRARY_PATH or full name in the ffi pragma) the call throws the
"could not coerce arguments"- error.

But the Sample class>>callC: method you wrote in the other mail works.



XCreateGC: xDisplay with: aDrawable with: valueMask with: values
<cdecl: X11GC 'XCreateGC' (X11Display* X11Drawable ulong long*) module: '/usr/lib/libX11.so.6'>

Now, other internal FFIPrims tests do work.

So, it is X11 or something else, I do not know.

Phil


On Mon, Sep 22, 2014 at 4:39 PM, Ben Coman <[hidden email]> wrote:
Annick Fron wrote:
Hi,

I have posted a bug about this in fogbugz.
FFI example on Linux don’t work

X11Display coloredRectangles
raises an error « coud not coerce arguments ».
In fogbugz, I was asked to raise this question in the mailing list, to know if it comes from the VM or from FFI.

Annick

 
Hi Annick,
Sorry I don't know anything about this topic to help, just a minor observation that a link to the fogbugz issue would help streamline things for someone who does.
:)
cheers -ben





Reply | Threaded
Open this post in threaded view
|

Re: FFI examples on Linux don't work

Annick
Thanks you
The problem is I wanted to use X windows !
Otherwise I have managed to use FFI on Linux.
Perhaps there is a glitch when passing nil as argument. It is not clear whether we have to use nil or 0 (as a null pointer).
This is really my point, I sometimes need to pass NULL.
Annick

Le 22 sept. 2014 à 21:22, Nicolai Hess <[hidden email]> a écrit :


2014-09-22 18:10 GMT+02:00 [hidden email] <[hidden email]>:
I've been able to reproduce this.

Well, my CentOS thing requires me for some reason to put /usr/lib/libX11.so.6 in the module name (doing these kind of things looks like usual for lib names with FFI from what I saw from old Squeak threads).

Yes, I read this threads too, I solved it by
LD_LIBRARY_PATH=<YOUR_PATH_TO_X11> ./pharo ....

but no matter which of this (LD_LIBRARY_PATH or full name in the ffi pragma) the call throws the
"could not coerce arguments"- error.

But the Sample class>>callC: method you wrote in the other mail works.



XCreateGC: xDisplay with: aDrawable with: valueMask with: values
<cdecl: X11GC 'XCreateGC' (X11Display* X11Drawable ulong long*) module: '/usr/lib/libX11.so.6'>

Now, other internal FFIPrims tests do work.

So, it is X11 or something else, I do not know.

Phil


On Mon, Sep 22, 2014 at 4:39 PM, Ben Coman <[hidden email]> wrote:
Annick Fron wrote:
Hi,

I have posted a bug about this in fogbugz.
FFI example on Linux don’t work

X11Display coloredRectangles
raises an error « coud not coerce arguments ».
In fogbugz, I was asked to raise this question in the mailing list, to know if it comes from the VM or from FFI.

Annick

 
Hi Annick,
Sorry I don't know anything about this topic to help, just a minor observation that a link to the fogbugz issue would help streamline things for someone who does.
:)
cheers -ben






Reply | Threaded
Open this post in threaded view
|

Re: FFI examples on Linux don't work

philippeback
I passed 'localhost:0:0' in the XWindows example and this gave me a window reference.

The next problem was that it broke after that. But I got the handle.

Try with that, it may help.

Phil


On Mon, Sep 22, 2014 at 10:02 PM, Annick Fron <[hidden email]> wrote:
Thanks you
The problem is I wanted to use X windows !
Otherwise I have managed to use FFI on Linux.
Perhaps there is a glitch when passing nil as argument. It is not clear whether we have to use nil or 0 (as a null pointer).
This is really my point, I sometimes need to pass NULL.
Annick

Le 22 sept. 2014 à 21:22, Nicolai Hess <[hidden email]> a écrit :


2014-09-22 18:10 GMT+02:00 [hidden email] <[hidden email]>:
I've been able to reproduce this.

Well, my CentOS thing requires me for some reason to put /usr/lib/libX11.so.6 in the module name (doing these kind of things looks like usual for lib names with FFI from what I saw from old Squeak threads).

Yes, I read this threads too, I solved it by
LD_LIBRARY_PATH=<YOUR_PATH_TO_X11> ./pharo ....

but no matter which of this (LD_LIBRARY_PATH or full name in the ffi pragma) the call throws the
"could not coerce arguments"- error.

But the Sample class>>callC: method you wrote in the other mail works.



XCreateGC: xDisplay with: aDrawable with: valueMask with: values
<cdecl: X11GC 'XCreateGC' (X11Display* X11Drawable ulong long*) module: '/usr/lib/libX11.so.6'>

Now, other internal FFIPrims tests do work.

So, it is X11 or something else, I do not know.

Phil


On Mon, Sep 22, 2014 at 4:39 PM, Ben Coman <[hidden email]> wrote:
Annick Fron wrote:
Hi,

I have posted a bug about this in fogbugz.
FFI example on Linux don’t work

X11Display coloredRectangles
raises an error « coud not coerce arguments ».
In fogbugz, I was asked to raise this question in the mailing list, to know if it comes from the VM or from FFI.

Annick

 
Hi Annick,
Sorry I don't know anything about this topic to help, just a minor observation that a link to the fogbugz issue would help streamline things for someone who does.
:)
cheers -ben







Reply | Threaded
Open this post in threaded view
|

Re: FFI examples on Linux don't work

Nicolai Hess
Ah, got the examples working :)

I replaced all X11Drawable arguments in the ffi call signature to ulong
and replace the call ... drawable ... with ... drawable xid ...

attached is the changeset
(who maintains the FFI-Package and  the X11 examples?)




2014-09-22 23:10 GMT+02:00 [hidden email] <[hidden email]>:
I passed 'localhost:0:0' in the XWindows example and this gave me a window reference.

The next problem was that it broke after that. But I got the handle.

Try with that, it may help.

Phil


On Mon, Sep 22, 2014 at 10:02 PM, Annick Fron <[hidden email]> wrote:
Thanks you
The problem is I wanted to use X windows !
Otherwise I have managed to use FFI on Linux.
Perhaps there is a glitch when passing nil as argument. It is not clear whether we have to use nil or 0 (as a null pointer).
This is really my point, I sometimes need to pass NULL.
Annick

Le 22 sept. 2014 à 21:22, Nicolai Hess <[hidden email]> a écrit :


2014-09-22 18:10 GMT+02:00 [hidden email] <[hidden email]>:
I've been able to reproduce this.

Well, my CentOS thing requires me for some reason to put /usr/lib/libX11.so.6 in the module name (doing these kind of things looks like usual for lib names with FFI from what I saw from old Squeak threads).

Yes, I read this threads too, I solved it by
LD_LIBRARY_PATH=<YOUR_PATH_TO_X11> ./pharo ....

but no matter which of this (LD_LIBRARY_PATH or full name in the ffi pragma) the call throws the
"could not coerce arguments"- error.

But the Sample class>>callC: method you wrote in the other mail works.



XCreateGC: xDisplay with: aDrawable with: valueMask with: values
<cdecl: X11GC 'XCreateGC' (X11Display* X11Drawable ulong long*) module: '/usr/lib/libX11.so.6'>

Now, other internal FFIPrims tests do work.

So, it is X11 or something else, I do not know.

Phil


On Mon, Sep 22, 2014 at 4:39 PM, Ben Coman <[hidden email]> wrote:
Annick Fron wrote:
Hi,

I have posted a bug about this in fogbugz.
FFI example on Linux don’t work

X11Display coloredRectangles
raises an error « coud not coerce arguments ».
In fogbugz, I was asked to raise this question in the mailing list, to know if it comes from the VM or from FFI.

Annick

 
Hi Annick,
Sorry I don't know anything about this topic to help, just a minor observation that a link to the fogbugz issue would help streamline things for someone who does.
:)
cheers -ben









ffi_xwindow_examples.cs (8K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: FFI examples on Linux don't work

CdAB63
In reply to this post by philippeback
Sometimes the problem is that you have Linux x86_64 and only the 64bit libraries. When using squeak it is necessary to have the proper 32bit libraries to have the system working.

On 22-09-2014 18:10, [hidden email] wrote:
I passed 'localhost:0:0' in the XWindows example and this gave me a window reference.

The next problem was that it broke after that. But I got the handle.

Try with that, it may help.

Phil


On Mon, Sep 22, 2014 at 10:02 PM, Annick Fron <[hidden email]> wrote:
Thanks you
The problem is I wanted to use X windows !
Otherwise I have managed to use FFI on Linux.
Perhaps there is a glitch when passing nil as argument. It is not clear whether we have to use nil or 0 (as a null pointer).
This is really my point, I sometimes need to pass NULL.
Annick

Le 22 sept. 2014 à 21:22, Nicolai Hess <[hidden email]> a écrit :


2014-09-22 18:10 GMT+02:00 [hidden email] <[hidden email]>:
I've been able to reproduce this.

Well, my CentOS thing requires me for some reason to put /usr/lib/libX11.so.6 in the module name (doing these kind of things looks like usual for lib names with FFI from what I saw from old Squeak threads).

Yes, I read this threads too, I solved it by
LD_LIBRARY_PATH=<YOUR_PATH_TO_X11> ./pharo ....

but no matter which of this (LD_LIBRARY_PATH or full name in the ffi pragma) the call throws the
"could not coerce arguments"- error.

But the Sample class>>callC: method you wrote in the other mail works.



XCreateGC: xDisplay with: aDrawable with: valueMask with: values
<cdecl: X11GC 'XCreateGC' (X11Display* X11Drawable ulong long*) module: '/usr/lib/libX11.so.6'>

Now, other internal FFIPrims tests do work.

So, it is X11 or something else, I do not know.

Phil


On Mon, Sep 22, 2014 at 4:39 PM, Ben Coman <[hidden email]> wrote:
Annick Fron wrote:
Hi,

I have posted a bug about this in fogbugz.
FFI example on Linux don’t work

X11Display coloredRectangles
raises an error « coud not coerce arguments ».
In fogbugz, I was asked to raise this question in the mailing list, to know if it comes from the VM or from FFI.

Annick

 
Hi Annick,
Sorry I don't know anything about this topic to help, just a minor observation that a link to the fogbugz issue would help streamline things for someone who does.
:)
cheers -ben









signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: FFI examples on Linux don't work

philippeback


I've got the 32 bit ones. I checked.

Nicolas got it working, I'll check.

Phil
 


On Tue, Sep 23, 2014 at 12:32 AM, Casimiro de Almeida Barreto <[hidden email]> wrote:
Sometimes the problem is that you have Linux x86_64 and only the 64bit libraries. When using squeak it is necessary to have the proper 32bit libraries to have the system working.

On 22-09-2014 18:10, [hidden email] wrote:
I passed 'localhost:0:0' in the XWindows example and this gave me a window reference.

The next problem was that it broke after that. But I got the handle.

Try with that, it may help.

Phil


On Mon, Sep 22, 2014 at 10:02 PM, Annick Fron <[hidden email]> wrote:
Thanks you
The problem is I wanted to use X windows !
Otherwise I have managed to use FFI on Linux.
Perhaps there is a glitch when passing nil as argument. It is not clear whether we have to use nil or 0 (as a null pointer).
This is really my point, I sometimes need to pass NULL.
Annick

Le 22 sept. 2014 à 21:22, Nicolai Hess <[hidden email]> a écrit :


2014-09-22 18:10 GMT+02:00 [hidden email] <[hidden email]>:
I've been able to reproduce this.

Well, my CentOS thing requires me for some reason to put /usr/lib/libX11.so.6 in the module name (doing these kind of things looks like usual for lib names with FFI from what I saw from old Squeak threads).

Yes, I read this threads too, I solved it by
LD_LIBRARY_PATH=<YOUR_PATH_TO_X11> ./pharo ....

but no matter which of this (LD_LIBRARY_PATH or full name in the ffi pragma) the call throws the
"could not coerce arguments"- error.

But the Sample class>>callC: method you wrote in the other mail works.



XCreateGC: xDisplay with: aDrawable with: valueMask with: values
<cdecl: X11GC 'XCreateGC' (X11Display* X11Drawable ulong long*) module: '/usr/lib/libX11.so.6'>

Now, other internal FFIPrims tests do work.

So, it is X11 or something else, I do not know.

Phil


On Mon, Sep 22, 2014 at 4:39 PM, Ben Coman <[hidden email]> wrote:
Annick Fron wrote:
Hi,

I have posted a bug about this in fogbugz.
FFI example on Linux don’t work

X11Display coloredRectangles
raises an error « coud not coerce arguments ».
In fogbugz, I was asked to raise this question in the mailing list, to know if it comes from the VM or from FFI.

Annick

 
Hi Annick,
Sorry I don't know anything about this topic to help, just a minor observation that a link to the fogbugz issue would help streamline things for someone who does.
:)
cheers -ben









Reply | Threaded
Open this post in threaded view
|

Re: FFI examples on Linux don't work

Annick
Thank you your examples work for me as well, and it’s pretty fast drawing !
Annick
Le 23 sept. 2014 à 01:04, [hidden email] a écrit :



I've got the 32 bit ones. I checked.

Nicolas got it working, I'll check.

Phil
 


On Tue, Sep 23, 2014 at 12:32 AM, Casimiro de Almeida Barreto <[hidden email]> wrote:
Sometimes the problem is that you have Linux x86_64 and only the 64bit libraries. When using squeak it is necessary to have the proper 32bit libraries to have the system working.

On 22-09-2014 18:10, [hidden email] wrote:
I passed 'localhost:0:0' in the XWindows example and this gave me a window reference.

The next problem was that it broke after that. But I got the handle.

Try with that, it may help.

Phil


On Mon, Sep 22, 2014 at 10:02 PM, Annick Fron <[hidden email]> wrote:
Thanks you
The problem is I wanted to use X windows !
Otherwise I have managed to use FFI on Linux.
Perhaps there is a glitch when passing nil as argument. It is not clear whether we have to use nil or 0 (as a null pointer).
This is really my point, I sometimes need to pass NULL.
Annick

Le 22 sept. 2014 à 21:22, Nicolai Hess <[hidden email]> a écrit :


2014-09-22 18:10 GMT+02:00 [hidden email] <[hidden email]>:
I've been able to reproduce this.

Well, my CentOS thing requires me for some reason to put /usr/lib/libX11.so.6 in the module name (doing these kind of things looks like usual for lib names with FFI from what I saw from old Squeak threads).

Yes, I read this threads too, I solved it by
LD_LIBRARY_PATH=<YOUR_PATH_TO_X11> ./pharo ....

but no matter which of this (LD_LIBRARY_PATH or full name in the ffi pragma) the call throws the
"could not coerce arguments"- error.

But the Sample class>>callC: method you wrote in the other mail works.



XCreateGC: xDisplay with: aDrawable with: valueMask with: values
<cdecl: X11GC 'XCreateGC' (X11Display* X11Drawable ulong long*) module: '/usr/lib/libX11.so.6'>

Now, other internal FFIPrims tests do work.

So, it is X11 or something else, I do not know.

Phil


On Mon, Sep 22, 2014 at 4:39 PM, Ben Coman <[hidden email]> wrote:
Annick Fron wrote:
Hi,

I have posted a bug about this in fogbugz.
FFI example on Linux don’t work

X11Display coloredRectangles
raises an error « coud not coerce arguments ».
In fogbugz, I was asked to raise this question in the mailing list, to know if it comes from the VM or from FFI.

Annick

 
Hi Annick,
Sorry I don't know anything about this topic to help, just a minor observation that a link to the fogbugz issue would help streamline things for someone who does.
:)
cheers -ben