adding external plugins to Squeak 4.2 on the Mac

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

adding external plugins to Squeak 4.2 on the Mac

ccrraaiigg
 

Hi--

     I'm adapting the Spoon remote-browsing support for Squeak 4.2. I
use an external plugin (Flow). On the Mac, if I build a stock 4.2 VM
myself and add my Flow bundle to the Resources folder, it works. If I
add the Flow bundle to the Resource folder of the offically-built VM, it
doesn't work. Is the released VM binary expecting external plugin
bundles to be special in some way?

     Looking at the other bundles that are included with the release VM,
all I notice is that they are universal binaries (the executable files
start with 0xCAFEBABE). I'm building the Flow bundle with Xcode 4, which
apparently no longer supports universal binaries by default (so I'm just
making a Mach-o i386 bundle). Is this a problem? (That would be weird,
for the VM to want a plugin to have code for an architecture other than
the current one.)

     The minimal Spoon object memory requires a special VM, but I'd
rather not make Squeak 4.2 memories that are browsing it have to use a
special VM (just the Flow plugin).


     thanks,

-C

--
Craig Latta
www.netjam.org/resume
+31   6 2757 7177
+ 1 415  287 3547

Reply | Threaded
Open this post in threaded view
|

Re: adding external plugins to Squeak 4.2 on the Mac

Igor Stasenko

On 17 July 2011 06:11, Craig Latta <[hidden email]> wrote:

>
>
> Hi--
>
>     I'm adapting the Spoon remote-browsing support for Squeak 4.2. I
> use an external plugin (Flow). On the Mac, if I build a stock 4.2 VM
> myself and add my Flow bundle to the Resources folder, it works. If I
> add the Flow bundle to the Resource folder of the offically-built VM, it
> doesn't work. Is the released VM binary expecting external plugin
> bundles to be special in some way?
>

do you rename you plugin? because if i remember correctly there's a
check that module name (compiled into a plugin)
should be same as library file name. Otherwise VM refuses to use it.

>     Looking at the other bundles that are included with the release VM,
> all I notice is that they are universal binaries (the executable files
> start with 0xCAFEBABE). I'm building the Flow bundle with Xcode 4, which
> apparently no longer supports universal binaries by default (so I'm just
> making a Mach-o i386 bundle). Is this a problem? (That would be weird,
> for the VM to want a plugin to have code for an architecture other than
> the current one.)
>
no i don't think that it requires universal one.

>     The minimal Spoon object memory requires a special VM, but I'd
> rather not make Squeak 4.2 memories that are browsing it have to use a
> special VM (just the Flow plugin).
>
>

And again, problem with loading plugins is pain in the ass. We should
create an interface where language side
could instruct VM to load modules explicitly with good error reporting
(if plugin cannot be loaded).
Because currently it is always like that: sometimes works, sometimes
dont and you don't have a clue why.

>     thanks,
>
> -C
>
> --
> Craig Latta
> www.netjam.org/resume
> +31   6 2757 7177
> + 1 415  287 3547


--
Best regards,
Igor Stasenko AKA sig.
Reply | Threaded
Open this post in threaded view
|

Re: adding external plugins to Squeak 4.2 on the Mac

ccrraaiigg
 

Hi--

     Igor writes:

> > I'm adapting the Spoon remote-browsing support for Squeak 4.2. I
> > use an external plugin (Flow). On the Mac, if I build a stock 4.2 VM
> > myself and add my Flow bundle to the Resources folder, it works. If
> > I add the Flow bundle to the Resource folder of the offically-built
> > VM, it doesn't work.
>
> do you rename you plugin? because if i remember correctly there's a
> check that module name (compiled into a plugin) should be same as
> library file name. Otherwise VM refuses to use it.

     Well, that wouldn't explain why the unmodified 4.2 VM that I built
myself works; it's the same external primitives code.

> And again, problem with loading plugins is pain in the ass. We should
> create an interface where language side could instruct VM to load
> modules explicitly with good error reporting (if plugin cannot be
> loaded).

     Yeah, there actually is decent error-reporting code in the Mac VM,
but it requires a rather obscure flag to be set in order to run. When I
build a VM I always remove the check and force it to run all the time.

     Well, I guess I need the very person who built the release VM to
tell me why it won't load my plugin (by using a debugger with access to
the source file paths mentioned in the debugging symbols). This appears
to be John McIntosh. John, would you please grab [1] and let me know?


     thanks!

-C

[1] http://dl.dropbox.com/u/15188004/Flow%20test.zip

--
Craig Latta
www.netjam.org/resume
+31   6 2757 7177
+ 1 415  287 3547


Reply | Threaded
Open this post in threaded view
|

Re: adding external plugins to Squeak 4.2 on the Mac

johnmci

Craig one reason a plugin won't load is an issue with the major/minor
version numbers in the headers.
There could be disagreement there and you would need to check what is
compiled into the VM versus what is in your plugin.
see what #define VM_PROXY_MINOR  is

also see notes form June 16th  "[Vm-dev] Re: heads-up on
sqVirtualMachine harmonization"

Failure via

/* Note: This is coded so that is can be run from Squeak. */

EXPORT(sqInt) setInterpreter(struct VirtualMachine* anInterpreter) {
    sqInt ok;

        interpreterProxy = anInterpreter;
        ok = interpreterProxy->majorVersion() == VM_PROXY_MAJOR;
        if (ok == 0) {
                return 0;
        }
        ok = interpreterProxy->minorVersion() >= VM_PROXY_MINOR;
        return ok;
}



On Sun, Jul 17, 2011 at 12:31 AM, Craig Latta <[hidden email]> wrote:

>
>
> Hi--
>
>     Igor writes:
>
>> > I'm adapting the Spoon remote-browsing support for Squeak 4.2. I
>> > use an external plugin (Flow). On the Mac, if I build a stock 4.2 VM
>> > myself and add my Flow bundle to the Resources folder, it works. If
>> > I add the Flow bundle to the Resource folder of the offically-built
>> > VM, it doesn't work.
>>
>> do you rename you plugin? because if i remember correctly there's a
>> check that module name (compiled into a plugin) should be same as
>> library file name. Otherwise VM refuses to use it.
>
>     Well, that wouldn't explain why the unmodified 4.2 VM that I built
> myself works; it's the same external primitives code.
>
>> And again, problem with loading plugins is pain in the ass. We should
>> create an interface where language side could instruct VM to load
>> modules explicitly with good error reporting (if plugin cannot be
>> loaded).
>
>     Yeah, there actually is decent error-reporting code in the Mac VM,
> but it requires a rather obscure flag to be set in order to run. When I
> build a VM I always remove the check and force it to run all the time.
>
>     Well, I guess I need the very person who built the release VM to
> tell me why it won't load my plugin (by using a debugger with access to
> the source file paths mentioned in the debugging symbols). This appears
> to be John McIntosh. John, would you please grab [1] and let me know?
>
>
>     thanks!
>
> -C
>
> [1] http://dl.dropbox.com/u/15188004/Flow%20test.zip
>
> --
> Craig Latta
> www.netjam.org/resume
> +31 6 2757 7177
> + 1 415 287 3547
>
>
>



--
===========================================================================
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================
Reply | Threaded
Open this post in threaded view
|

Re: adding external plugins to Squeak 4.2 on the Mac

ccrraaiigg
 

Hi John (and Esteban :) --

     Cool, that was it! I'm embarrassed I'd forgotten about that. I
still have no idea what the release Mac VM binary has for VM_PROXY_MAJOR
and VM_PROXY_MINOR, though, I just removed the check entirely from my
plugin. :)

     So... clearly there should be some way for plugin authors to be
able to check those values on a VM that someone else built? A
command-line argument, perhaps? I didn't see one mentioned by running
the VM with -help, but I guess I'll check the sources now, to be sure...
at any rate it should be mentioned in the help message.

     Sorry if I'm duplicating any previous discussion.


     thanks again,

-C

--
Craig Latta
www.netjam.org/resume
+31   6 2757 7177
+ 1 415  287 3547


Reply | Threaded
Open this post in threaded view
|

Re: adding external plugins to Squeak 4.2 on the Mac

ccrraaiigg
 

> I still have no idea what the release Mac VM binary has for
> VM_PROXY_MAJOR and VM_PROXY_MINOR, though...

     Hm, I should wake up before posting. :)  Of course I could step
through my plugin in Xcode to see this info, but it would still be nice
to be able to get it from the command line.


     thanks again,

-C

--
Craig Latta
www.netjam.org/resume
+31   6 2757 7177
+ 1 415  287 3547


Reply | Threaded
Open this post in threaded view
|

Re: adding external plugins to Squeak 4.2 on the Mac

Mariano Martinez Peck
 
Graig, I am almost sure you did it, but be sure that the flag SqueakPluginsBuiltInOrLocalOnly in Info.plist  is false.




On Sun, Jul 17, 2011 at 12:46 PM, Craig Latta <[hidden email]> wrote:


> I still have no idea what the release Mac VM binary has for
> VM_PROXY_MAJOR and VM_PROXY_MINOR, though...

    Hm, I should wake up before posting. :)  Of course I could step
through my plugin in Xcode to see this info, but it would still be nice
to be able to get it from the command line.


    thanks again,

-C

--
Craig Latta
www.netjam.org/resume
<a href="tel:%2B31%20%20%206%202757%207177" value="+31627577177">+31 6 2757 7177
<a href="tel:%2B%201%20415%20%20287%203547" value="+14152873547">+ 1 415 287 3547





--
Mariano
http://marianopeck.wordpress.com

Reply | Threaded
Open this post in threaded view
|

Re: adding external plugins to Squeak 4.2 on the Mac

ccrraaiigg
 

> ...I am almost sure you did it, but be sure that the flag
> SqueakPluginsBuiltInOrLocalOnly in Info.plist  is false.

     Yeah, I did that first, but it was the version info issue that John
mentioned earlier.


     thanks,

-C

--
Craig Latta
www.netjam.org/resume
+31   6 2757 7177
+ 1 415  287 3547


Reply | Threaded
Open this post in threaded view
|

Re: adding external plugins to Squeak 4.2 on the Mac

David T. Lewis
In reply to this post by ccrraaiigg
 
On Sun, Jul 17, 2011 at 11:57:54AM +0200, Craig Latta wrote:

>  
>
> Hi John (and Esteban :) --
>
>      Cool, that was it! I'm embarrassed I'd forgotten about that. I
> still have no idea what the release Mac VM binary has for VM_PROXY_MAJOR
> and VM_PROXY_MINOR, though, I just removed the check entirely from my
> plugin. :)
>
>      So... clearly there should be some way for plugin authors to be
> able to check those values on a VM that someone else built? A
> command-line argument, perhaps? I didn't see one mentioned by running
> the VM with -help, but I guess I'll check the sources now, to be sure...
> at any rate it should be mentioned in the help message.
Craig,

This seems like a pretty good idea to me. Now that you mention it, I'm
surprised no one thought to do this before. Attached change set provides
primitives that answer the VM_PROXY_MAJOR and VM_PROXY_MINOR for the VM,
as well as for plugins (internal or external). If this looks good, I'll
add it to VMMaker trunk (it should work for oscog also).

Dave


VMM-InterpreterProxyVersion-dtl.1.cs (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: adding external plugins to Squeak 4.2 on the Mac

Eliot Miranda-2

Hi David,

On Sun, Jul 17, 2011 at 12:25 PM, David T. Lewis <[hidden email]> wrote:

>
> On Sun, Jul 17, 2011 at 11:57:54AM +0200, Craig Latta wrote:
>>
>>
>> Hi John (and Esteban :) --
>>
>>      Cool, that was it! I'm embarrassed I'd forgotten about that. I
>> still have no idea what the release Mac VM binary has for VM_PROXY_MAJOR
>> and VM_PROXY_MINOR, though, I just removed the check entirely from my
>> plugin. :)
>>
>>      So... clearly there should be some way for plugin authors to be
>> able to check those values on a VM that someone else built? A
>> command-line argument, perhaps? I didn't see one mentioned by running
>> the VM with -help, but I guess I'll check the sources now, to be sure...
>> at any rate it should be mentioned in the help message.
>
> Craig,
>
> This seems like a pretty good idea to me. Now that you mention it, I'm
> surprised no one thought to do this before. Attached change set provides
> primitives that answer the VM_PROXY_MAJOR and VM_PROXY_MINOR for the VM,
> as well as for plugins (internal or external). If this looks good, I'll
> add it to VMMaker trunk (it should work for oscog also).

I don't think this meets the usecase.  One may not be able to run an
image of certain plugins cannot be loaded, so providing an accessor
which requires a functional image is insufficient.  Craig asks for a
cmmand-line switch and that's reasonably easy to do, and seems to me
to be the right approach.  On the other hand, adding vm parameters or
system attributes that answer VM_PROXY_MAJOR and VM_PROXY_MINOR seems
reasonable.  Personally I don't like adding endless primitives (those
strings add up in space) when existing query facilities are extensible
and easily extended (such as getSystemAttribute: and vmParameterAt:).
Adding an accessor that wraps the getSystemAttribute:/vmParameterAt:
is fine and overall the extension plus the wrapper requires less space
than adding a long-named primitive (whose name is in the list of
registered internal named primitives, along with the space overhead of
the entry), the symbol name for the primitive in the image plus the
primitive method.

Parsimony is a virtue, or as my grandmother used to say, many a mickle
makes a muckle.


Eliot

>
> Dave
>
>
>



--
best,
Eliot
Reply | Threaded
Open this post in threaded view
|

Re: adding external plugins to Squeak 4.2 on the Mac

David T. Lewis
 
On Sun, Jul 17, 2011 at 12:57:44PM -0700, Eliot Miranda wrote:
>
> Parsimony is a virtue, or as my grandmother used to say, many a mickle
> makes a muckle.

I like your grandmother's point of view. A good deal of useful
guidance packed into six words :)

Dave

Reply | Threaded
Open this post in threaded view
|

Re: adding external plugins to Squeak 4.2 on the Mac

Nicolas Cellier
 
But wiktionary says your grand mother does not use the academically correct form:

http://en.wiktionary.org/wiki/many_a_mickle_makes_a_muckle

Though maybe only French love bureaucracy enough to pay an academy for defining correct usage of language ;)

Nicolas

2011/7/17 David T. Lewis <[hidden email]>

On Sun, Jul 17, 2011 at 12:57:44PM -0700, Eliot Miranda wrote:
>
> Parsimony is a virtue, or as my grandmother used to say, many a mickle
> makes a muckle.

I like your grandmother's point of view. A good deal of useful
guidance packed into six words :)

Dave


Reply | Threaded
Open this post in threaded view
|

Re: adding external plugins to Squeak 4.2 on the Mac

Bert Freudenberg
In reply to this post by ccrraaiigg


On 17.07.2011, at 11:57, Craig Latta wrote:

>
>
> Hi John (and Esteban :) --
>
>     Cool, that was it! I'm embarrassed I'd forgotten about that. I
> still have no idea what the release Mac VM binary has for VM_PROXY_MAJOR
> and VM_PROXY_MINOR, though, I just removed the check entirely from my
> plugin. :)
>
>     So... clearly there should be some way for plugin authors to be
> able to check those values on a VM that someone else built?

Just declare the minimal version your plugin expects. It is *right* that the VM will refuse to load a plugin that needs a newer interface. Similary, the plugin should not try to run on a VM that is missing functions the plugin needs.

I don't remember if the check is in the VM or the Plugin or both, but that's the way it's supposed to work.

Of course, there should be some meaningful error reporting if versions don't agree.

- Bert -

> A
> command-line argument, perhaps? I didn't see one mentioned by running
> the VM with -help, but I guess I'll check the sources now, to be sure...
> at any rate it should be mentioned in the help message.
>
>     Sorry if I'm duplicating any previous discussion.
>
>
>     thanks again,
>
> -C
>
> --
> Craig Latta
> www.netjam.org/resume
> +31   6 2757 7177
> + 1 415  287 3547
>
>


Reply | Threaded
Open this post in threaded view
|

Re: adding external plugins to Squeak 4.2 on the Mac

ccrraaiigg
 

Hi Bert--

> It is *right* that the VM will refuse to load...

     Right, right, I have no qualm with the policy. There should just be
a simple way for me to tell what some random VM is expecting, by a
simple query at the command line. I shouldn't even need an object
memory, much less get to the point of an error happening.


-C

--
Craig Latta
www.netjam.org/resume
+31   6 2757 7177
+ 1 415  287 3547


Reply | Threaded
Open this post in threaded view
|

Re: adding external plugins to Squeak 4.2 on the Mac

Eliot Miranda-2
 
How about a command-line argument that prints/answers a system attribute?  The system attributes are just strings, so they can be printed without loading an image etc.  It won't look as nice as myvm -printProxyversion, it'll look like myvm -sysattr 1010 -sysattr 1011, but it'll be general.

On Mon, Jul 18, 2011 at 5:51 PM, Craig Latta <[hidden email]> wrote:


Hi Bert--

> It is *right* that the VM will refuse to load...

    Right, right, I have no qualm with the policy. There should just be
a simple way for me to tell what some random VM is expecting, by a
simple query at the command line. I shouldn't even need an object
memory, much less get to the point of an error happening.


-C

--
Craig Latta
www.netjam.org/resume
<a href="tel:%2B31%20%20%206%202757%207177" value="+31627577177">+31 6 2757 7177
<a href="tel:%2B%201%20415%20%20287%203547" value="+14152873547">+ 1 415 287 3547





--
best,
Eliot

Reply | Threaded
Open this post in threaded view
|

Re: adding external plugins to Squeak 4.2 on the Mac

Stefan Marr
 
Hi:

On 19/07/11 02:59, Eliot Miranda wrote:
>  
>
> How about a command-line argument that prints/answers a system
> attribute?  The system attributes are just strings, so they can be
> printed without loading an image etc.  It won't look as nice as myvm
> -printProxyversion, it'll look like myvm -sysattr 1010 -sysattr 1011,
> but it'll be general.

Since I am currently again frustrated with 'someone else system', please
keep in mind that 'Sunday programmers' like me will understand
-printProxyversion without needing to search for it on the internet, but
sysattr 1011 is not directly useful, except if the command-line would
also provide a mechanism to translate that code to something understandable.

Thanks
Stefan


Reply | Threaded
Open this post in threaded view
|

Re: adding external plugins to Squeak 4.2 on the Mac

ccrraaiigg
 

Hi--

     Eliot writes:

> How about a command-line argument that prints/answers a system
> attribute?  The system attributes are just strings, so they can be
> printed without loading an image etc.  It won't look as nice as myvm
> -printProxyversion, it'll look like myvm -sysattr 1010 -sysattr 1011,
> but it'll be general.

     Stefan responds:

> Since I am currently again frustrated with 'someone else system',
> please keep in mind that 'Sunday programmers' like me will understand
> -printProxyversion without needing to search for it on the internet,
> but sysattr 1011 is not directly useful, except if the command-line
> would also provide a mechanism to translate that code to something
> understandable.

     I think it can be totally obscure, as long as -help makes it all clear.


     thanks again,

-C

--
Craig Latta
www.netjam.org/resume
+31   6 2757 7177
+ 1 415  287 3547


Reply | Threaded
Open this post in threaded view
|

Re: adding external plugins to Squeak 4.2 on the Mac

Igor Stasenko
In reply to this post by Stefan Marr

On 19 July 2011 09:55, Stefan Marr <[hidden email]> wrote:

>
> Hi:
>
> On 19/07/11 02:59, Eliot Miranda wrote:
>>
>>
>> How about a command-line argument that prints/answers a system attribute?
>>  The system attributes are just strings, so they can be printed without
>> loading an image etc.  It won't look as nice as myvm -printProxyversion,
>> it'll look like myvm -sysattr 1010 -sysattr 1011, but it'll be general.
>
> Since I am currently again frustrated with 'someone else system', please
> keep in mind that 'Sunday programmers' like me will understand
> -printProxyversion without needing to search for it on the internet, but
> sysattr 1011 is not directly useful, except if the command-line would also
> provide a mechanism to translate that code to something understandable.
>

Same for me. I don't see why it needs to be obscure, if we can use
symbolic names instead of numbers.
After all, we making these interfaces for humans, not for machine.

We have different positions on that with Eliot:
Eliot  adding new numbers by extending existing interface (to access
the system attributes).
While i think that it would be better to have primitives with
corresponding names, which explaining what attribute value it
returns and what it serves for.

IMO, saving developer's time is much better than saving few bytes in
VM binary (because of using numbers instead of name).

--
Best regards,
Igor Stasenko AKA sig.
Reply | Threaded
Open this post in threaded view
|

Re: adding external plugins to Squeak 4.2 on the Mac

Eliot Miranda-2
 
OK, then how about -printSysAttributes and include in the help that there's lots of useful info, and have the printing code include helpful text such as

interpreter proxy version major: 1 minor: 12

etc?

On Tue, Jul 19, 2011 at 7:12 AM, Igor Stasenko <[hidden email]> wrote:

On 19 July 2011 09:55, Stefan Marr <[hidden email]> wrote:
>
> Hi:
>
> On 19/07/11 02:59, Eliot Miranda wrote:
>>
>>
>> How about a command-line argument that prints/answers a system attribute?
>>  The system attributes are just strings, so they can be printed without
>> loading an image etc.  It won't look as nice as myvm -printProxyversion,
>> it'll look like myvm -sysattr 1010 -sysattr 1011, but it'll be general.
>
> Since I am currently again frustrated with 'someone else system', please
> keep in mind that 'Sunday programmers' like me will understand
> -printProxyversion without needing to search for it on the internet, but
> sysattr 1011 is not directly useful, except if the command-line would also
> provide a mechanism to translate that code to something understandable.
>

Same for me. I don't see why it needs to be obscure, if we can use
symbolic names instead of numbers.
After all, we making these interfaces for humans, not for machine.

We have different positions on that with Eliot:
Eliot  adding new numbers by extending existing interface (to access
the system attributes).
While i think that it would be better to have primitives with
corresponding names, which explaining what attribute value it
returns and what it serves for.

IMO, saving developer's time is much better than saving few bytes in
VM binary (because of using numbers instead of name).

--
Best regards,
Igor Stasenko AKA sig.



--
best,
Eliot

Reply | Threaded
Open this post in threaded view
|

[VM-dev] Names versus attribute numbers (was: Re: adding external plugins to Squeak 4.2 on the Mac)

David T. Lewis
In reply to this post by Igor Stasenko
 
On Tue, Jul 19, 2011 at 04:12:39PM +0200, Igor Stasenko wrote:

>
> On 19 July 2011 09:55, Stefan Marr <[hidden email]> wrote:
> >
> > Hi:
> >
> > On 19/07/11 02:59, Eliot Miranda wrote:
> >>
> >>
> >> How about a command-line argument that prints/answers a system attribute?
> >> ??The system attributes are just strings, so they can be printed without
> >> loading an image etc. ??It won't look as nice as myvm -printProxyversion,
> >> it'll look like myvm -sysattr 1010 -sysattr 1011, but it'll be general.
> >
> > Since I am currently again frustrated with 'someone else system', please
> > keep in mind that 'Sunday programmers' like me will understand
> > -printProxyversion without needing to search for it on the internet, but
> > sysattr 1011 is not directly useful, except if the command-line would also
> > provide a mechanism to translate that code to something understandable.
> >
>
> Same for me. I don't see why it needs to be obscure, if we can use
> symbolic names instead of numbers.
> After all, we making these interfaces for humans, not for machine.
>
> We have different positions on that with Eliot:
> Eliot  adding new numbers by extending existing interface (to access
> the system attributes).
> While i think that it would be better to have primitives with
> corresponding names, which explaining what attribute value it
> returns and what it serves for.
>
> IMO, saving developer's time is much better than saving few bytes in
> VM binary (because of using numbers instead of name).

I also prefer the explicit names, either named primitives or
command line parameters. To me the rationale is that system
attributes or vm parameters require an coordinated effort to
keep track of the assignments. That's fine for a small number
of developers, but it is not scalable as we move forward with
larger numbers of people doing creative development of VMs.

There are a few things that really do need to be coordinated
between the various VM projects, such as image format number
assignments to support new VMs and object memories. But this
kind of coordination is difficult to maintain, and requiring
agreement on trivial matters (such as "what is the meaning of
attribute nnn?") can inhibit progress for people trying to
advance their own work without waiting for agreement from
everyone else.

So in my view it is a good thing to use explicit names, even
if it does have some technical disadvantages.

Dave

12