<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 9, 2014 at 4:52 PM, David T. Lewis <span dir="ltr">&lt;<a href="mailto:lewis@mail.msen.com" target="_blank">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"><br>
On Wed, Jul 09, 2014 at 11:56:59AM -0700, gettimothy wrote:<br>
&gt;<br>
&gt; Hi All.<br>
&gt;<br>
&gt;<br>
&gt; Don&#39;t spend brain cycles on this, but I want to mention it in passing.<br>
<br>
Hi tty,<br>
<br>
The Cog VMs cannot be compiled in 32-bit mode, so if you are on a 64-bit platform the<br></blockquote><div><br></div><div>I think you mean &quot;can only be compiled in 32-bit mode&quot;.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

CFLAGS will need to specify -m32 to tell the compiler to use the 32 bit memory model.<br></blockquote><div><br></div><div>Right.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

If you pass the right CFLAGS (with &quot;-m32&quot;) to platforms/unix/cmake/configure, you will<br>
find that the generated config.h will have the correct type definitions.<br>
<br>
CMake takes care of the rest. But if you want to explicitly tell it to use a 32-bit<br>
memory model (required for Cog), you will want this to happen at the &quot;configure&quot; step<br>
so that config.h is defined properly for a 32-bit build. That is the reason that the<br>
CFLAGS are specified as an option to unix/cmake/configure, and it is the reason that<br>
config.h is generated at this point in the configure/make process.<br>
<br>
Dave<br>
<br>
&gt;<br>
&gt;<br>
&gt; I am working out integrating Ian&#39;s configuration approach into the CMakeVMakerSqueak and ran into this interesting thing.<br>
&gt;<br>
&gt;<br>
&gt; Ian&#39;s code on my system will detect the SIZEOF_ stuff on my system<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; #define SIZEOF_INT 4<br>
&gt;<br>
&gt; #define SIZEOF_LONG 8<br>
&gt; #define SIZEOF_LONG_LONG 8<br>
&gt; #define SIZEOF_VOID_P 8<br>
&gt;<br>
&gt;<br>
&gt; When I go to run the cog, I get this error.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; mprotect(x,y,PROT_READ | PROT_WRITE | PROT_EXEC): Cannot allocate memory<br>
&gt; Segmentation fault (core dumped)<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Changing SIZEOF_VOID_P to 4 makes that problem go away and the image launches.<br>
&gt;<br>
&gt;<br>
&gt; I am thinking I am going to throw a conditional in the configuration such that if it is a 64 bit system with 32 bit libs, to work around this.<br>
&gt;<br>
&gt;<br>
&gt; I mention this in passing in case there is a &quot;magic&quot;<br>
&gt; #define mprotect_will_just_work 1<br>
&gt;<br>
&gt; flag or something.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; cordially,<br>
&gt;<br>
&gt;<br>
&gt; tty<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div>
</div></div>