32 bit application on 64 bit manjaro - shared library problem


i’m using the latest Manjaro KDE.

  1. i complied a 32bit asm with below options:

    bubble: bubble.o 
            ld -m elf_i386 -L /usr/lib32 -lc -dynamic-linker /lib/ld-linux.so.2 -o $@ $^
    bubble.o: bubble.s
          as -32 -o $@ $<
  2. I successfully get the binary ‘bubble’ as below

    [ethan@ethan-fisher asm]$ file bubble
    bubble: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, not stripped
  3. but everytime when i run this binary, it complains below error, but still get right result:

    ERROR: ld.so: object '/usr/lib/libutil.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
  4. ldd output as below

    [ethan@ethan-fisher asm]$ ldd bubble
    ERROR: ld.so: object '/usr/lib/libutil.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
            linux-gate.so.1 (0xf7fc7000)
            libc.so.6 => /usr/lib32/libc.so.6 (0xf7da4000)
            /lib/ld-linux.so.2 => /usr/lib/ld-linux.so.2 (0xf7fc9000)
    [ethan@ethan-fisher asm]$ 
  5. i tried to manually link /usr/lib/libutil.so (linked to /usr/lib/libutil-2.33.so) to /usr/lib32/libutil-2.33.so, the error complaint disappear when i run same binary again. but this will cause other 64bit applications (such as ‘ls’) complains the same error, because the libutil.so became 32bit.

so, my questions is: how to configure the system or gcc runtime suites to automatically enable:
64bit ld-linux.so to link or use /usr/lib/libutil-2.33.so, while
32bit ld-linux.so to link or use /usr/lib32/libutil-2.33.so

much appreciated…



  • Don’t expect a 32-bit cross-assembled (or for that matter: compiled) ELF to run on a 64-bit Linux system!

The long version

  • If you want to test 32-bit applications:
    • install a 32-bit Guest OS in a Virtual Machine inside a 64-bit Host OS
    • Install a 32-bit OS in dual (triple) boot with another 64-bit Linux (or Windows)

Why? That’s dumb!

  • Because some OS from Redmond, WA has backwards 32-bit compatibility on their 64-bit OS through an emulation layer (WoW32, “Windows on Windows”) or a 16-bit compatibility layer on top of that (WoW16), it doesn’t mean ALL OSes have this capability!

That’s even dumber! WHY I ASK YOU!

  • Linux is based on open source, so you always have the source and can just compile a 64-bit version to be tested on a 64-bit system. There is no need for any Linux on Linux as that is just plain LoL!
  • On Windows you generally do not have the source code so you cannot re-compile so there is a need for WoW32 and WoW16…

:crazy_face: :joy:

1 Like

thanks Fabby the response

my reason to compile 32bit applications is that i’m writing some ASM code which using 32bits instructions and registers… i even can not simply compile them into 64 bits since the instructions/register names conflicts…

actually this 32bit application already running and get the expected result, but it always complains the error message before running…

1 Like