<div>Hi,</div><div><br></div><div>it seems that on Linux loading a library with FFI fails (rev 2135 -&gt; rev 2151). Bill submit a patch below. </div><div><br></div><div>Is this a known problem ?  </div><div><br></div><div>

Furthermore, the Linux VM I&#39;ve built for Pharo is rev. 2151 with 2 patchs (found on this mailing list)</div><div>- <a href="http://lolgzs.free.fr/pharo/ft2plugin.patch">http://lolgzs.free.fr/pharo/ft2plugin.patch</a> so FT2Plugin can be built</div>

<div>- <a href="http://lolgzs.free.fr/pharo/CFLAGS.patch">http://lolgzs.free.fr/pharo/CFLAGS.patch</a> for multiple CFLAGS options  to work</div><div><br></div><div>Are the above issues fixed in current trunk ? Maybe I forgot to read important things, it&#39;s not clear for me how to report bugs on squeak-vm and how to submit patchs...</div>

<div><br></div><div>Cheers,</div><br clear="all">Laurent Laffont<br>
<br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Schwab,Wilhelm K</b> <span dir="ltr">&lt;<a href="mailto:bschwab@anest.ufl.edu">bschwab@anest.ufl.edu</a>&gt;</span><br>

Date: Fri, Apr 9, 2010 at 12:11 AM<br>Subject: Re: [Pharo-project] Linux vm: assertions and strategy<br>To: &quot;<a href="mailto:Pharo-project@lists.gforge.inria.fr">Pharo-project@lists.gforge.inria.fr</a>&quot; &lt;<a href="mailto:Pharo-project@lists.gforge.inria.fr">Pharo-project@lists.gforge.inria.fr</a>&gt;<br>

<br><br>Laurent,<br>
<br>
The promised code for tryLoadModule(); it goes just before<br>
<br>
  if (!handle) {<br>
    struct stat buf;<br>
    if ((0 == stat(path, &amp;buf)) &amp;&amp; ! S_ISDIR(buf.st_mode))<br>
      fprintf(stderr, &quot;%s\n&quot;, dlerror());<br>
  }<br>
  return handle;<br>
<br>
Drop the fprintf() calls if you want - I know what was happening now?<br>
<br>
Bill<br>
<br>
========================<br>
<br>
<br>
  /*<br>
    wks - have not loaded a library?  Is the path absolute?  Use the name as given.<br>
  */<br>
  if( (!handle) &amp;&amp; ( (int)(name[0])==47 ) )<br>
  {<br>
     handle=dlopen(name, RTLD_NOW | RTLD_GLOBAL);<br>
     fprintf(stdout,&quot;WKS-load-by-name(%s) = %p\n&quot;, path,handle);<br>
  }<br>
  else {<br>
     if(!handle){<br>
        fprintf(stdout,&quot;WKS-refuse-load-by-name(%s) - not absolute path\n&quot;, path);<br>
     }<br>
  }<br>
<br>
<br>
<br>
________________________________________<br>
From: <a href="mailto:pharo-project-bounces@lists.gforge.inria.fr">pharo-project-bounces@lists.gforge.inria.fr</a> [<a href="mailto:pharo-project-bounces@lists.gforge.inria.fr">pharo-project-bounces@lists.gforge.inria.fr</a>] On Behalf Of Schwab,Wilhelm K [<a href="mailto:bschwab@anest.ufl.edu">bschwab@anest.ufl.edu</a>]<br>


Sent: Thursday, April 08, 2010 6:10 PM<br>
<div class="im">To: <a href="mailto:Pharo-project@lists.gforge.inria.fr">Pharo-project@lists.gforge.inria.fr</a><br>
Subject: Re: [Pharo-project] Linux vm: assertions and strategy<br>
<br>
Laurent,<br>
<br>
A part-time boss/full-time friend once advised me to &quot;get the machine to tell you what it&#39;s doing&quot; (I was doing just that at the time, but I&#39;ve never forgotten his advise&lt;g&gt;).<br>
<br>
I compiled your vm and then decided to stick some tracing code in strategic places to find what the vm thinks it is doing in trying to load unixODBC.  Get ready:<br>
<br>
     tryLoading(/sr/local/slib/squeak/3.11.13-/<a href="http://so.libodbc.so" target="_blank">so.libodbc.so</a>) = (nil)<br>
<br>
In short, it does not appear to recognize a difference between plugins (the names of which it twists around to avoid collisions with external libraries - that&#39;s fine) and external libraries that have been minding their own business for many clock cycles.  The latter deserve special attention.<br>


<br>
So I had an absolutely nutty idea: give dlopen() the name of the library as written :)  Clearly, that works only if one provides an absolute path in #moduleName, but (forgive/correct possible *nix-noob syndrome here) that is easy to test and even easier to do in the code.<br>


<br>
So, in sqUnixExternalPrims.c in the unix/vm directory, look near the end of tryLoadModule().  My proposed workaround is to add some code before the !handle test at the end.  I will send a cut-down version of it in a separate email.  Unless someone has a better idea, I suggest we make this change to you source to give people an opportunity to use external libraries: (1) I fear at all(!!); (2) by absolute path if desired.<br>


<br>
BTW, the 3.11-3 vm indeed appears to have fixed my problem w/ double return values, at least the boiled-down test works.<br>
<br>
Bill<br>
<br>
<br>
________________________________<br>
From: <a href="mailto:pharo-project-bounces@lists.gforge.inria.fr">pharo-project-bounces@lists.gforge.inria.fr</a> [mailto:<a href="mailto:pharo-project-bounces@lists.gforge.inria.fr">pharo-project-bounces@lists.gforge.inria.fr</a>] On Behalf Of laurent laffont<br>


Sent: Thursday, April 08, 2010 3:22 PM<br>
To: <a href="mailto:Pharo-project@lists.gforge.inria.fr">Pharo-project@lists.gforge.inria.fr</a><br>
Subject: Re: [Pharo-project] Linux vm: assertions and strategy<br>
<br>
</div>2010/4/8 Schwab,Wilhelm K &lt;<a href="mailto:bschwab@anest.ufl.edu">bschwab@anest.ufl.edu</a>&lt;mailto:<a href="mailto:bschwab@anest.ufl.edu">bschwab@anest.ufl.edu</a>&gt;&gt;<br>
<div class="im">Laurent,<br>
<br>
I was reading a little about Eliot&#39;s proposed FPU init changes to FFI and then took another look at your evolving Pharo vm source and I was struck by either: (1) a brilliant (well, fairly clever) workaround to my external library hassles; (2) a completely and totally stupid idea.<br>


<br>
You have based the vm on the 3.11-3 sources, so it hopefully fixes the double return defect that has been driving me nuts.  My remaining problem is to get the vm to load external libraries.  Would a simple plugin to expose dlopen() (and perhaps dlsym() while we&#39;re at it) solve the problem?  I should then be able to bypass the FFI code that calls dlopen() (I suspect that it&#39;s pretty badly broken) by setting the handle of any ailing library by using absolute paths if necessary.  From there, I *think* everything will just work.<br>


<br>
What do you think?<br>
<br>
Well, I&#39;m noob on VM stuff, I&#39;ve just worked on how to generate VM source for Linux, that&#39;s all :)  So I cannot tell anything...I have to learn before.<br>
<br>
<br>
<br>
Somewhat related, have you looked at compiling the Alien plugin?  The more I look at posts on Alien, the more I wonder whether it will help, as there are suggestions that it is weak on external calls.  Still, it would be nice to get it going and look over the tests the boldness that comes from watching them pass having actually done something.<br>


<br>
Yes I can compile it, but the VM crashes loudly when trying to use it.  This thread has a lot of informations:<br>
<a href="http://n4.nabble.com/Trying-to-build-alien-plugin-in-linux-tc1562896.html" target="_blank">http://n4.nabble.com/Trying-to-build-alien-plugin-in-linux-tc1562896.html</a><br>
<br>
<br>
<br>
Laurent Laffont<br>
<br>
<br>
Bill<br>
<br>
<br>
________________________________<br>
</div>From: <a href="mailto:pharo-project-bounces@lists.gforge.inria.fr">pharo-project-bounces@lists.gforge.inria.fr</a>&lt;mailto:<a href="mailto:pharo-project-bounces@lists.gforge.inria.fr">pharo-project-bounces@lists.gforge.inria.fr</a>&gt; [mailto:<a href="mailto:pharo-project-bounces@lists.gforge.inria.fr">pharo-project-bounces@lists.gforge.inria.fr</a>&lt;mailto:<a href="mailto:pharo-project-bounces@lists.gforge.inria.fr">pharo-project-bounces@lists.gforge.inria.fr</a>&gt;] On Behalf Of laurent laffont<br>


<div class="im">Sent: Thursday, April 08, 2010 7:32 AM<br>
</div>To: <a href="mailto:Pharo-project@lists.gforge.inria.fr">Pharo-project@lists.gforge.inria.fr</a>&lt;mailto:<a href="mailto:Pharo-project@lists.gforge.inria.fr">Pharo-project@lists.gforge.inria.fr</a>&gt;<br>
<div class="im">Subject: Re: [Pharo-project] Linux vm: assertions and strategy<br>
<br>
<br>
I&#39;m totally noob on FFI. Maybe the vm-dev mailing list is more appropriate ?  It seems there&#39;s actually some problems with it <a href="http://n4.nabble.com/forum/Search.jtp?tpl=search-page&amp;node=104410&amp;query=ffi" target="_blank">http://n4.nabble.com/forum/Search.jtp?tpl=search-page&amp;node=104410&amp;query=ffi</a><br>


<br>
On my machine, 20/21 FFI unit tests fails...<br>
<br>
I haven&#39;t been able to build last revision of squeak-vm trunk.<br>
<br>
Laurent Laffont<br>
<br>
<br>
</div><div class="im">On Thu, Apr 8, 2010 at 1:53 PM, Schwab,Wilhelm K &lt;<a href="mailto:bschwab@anest.ufl.edu">bschwab@anest.ufl.edu</a>&lt;mailto:<a href="mailto:bschwab@anest.ufl.edu">bschwab@anest.ufl.edu</a>&gt;&gt; wrote:<br>


Laurent, all,<br>
<br>
If I may jump to conclusions a little, the 3.11-3 vm&#39;s changes break the loading of libraries, certainly to the point of being arkane.  Beyond that, LinuxODBC is transparent to it, so I am left wondering how it is suppose to work at all??<br>


<br>
The RC3 one-click image and vm produce very nice fonts on my Ubuntu laptop, but it retains the FFI/double defect, and from the naming of the plugins, must be based on a pre 3.11-3 vm.<br>
<br>
Is the plan to use 3.11-3 for the one-click?  If so, we need to do something about external libraries; at a minimum, LinuxODBC should work, whether by fully understanding how to use environment variables, or (as I suspect) getting the dlopen() call to work again.<br>


<br>
Another option is to identify the FPU related fixes and apply them to the current one-click vm.<br>
<br>
Any preferences?  Any success with 3.11-3 and LinuxODBC?  I&#39;d be happy to be wrong about this.<br>
<br>
Bill<br>
<br>
<br>
_______________________________________________<br>
Pharo-project mailing list<br>
</div><a href="mailto:Pharo-project@lists.gforge.inria.fr">Pharo-project@lists.gforge.inria.fr</a>&lt;mailto:<a href="mailto:Pharo-project@lists.gforge.inria.fr">Pharo-project@lists.gforge.inria.fr</a>&gt;<br>
<div class="im"><a href="http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project" target="_blank">http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project</a><br>
<br>
<br>
_______________________________________________<br>
Pharo-project mailing list<br>
</div><a href="mailto:Pharo-project@lists.gforge.inria.fr">Pharo-project@lists.gforge.inria.fr</a>&lt;mailto:<a href="mailto:Pharo-project@lists.gforge.inria.fr">Pharo-project@lists.gforge.inria.fr</a>&gt;<br>
<div><div></div><div class="h5"><a href="http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project" target="_blank">http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project</a><br>
<br>
<br>
_______________________________________________<br>
Pharo-project mailing list<br>
<a href="mailto:Pharo-project@lists.gforge.inria.fr">Pharo-project@lists.gforge.inria.fr</a><br>
<a href="http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project" target="_blank">http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project</a><br>
</div></div></div><br>