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