Using FFI on MacOSX

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

Using FFI on MacOSX

Nicolas Cellier
 
Its not obvious for a Mac newbie like me to get FFI running on MacOSX.
What I (re?) discovered is below. Please correct me if I'm wrong.

To vm maintainers : wouldn't it be a good idea to pass the flag ffiLoad to ioLoadModule() instead of relying only on a single global variable whether it is a plugin that is requested or not ?
This way we could have both secured/fast plugin loading and opened FFI (if distributed in the bundle). Unless there are other reasons unknown of me...

Nicolas

-----------------------------------------------------
Ah, some news!
In order to track and debug the problem with FFI, I built a VM.
(uneasy because latest svn xcodeproj is not exactly configured for a one click build...).

The problem is that most vm are configured to search for plugin only in squeak bundle
(global variable gSqueakPluginsBuiltInOrLocalOnly in files sqMain.c and sqMacUnixExternalPrims.c)
I guess this is to save time at startup (and batteries for iPhone...)
And also to get some more secure VM (can't load an invalid plugin from an older squeak vm).

Unfortunately, no difference is made between loading a squeak plugin and loading a FFI library...
There is a ffiLoad flag passed to findAndLoadModule() in sqNamedPrims.c
but not to subfunction ioLoadModule() in sqMacUnixExternalPrims.c... (a mistake IMHO)
So this setting is preventing FFI to work.

What you should do is change this setting:
- select your squeak vm in the finder.
- Then choose a menu item like "display package content" (it's a guess, my version is configured in french).
- Then edit the contents/info.plist with a property editor.
- Then uncheck the box corresponding to SqueakPluginsBuiltInOrLocalOnly and save properties

Then FFI should be operational again...
(But Smallapack may well crash, at least that's what happens here...)

I think I will CC squeak-dev/vm-dev to check If I this is the expected solution.

Nicolas
Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Using FFI on MacOSX

Mariano Martinez Peck
 


On Tue, Jul 20, 2010 at 10:22 PM, Nicolas Cellier <[hidden email]> wrote:
Its not obvious for a Mac newbie like me to get FFI running on MacOSX.
What I (re?) discovered is below. Please correct me if I'm wrong.

To vm maintainers : wouldn't it be a good idea to pass the flag ffiLoad to ioLoadModule() instead of relying only on a single global variable whether it is a plugin that is requested or not ?
This way we could have both secured/fast plugin loading and opened FFI (if distributed in the bundle). Unless there are other reasons unknown of me...



Nicolas, for SqueakDBX, I had to write this:

http://www.squeakdbx.org/Compiling%20and%20installing%20OpenDBX

where it says "Problems with Mac OS"

And yes, I agree it would be great to have the correct behavior by default. Hope John can do that.

Mariano

 
Nicolas

-----------------------------------------------------
Ah, some news!
In order to track and debug the problem with FFI, I built a VM.
(uneasy because latest svn xcodeproj is not exactly configured for a one click build...).

The problem is that most vm are configured to search for plugin only in squeak bundle
(global variable gSqueakPluginsBuiltInOrLocalOnly in files sqMain.c and sqMacUnixExternalPrims.c)
I guess this is to save time at startup (and batteries for iPhone...)
And also to get some more secure VM (can't load an invalid plugin from an older squeak vm).

Unfortunately, no difference is made between loading a squeak plugin and loading a FFI library...
There is a ffiLoad flag passed to findAndLoadModule() in sqNamedPrims.c
but not to subfunction ioLoadModule() in sqMacUnixExternalPrims.c... (a mistake IMHO)
So this setting is preventing FFI to work.

What you should do is change this setting:
- select your squeak vm in the finder.
- Then choose a menu item like "display package content" (it's a guess, my version is configured in french).
- Then edit the contents/info.plist with a property editor.
- Then uncheck the box corresponding to SqueakPluginsBuiltInOrLocalOnly and save properties

Then FFI should be operational again...
(But Smallapack may well crash, at least that's what happens here...)

I think I will CC squeak-dev/vm-dev to check If I this is the expected solution.

Nicolas




Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Using FFI on MacOSX

Nicolas Cellier
 
2010/7/21 Mariano Martinez Peck <[hidden email]>:

>
>
>
> On Tue, Jul 20, 2010 at 10:22 PM, Nicolas Cellier <[hidden email]> wrote:
>>
>> Its not obvious for a Mac newbie like me to get FFI running on MacOSX.
>> What I (re?) discovered is below. Please correct me if I'm wrong.
>>
>> To vm maintainers : wouldn't it be a good idea to pass the flag ffiLoad to ioLoadModule() instead of relying only on a single global variable whether it is a plugin that is requested or not ?
>> This way we could have both secured/fast plugin loading and opened FFI (if distributed in the bundle). Unless there are other reasons unknown of me...
>>
>
>
> Nicolas, for SqueakDBX, I had to write this:
>
> http://www.squeakdbx.org/Compiling%20and%20installing%20OpenDBX
>
> where it says "Problems with Mac OS"
>
> And yes, I agree it would be great to have the correct behavior by default. Hope John can do that.
>
> Mariano
>

Yes, that would be great.
The idea would be to just look in a reduced set of directories for
plugins but let Alien/FFI scan more...
One solution is to pass the flag ffiLoad to ioLoadModule()...

Nicolas

>
>>
>> Nicolas
>>
>> -----------------------------------------------------
>> Ah, some news!
>> In order to track and debug the problem with FFI, I built a VM.
>> (uneasy because latest svn xcodeproj is not exactly configured for a one click build...).
>>
>> The problem is that most vm are configured to search for plugin only in squeak bundle
>> (global variable gSqueakPluginsBuiltInOrLocalOnly in files sqMain.c and sqMacUnixExternalPrims.c)
>> I guess this is to save time at startup (and batteries for iPhone...)
>> And also to get some more secure VM (can't load an invalid plugin from an older squeak vm).
>>
>> Unfortunately, no difference is made between loading a squeak plugin and loading a FFI library...
>> There is a ffiLoad flag passed to findAndLoadModule() in sqNamedPrims.c
>> but not to subfunction ioLoadModule() in sqMacUnixExternalPrims.c... (a mistake IMHO)
>> So this setting is preventing FFI to work.
>>
>> What you should do is change this setting:
>> - select your squeak vm in the finder.
>> - Then choose a menu item like "display package content" (it's a guess, my version is configured in french).
>> - Then edit the contents/info.plist with a property editor.
>> - Then uncheck the box corresponding to SqueakPluginsBuiltInOrLocalOnly and save properties
>>
>> Then FFI should be operational again...
>> (But Smallapack may well crash, at least that's what happens here...)
>>
>> I think I will CC squeak-dev/vm-dev to check If I this is the expected solution.
>>
>> Nicolas
>>
>>
>
>
>