32-bit compiles failing on 64-bit platform - Linux

This is a discussion on 32-bit compiles failing on 64-bit platform - Linux ; I am trying to create some 32-bit utilities on a 64-bit platform (Ubuntu Edgy), using a somewhat old gcc release. My problem is that the linker is choosing the incorrect libraries at linking (particularly, the incorrect glib crti.o/crtn.o libraries which ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: 32-bit compiles failing on 64-bit platform

  1. 32-bit compiles failing on 64-bit platform

    I am trying to create some 32-bit utilities on a 64-bit platform
    (Ubuntu Edgy), using a somewhat old gcc release.

    My problem is that the linker is choosing the incorrect libraries at
    linking (particularly, the incorrect glib crti.o/crtn.o libraries which
    generate a segfault when linked against).
    As a matter of fact, I am very puzzled about how the linker gets to
    choose the libraries in the first place (any documentation about how
    /etc/ld.so.conf, /etc/ld.so.cache and so forth interact is
    appreciated), as it automatically adds some paths I never specified.

    This is what I have:

    Compilation flags:

    /usr/bin/g++-3.3.4 -DrubyMEL_EXPORTS -O3 -DNDEBUG -fPIC
    -I/usr/aw/maya7.0/include -I/usr/lib/ruby/1.8/x86_64-linux -D_BOOL
    -DREQUIRE_IOSTREAM -s -pthread -DLINUX -m32
    -I/usr/include/i486-linux-gnu -s -pthread -o
    src/CMakeFiles/rubyMEL.dir/rubyScriptNode.o -c
    /home/gga/code/Maya/mrLiquid/rubyMEL/src/rubyScriptNode.cpp

    Linking flags:

    /usr/bin/g++-3.3.4 -fPIC -m32 -O3 -DNDEBUG -Wl,-melf_i386
    -Wl,-rpath,/usr/lib32:/lib32 -Wl,-L/usr/lib32 -Wl,-L/lib32
    -Wl,-Bsymbolic -shared -Wl,-soname,rubyMEL.so.0.9 -o
    .../lib/rubyMEL.so.0.9 "CMakeFiles/rubyMEL.dir/pluginMain.o"
    "CMakeFiles/rubyMEL.dir/rubyFileSizeCmd.o"
    "CMakeFiles/rubyMEL.dir/rubyMELCmd.o"
    "CMakeFiles/rubyMEL.dir/rubyToMEL.o"
    "CMakeFiles/rubyMEL.dir/rubyPrefs.o"
    "CMakeFiles/rubyMEL.dir/rubyResult.o"
    "CMakeFiles/rubyMEL.dir/rubyScriptNode.o" -L/usr/aw/maya7.0/lib
    -lOpenMaya -lOpenMayaAnim -lOpenMayaFX -lOpenMayaUI -lruby1.8
    -Wl,-rpath,/usr/aw/maya7.0/lib
    /usr/bin/ld: skipping incompatible /usr/lib/../lib/libruby1.8.so when
    searching for -lruby1.8
    /usr/bin/ld: skipping incompatible /usr/lib/../lib/libm.so when
    searching for -lm
    /usr/bin/ld: skipping incompatible /usr/lib/../lib/libm.a when
    searching for -lm
    /usr/bin/ld: skipping incompatible /usr/lib/../lib/libc.so when
    searching for -lc
    /usr/bin/ld: skipping incompatible /usr/lib/../lib/libc.a when
    searching for -lc
    /usr/bin/ld: warning: i386:x86-64 architecture of input file
    `/usr/lib/../lib/crti.o' is incompatible with i386 output
    /usr/bin/ld: warning: i386:x86-64 architecture of input file
    `/usr/lib/../lib/crtn.o' is incompatible with i386 output

    In my linux distro:

    /usr/lib contains 64-bit libraries
    /usr/lib64 is a symlink to /usr/lib
    /usr/lib32 contains 32-bit libraries

    However, g++ -m32 seems stuck with automatically looking for libraries
    inside /usr/lib, which is incorrect as those are the 64-bit libraries.


  2. Re: 32-bit compiles failing on 64-bit platform

    Hello,

    > In my linux distro:
    >
    > /usr/lib contains 64-bit libraries
    > /usr/lib64 is a symlink to /usr/lib
    > /usr/lib32 contains 32-bit libraries
    >
    > However, g++ -m32 seems stuck with automatically looking for libraries
    > inside /usr/lib, which is incorrect as those are the 64-bit libraries.


    Using '-m32' flag should be the way to produce 32 bits executable on 64
    bits platform. Did you already ask Ubuntu dedicated forum? Perhaps this
    gcc feature is broken on Edgy.

    Cheers,
    Loic.


+ Reply to Thread