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"><<a href="mailto:laurent.laffont@gmail.com">laurent.laffont@gmail.com</a>></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've created CogDebian64Config and adjust linkFlags / commonCompilerFlags so I have:</div>
<div><br></div><div><div>CogDebian64Config new linkFlags</div><div> '-lSM -lICE -ldl -lGL -lpthread -lm -lnsl -lX11 -m32 -L/usr/lib32'</div><div><br></div><div>CogDebian64Config new compilerFlags ' -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'</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 && /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' 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="gcc -m32"</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 && /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"><<a href="mailto:siguctua@gmail.com" target="_blank">siguctua@gmail.com</a>></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 <<a href="mailto:laurent.laffont@gmail.com" target="_blank">laurent.laffont@gmail.com</a>> wrote:<br>
><br>
> Thanks Levente.<br>
> After searching & trying finally I've passed this problem by:<br>
> mv /usr/bin/gcc /usr/bin/real.gcc<br>
> and then creating /usr/bin/gcc :<br>
> #!/bin/sh<br>
> exec real.gcc -m32 $@<br>
> and chmod +x /usr/bin/gcc<br>
><br>
> Now I have:<br>
> [ 94%] Built target vm-display-null<br>
> Scanning dependencies of target vm-display-X11<br>
> [ 94%] Building C object vm-display-X11/CMakeFiles/vm-display-X11.dir/root/securedvm/platforms/unix/vm-display-X11/sqUnixX11.c.o<br>
> [ 95%] Building C object vm-display-X11/CMakeFiles/vm-display-X11.dir/root/securedvm/platforms/unix/vm-display-X11/sqUnixMozilla.c.o<br>
> Linking C shared library /root/securedvm/results/vm-display-X11<br>
> /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libSM.so when searching for -lSM<br>
> /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libSM.a when searching for -lSM<br>
> /usr/bin/ld: skipping incompatible /usr/lib/libSM.so when searching for -lSM<br>
> /usr/bin/ld: skipping incompatible /usr/lib/libSM.a when searching for -lSM<br>
> /usr/bin/ld: cannot find -lSM<br>
> collect2: ld returned 1 exit status<br>
><br>
<br>
</div>looks like you don't have 32bit version of this library.<br>
That's why it refusing to link.<br>
<br>
As for compiler options, i don'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("Adding module: vm-sound-null")<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're missing the flag there that it should use 32-bit<br>
binary for output.<br>
<div><div></div><div><br>
> Laurent<br>
><br>
> On Sat, Aug 13, 2011 at 4:36 PM, Levente Uzonyi <<a href="mailto:leves@elte.hu" target="_blank">leves@elte.hu</a>> wrote:<br>
>><br>
>> On Sat, 13 Aug 2011, laurent laffont wrote:<br>
>><br>
>> (no quotes thx to gmail...)<br>
>><br>
>> This issue was discussed several times. The simplest solution is to define CC as "gcc -m32" (and optionally CXX as "g++ -m32" if you need g++). Another solution is to check how cmake supports cross compilation. IIRC autotools has some flags for this.<br>
>><br>
>><br>
>> Levente<br>
><br>
><br>
><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>