Hi David,<br><br><div class="gmail_quote">On Mon, Jul 26, 2010 at 7:13 AM, David T. Lewis <span dir="ltr">&lt;<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">On Sun, Jul 25, 2010 at 11:01:12PM -0400, Rob Withers wrote:<br>
&gt;<br>
&gt; --------------------------------------------------<br>
&gt; From: &quot;David T. Lewis&quot; &lt;<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>&gt;<br>
&gt; Sent: Sunday, July 25, 2010 3:01 PM<br>
&gt; To: &quot;The general-purpose Squeak developers list&quot;<br>
&gt; &lt;<a href="mailto:squeak-dev@lists.squeakfoundation.org">squeak-dev@lists.squeakfoundation.org</a>&gt;<br>
&gt; Cc: &quot;Squeak Virtual Machine Development Discussion&quot;<br>
&gt; &lt;<a href="mailto:vm-dev@lists.squeakfoundation.org">vm-dev@lists.squeakfoundation.org</a>&gt;<br>
&gt; Subject: Re: [squeak-dev] Re: [Vm-dev] OSProcess in Cog<br>
&gt;<br>
&gt; &gt;<br>
&gt; &gt;On Sun, Jul 25, 2010 at 12:24:33PM -0400, Rob Withers wrote:<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;--------------------------------------------------<br>
&gt; &gt;&gt;From: &quot;David T. Lewis&quot; &lt;<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>&gt;<br>
&gt; &gt;&gt;Sent: Sunday, July 25, 2010 11:58 AM<br>
&gt; &gt;&gt;To: &quot;Squeak Virtual Machine Development Discussion&quot;<br>
&gt; &gt;&gt;&lt;<a href="mailto:vm-dev@lists.squeakfoundation.org">vm-dev@lists.squeakfoundation.org</a>&gt;<br>
&gt; &gt;&gt;Cc: &quot;Squeak Dev&quot; &lt;<a href="mailto:squeak-dev@lists.squeakfoundation.org">squeak-dev@lists.squeakfoundation.org</a>&gt;<br>
&gt; &gt;&gt;Subject: Re: [Vm-dev] OSProcess in Cog<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;On Sun, Jul 25, 2010 at 10:59:04AM -0400, Rob Withers wrote:<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt;I am trying to load and run OSProcess in Cog.  I loaded:<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt;   OSProcess-Base<br>
&gt; &gt;&gt;&gt;&gt;   OSProcess-AIO<br>
&gt; &gt;&gt;&gt;&gt;   OSProcess-Win32<br>
&gt; &gt;&gt;&gt;&gt;   OSProcess-Unix<br>
&gt; &gt;&gt;&gt;&gt;   OSProcess-Tests<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt;Then ran the tests.  Many failures.<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt;I looked at the vm and there is no ProcessPlugin or OSProcessPlugin.<br>
&gt; &gt;&gt;&gt;&gt;Should there be?<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;OSProcess will not work without the OSProcessPlugin. AFAIK no one has<br>
&gt; &gt;&gt;&gt;tried this yet (including me - sorry I&#39;ve been quite busy lately).<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;What about the AIOPlugin?<br>
&gt; &gt;<br>
&gt; &gt;AIOPlugin is Unix only, and totally optional. OSProcess and CommandShell<br>
&gt; &gt;will both work without it.<br>
&gt; &gt;<br>
&gt;<br>
&gt; I see.  I am including in hopes that I get the cross-platform thing working<br>
&gt; for unix.<br>
&gt;<br>
&gt; &gt;&gt;&gt;&gt;What should I do?<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;If you are compiling your own COG VM, then load OSProcessPlugin from<br>
&gt; &gt;&gt;&gt;SqueakSource and give it a try. But just to set expectations, I will<br>
&gt; &gt;&gt;&gt;be (pleasantly) surprised if it works the first time without<br>
&gt; &gt;&gt;&gt;modifications,<br>
&gt; &gt;&gt;&gt;so consider it pre-alpha at this point.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;I loaded the OSProcessPlugin package and generated sources under Windows.<br>
&gt; &gt;&gt;I built using Cygwin.  It gave me a Win32OSProcessPlugin.dll.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;I ran the tests.  It said I don&#39;t have the AIOPlugin so it was using<br>
&gt; &gt;&gt;polling (I think that is what it  said).  Tests failed in<br>
&gt; &gt;&gt;AioEventHandlerTestCase (failures) and OSPipeTestCase (errors).  Many<br>
&gt; &gt;&gt;OSPipeTestCase failures have to do with AttachableFileStream being<br>
&gt; &gt;&gt;closed.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;I tried the following code and it failed because stdout was closed:<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;ThisOSProcess thisOSProcess openConsole.<br>
&gt; &gt;&gt;ThisOSProcess thisOSProcess stdOut<br>
&gt; &gt;&gt;nextPutAll: (&#39;error count: &#39;,<br>
&gt; &gt;&gt;CryptoDESTest suite run errorCount asString);<br>
&gt; &gt;&gt;flush.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;Which is what I need OSProcess for.<br>
&gt; &gt;<br>
&gt; &gt;On Windows, you will need to do one hack in order for this to work.<br>
&gt; &gt;In the platforms sources, edit platforms/win32/vm/sqWin32HandleTable.h<br>
&gt; &gt;and disable the handle registry checking. IIRC, you can just hack<br>
&gt; &gt;the IsHandleInTable() function to always return true.<br>
&gt; &gt;<br>
&gt;<br>
&gt; I did this, recompiled, launched Cog with my test image, and I am still<br>
&gt; getting the same failures and errors.<br>
&gt;<br>
&gt; &gt;&gt;Another issue: I am trying to generate sources so I can move them from<br>
&gt; &gt;&gt;Win32 to Unix and compile the vm there.  I cannot run VMMaker on linux -<br>
&gt; &gt;&gt;it<br>
&gt; &gt;&gt;is headless/no X.  I noticed that the OSProcessPlugin generates per<br>
&gt; &gt;&gt;platform, and in fact there is platform support code.  So under Windows,<br>
&gt; &gt;&gt;we<br>
&gt; &gt;&gt;generate a Win32OSProcessPlugin.  Under Unix I assume it generates a<br>
&gt; &gt;&gt;UnixOSProcessPlugin.  Is there any way I can generate a<br>
&gt; &gt;&gt;UnixOSProcessPlugin<br>
&gt; &gt;&gt;under Windows?<br>
&gt; &gt;<br>
&gt; &gt;Open your VMMaker window in Squeak, click the &quot;Find platform&quot; button,<br>
&gt; &gt;and change from &quot;Win32&quot; to &quot;unix&quot;. Generate your sources, and you<br>
&gt; &gt;should have the Unix variant of OSProcessPlugin rather than the Windows<br>
&gt; &gt;flavor.<br>
&gt; &gt;<br>
&gt;<br>
&gt; First thing is Cog doesn&#39;t use the window, it uses this script:<br>
&gt;<br>
&gt;       (VMMaker<br>
&gt;               generate: CoInterpreter<br>
&gt;               to: (FileDirectory default / &#39;..\src&#39;) fullName<br>
&gt;               platformDir: (FileDirectory default / &#39;..\platforms&#39;)<br>
&gt;               fullName<br>
&gt;               excluding:#(BrokenPlugin IA32ABIPluginSimulator<br>
&gt;               SlangTestPlugin TestOSAPlugin))<br>
&gt;<br>
&gt; Second, I tried using the window, changes the intepreterClass to<br>
&gt; &#39;CoInterpreter&#39;, set the platform path, set the sources path, and clicked<br>
&gt; &quot;Find platform&quot; and selected &quot;unix&quot;.  This did not change the text entry<br>
&gt; value.<br>
&gt;<br>
&gt; Third, I set self halts in UnixOSProcessPlugin class&gt;&gt;#shouldBeTranslated<br>
&gt; and Win32OSProcessPlugin class&gt;&gt;#shouldBeTranslated.   The unix side<br>
&gt; eventually calls:<br>
&gt;<br>
&gt; UnixOSProcessPlugin class&gt;&gt;#isResponsibleForThisPlatform<br>
&gt;       &quot;Answer true is this is an instance of the class which is<br>
&gt;       responsible for representing<br>
&gt;       the OS process for the Squeak VM running on the current platform. A<br>
&gt;       false answer is<br>
&gt;       usually the result of running the image on a different platform and<br>
&gt;       VM.<br>
&gt;       Note: Keep this method is sync with OSProcess&gt;&gt;isUnix.&quot;<br>
&gt;<br>
&gt;       | numericOsVersion |<br>
&gt;<br>
&gt;       ^ (self platformName = &#39;unix&#39;) or:<br>
&gt;               [numericOsVersion := self osVersion asInteger ifNil: [0].<br>
&gt;               (self platformName = &#39;Mac OS&#39;) and: [numericOsVersion &gt;=<br>
&gt;               1000]]<br>
&gt;<br>
&gt; and this calls:<br>
&gt;<br>
&gt; OSProcessPlugin class&gt;&gt;#platformName<br>
&gt;       &quot;After Squeak version 3.6, #platformName was moved to SmalltalkImage<br>
&gt;       &quot;<br>
&gt;<br>
&gt;       ^ ((Smalltalk classNamed: &#39;SmalltalkImage&#39;)<br>
&gt;               ifNil: [^ Smalltalk platformName]) current platformName<br>
&gt;<br>
&gt; which kills any hope of being a cross-compiled source.<br>
<br>
</div></div>No worries there. The C source is not supposed to be cross-compiled. The<br>
implementations in Slang/Smalltalk are completely different for Unix and<br>
Windows, and the resulting generated code (UnixOSProcessPlugin.c and<br>
Win32OSProcessPlugin.c respectively) are completely different as well.<br>
When building a VM to run on Unix/Linux/OSX you would be compiling the<br>
UnixOSProcessPlugin.c, and when compiling a VM for Windows you would<br>
compile Win32OSProcessPlugin.c.<br>
<br></blockquote><div><br></div><div>Cross-compilation is quite separate from generation.  Cog is intentionally modified to spit out exactly the same source tree irrespective of platform.  Needing a different VMMaker generation step for each platform is IMO an absurdity.  Whether a plugin is compiled or not then depends on the <a href="http://plugins.int">plugins.int</a> and plugins.ext files in each build directory.  So the intent is to always spit out the UnixOSProcessPlugin source but only compile it on Unix platforms, as selected by <a href="http://plugins.int">plugins.int</a> &amp; plugins.ext.</div>
<div><br></div><div>I notice I&#39;ve not included my version of Win32OSProcessPlugin in Cog.  I&#39;ll rectify that this evening.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

I checked that generating the Windows plugin source from a Linux<br>
machine using VMMakerTool (from VMMaker-dtl.183) works as expected.<br>
I am not able to test the Windows host generating Unix plugin source<br>
(I am away on vacation with limited time for Squeak), but I certainly<br>
expect that to work also.<br>
<br>
The most likely explanation is that the new CrossPlatformVMMaker<br>
in the Cog VMMaker package does not know that OSPP is trying<br>
to generate different sources for different target platforms,<br>
so this mechanism no longer works.<br></blockquote><div><br></div><div>See above.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Short term you can probably work around the issue by editing the<br>
#shouldBeTranslated and #shouldBeTranslatedFor: methods in<br>
UnixOSProcessPlugin and Win32OSProcessPlugin.<br>
<div class="im"><br>
&gt; I would really like to fix the Win32 bugs first.  Could you help me with<br>
&gt; that?<br>
<br>
</div>I cannot help right now, but hopefully others can step forward with<br>
suggestions.<br>
<br>
Dave<br>
<br>
<br>
</blockquote></div><br><div>HTH</div><div>Eliot</div>