note that:<br><div><div>cat vm-display-null/CMakeFiles/vm-display-null.dir/link.txt</div><div><br></div><div>gives</div><div> </div><div>/usr/bin/gcc  -fPIC  -shared -Wl,-soname,vm-display-null -o /root/securedvm/results/vm-display-null CMakeFiles/vm-display-null.dir/root/securedvm/platforms/unix/vm-display-null/sqUnixDisplayNull.c.o -lm -ldl -lpthread </div>


<div><br></div>if I edit it and add -m32 -L/usr/lib32</div><div><br></div><div>then it works</div><div><br></div><div>It seems link.txt is generated by cmake....</div><div><br></div><div>Laurent.<br><br><div class="gmail_quote">

On Mon, Aug 15, 2011 at 9:04 AM, laurent laffont <span dir="ltr">&lt;<a href="mailto:laurent.laffont@gmail.com">laurent.laffont@gmail.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>Igor,</div><div><br></div><div>I have 32bits version of needed libraries - they are installed by package libc6-dev-i386 in /usr/lib32</div><div><br></div><div>I&#39;ve created CogDebian64Config and adjust linkFlags / commonCompilerFlags so I have:</div>


<div><br></div><div><div>CogDebian64Config new linkFlags</div><div> &#39;-lSM -lICE -ldl -lGL -lpthread -lm -lnsl -lX11 -m32 -L/usr/lib32&#39;</div><div><br></div><div>CogDebian64Config new compilerFlags &#39; -DLSB_FIRST=1 -DUSE_GLOBAL_STRUCT=0 -DCOGMTVM=0 -m32 -L/usr/lib32 -g0 -O2 -msse2 -D_GNU_SOURCE -DNDEBUG -DITIMER_HEARTBEAT=1 </div>


<div><span style="white-space:pre-wrap">        </span>-DNO_VM_PROFILE=1 -DDEBUGVM=0&#39;</div></div><div><br></div><div><br></div><div>but when I make VERBOSE=1  </div><div><br></div><div><div>Linking C shared library /root/securedvm/results/vm-display-null</div>


<div>cd /root/securedvm/build/vm-display-null &amp;&amp; /usr/bin/cmake -E cmake_link_script CMakeFiles/vm-display-null.dir/link.txt --verbose=1</div><div>/usr/bin/gcc  -fPIC   -shared -Wl,-soname,vm-display-null -o /root/securedvm/results/vm-display-null CMakeFiles/vm-display-null.dir/root/securedvm/platforms/unix/vm-display-null/sqUnixDisplayNull.c.o -lm -ldl -lpthread </div>

<div class="im">
<div>collect2: ld terminated with signal 11 [Segmentation fault]</div></div><div class="im"><div>/usr/bin/ld: i386 architecture of input file `CMakeFiles/vm-display-null.dir/root/securedvm/platforms/unix/vm-display-null/sqUnixDisplayNull.c.o&#39; is incompatible with i386:x86-64 output</div>


</div></div><div><br></div><div><br></div><div>So it seems compilerFlags are not used for building vm-display-null !!! </div><div><br></div><div>Same result if I export CC=&quot;gcc -m32&quot;</div><div><br></div><div><br>

</div>
<div>Flags are used for building CogVM though:</div><div><br></div><div><div>[ 57%] Building C object JPEGReadWriter2Plugin/CMakeFiles/JPEGReadWriter2Plugin.dir/root/securedvm/platforms/Cross/plugins/JPEGReadWriter2Plugin/jquant2.c.o</div>


<div>cd /root/securedvm/build/JPEGReadWriter2Plugin &amp;&amp; /usr/bin/gcc  -DLSB_FIRST=1 -DUSE_GLOBAL_STRUCT=0 -DCOGMTVM=0 -D_GNU_SOURCE -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DDEBUGVM=0 -DSQUEAK_BUILTIN_PLUGIN -DLSB_FIRST=1 -DUSE_GLOBAL_STRUCT=0 -DCOGMTVM=0 -D_GNU_SOURCE -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DDEBUGVM=0 -I/root/securedvm/platforms/unix/plugins/B3DAcceleratorPlugin -I/root/securedvm/platforms/Cross/vm -I/root/securedvm/src/vm -I/root/securedvm/platforms/unix/vm -I/root/securedvm/build -I/root/securedvm/src/plugins/JPEGReadWriter2Plugin -I/root/securedvm/platforms/Cross/plugins/JPEGReadWriter2Plugin -I/root/securedvm/platforms/unix/plugins/JPEGReadWriter2Plugin   -m32 -L/usr/lib32 -g0 -O2 -msse2 -m32 -L/usr/lib32 -g0 -O2 -msse2 -o CMakeFiles/JPEGReadWriter2Plugin.dir/root/securedvm/platforms/Cross/plugins/JPEGReadWriter2Plugin/jquant2.c.o   -c /root/securedvm/platforms/Cross/plugins/JPEGReadWriter2Plugin/jquant2.c</div>


</div><div><br></div><font color="#888888"><div><br></div><div>Laurent</div></font><div><div></div><div class="h5"><br><div class="gmail_quote">On Sun, Aug 14, 2011 at 10:10 PM, Igor Stasenko <span dir="ltr">&lt;<a href="mailto:siguctua@gmail.com" target="_blank">siguctua@gmail.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><br>
On 14 August 2011 18:39, laurent laffont &lt;<a href="mailto:laurent.laffont@gmail.com" target="_blank">laurent.laffont@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; Thanks Levente.<br>
&gt; After searching &amp; trying finally I&#39;ve passed this problem by:<br>
&gt; mv /usr/bin/gcc /usr/bin/real.gcc<br>
&gt; and then creating /usr/bin/gcc :<br>
&gt; #!/bin/sh<br>
&gt; exec real.gcc -m32 $@<br>
&gt; and chmod +x /usr/bin/gcc<br>
&gt;<br>
&gt; Now I have:<br>
&gt; [ 94%] Built target vm-display-null<br>
&gt; Scanning dependencies of target vm-display-X11<br>
&gt; [ 94%] Building C object vm-display-X11/CMakeFiles/vm-display-X11.dir/root/securedvm/platforms/unix/vm-display-X11/sqUnixX11.c.o<br>
&gt; [ 95%] Building C object vm-display-X11/CMakeFiles/vm-display-X11.dir/root/securedvm/platforms/unix/vm-display-X11/sqUnixMozilla.c.o<br>
&gt; Linking C shared library /root/securedvm/results/vm-display-X11<br>
&gt; /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libSM.so when searching for -lSM<br>
&gt; /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libSM.a when searching for -lSM<br>
&gt; /usr/bin/ld: skipping incompatible /usr/lib/libSM.so when searching for -lSM<br>
&gt; /usr/bin/ld: skipping incompatible /usr/lib/libSM.a when searching for -lSM<br>
&gt; /usr/bin/ld: cannot find -lSM<br>
&gt; collect2: ld returned 1 exit status<br>
&gt;<br>
<br>
</div>looks like you don&#39;t have 32bit version of this library.<br>
That&#39;s why it refusing to link.<br>
<br>
As for compiler options, i don&#39;t think that you need to use<br>
workarounds (like creating real.gcc etc) , because the -m32 flag is<br>
there:<br>
<br>
# This is automatically generated file using CogUnixConfig on 14<br>
August 2011 10:01:34 pm<br>
...<br>
message(&quot;Adding module: vm-sound-null&quot;)<br>
<div>add_definitions( -DLSB_FIRST=1 -DUSE_GLOBAL_STRUCT=0 -DCOGMTVM=0 -m32<br>
-g0 -O2 -msse2 -D_GNU_SOURCE -DNDEBUG -DITIMER_HEARTBEAT=1<br>
</div>        -DNO_VM_PROFILE=1 -DDEBUGVM=0)<br>
...<br>
<br>
Try building using:<br>
<br>
make VERBOSE=1<br>
<br>
to see what flags are passed to compiler.<br>
<br>
And please, create a subclass of CogUnixConfig , like<br>
Cog32OnDebian64Config<br>
and play with definitions there.<br>
<br>
In image you can do:<br>
<br>
Cog32OnDebian64Config generateWithSources<br>
or<br>
Cog32OnDebian64Config generate<br>
<br>
the difference that first will generate cmake files + source files,<br>
while second one is only cmake files (takes less than second)<br>
<br>
I suspecting that problem with linker flags, which tries to link<br>
32-bit output with 64-bit binary.<br>
It seems that we&#39;re missing the flag there that it should use 32-bit<br>
binary for output.<br>
<div><div></div><div><br>
&gt; Laurent<br>
&gt;<br>
&gt; On Sat, Aug 13, 2011 at 4:36 PM, Levente Uzonyi &lt;<a href="mailto:leves@elte.hu" target="_blank">leves@elte.hu</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; On Sat, 13 Aug 2011, laurent laffont wrote:<br>
&gt;&gt;<br>
&gt;&gt; (no quotes thx to gmail...)<br>
&gt;&gt;<br>
&gt;&gt; This issue was discussed several times. The simplest solution is to define CC as &quot;gcc -m32&quot; (and optionally CXX as &quot;g++ -m32&quot; if you need g++). Another solution is to check how cmake supports cross compilation. IIRC autotools has some flags for this.<br>



&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Levente<br>
&gt;<br>
&gt;<br>
&gt;<br>
<br>
<br>
<br>
</div></div><font color="#888888">--<br>
Best regards,<br>
Igor Stasenko AKA sig.<br>
</font></blockquote></div><br>
</div></div></blockquote></div><br></div>