[Vm-dev] building Cog on 64 bits debian

Igor Stasenko siguctua at gmail.com
Sun Aug 14 20:10:51 UTC 2011


On 14 August 2011 18:39, laurent laffont <laurent.laffont at gmail.com> wrote:
>
> Thanks Levente.
> After searching & trying finally I've passed this problem by:
> mv /usr/bin/gcc /usr/bin/real.gcc
> and then creating /usr/bin/gcc :
> #!/bin/sh
> exec real.gcc -m32 $@
> and chmod +x /usr/bin/gcc
>
> Now I have:
> [ 94%] Built target vm-display-null
> Scanning dependencies of target vm-display-X11
> [ 94%] Building C object vm-display-X11/CMakeFiles/vm-display-X11.dir/root/securedvm/platforms/unix/vm-display-X11/sqUnixX11.c.o
> [ 95%] Building C object vm-display-X11/CMakeFiles/vm-display-X11.dir/root/securedvm/platforms/unix/vm-display-X11/sqUnixMozilla.c.o
> Linking C shared library /root/securedvm/results/vm-display-X11
> /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libSM.so when searching for -lSM
> /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libSM.a when searching for -lSM
> /usr/bin/ld: skipping incompatible /usr/lib/libSM.so when searching for -lSM
> /usr/bin/ld: skipping incompatible /usr/lib/libSM.a when searching for -lSM
> /usr/bin/ld: cannot find -lSM
> collect2: ld returned 1 exit status
>

looks like you don't have 32bit version of this library.
That's why it refusing to link.

As for compiler options, i don't think that you need to use
workarounds (like creating real.gcc etc) , because the -m32 flag is
there:

# This is automatically generated file using CogUnixConfig on 14
August 2011 10:01:34 pm
...
message("Adding module: vm-sound-null")
add_definitions( -DLSB_FIRST=1 -DUSE_GLOBAL_STRUCT=0 -DCOGMTVM=0 -m32
-g0 -O2 -msse2 -D_GNU_SOURCE -DNDEBUG -DITIMER_HEARTBEAT=1
	-DNO_VM_PROFILE=1 -DDEBUGVM=0)
...

Try building using:

make VERBOSE=1

to see what flags are passed to compiler.

And please, create a subclass of CogUnixConfig , like
Cog32OnDebian64Config
and play with definitions there.

In image you can do:

Cog32OnDebian64Config generateWithSources
or
Cog32OnDebian64Config generate

the difference that first will generate cmake files + source files,
while second one is only cmake files (takes less than second)

I suspecting that problem with linker flags, which tries to link
32-bit output with 64-bit binary.
It seems that we're missing the flag there that it should use 32-bit
binary for output.

> Laurent
>
> On Sat, Aug 13, 2011 at 4:36 PM, Levente Uzonyi <leves at elte.hu> wrote:
>>
>> On Sat, 13 Aug 2011, laurent laffont wrote:
>>
>> (no quotes thx to gmail...)
>>
>> 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.
>>
>>
>> Levente
>
>
>



-- 
Best regards,
Igor Stasenko AKA sig.


More information about the Vm-dev mailing list