32bit link on a 64bit machine

Sysprogs forums Forums VisualGDB 32bit link on a 64bit machine

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #20923
    surahman
    Participant

    I’m trying to compile a binary with -m32 flag but keep getting the following error:
    /usr/bin/x86_64-linux-gnu-ld: i386 architecture of input file `FILENAME’ is incompatible with i386:x86-64 output

    I know this is an error invovling a 32bit link to a 64bit library, but how do I get it to link to the 32bit library?

    My setup is as follows:
    Ubuntu 18.04 running in VMWare
    Build tool is MS Build with the -m32 added to the C/C++ Advanced project tab, in additional flags.
    I’ve installed the following on the VM, and a compile and link in the VM succeeds:
    libc6:i386 libncurses5:i386 libstdc++6:i386 g++-multilib build-essential

    Thanks.

    #20924
    support
    Keymaster

    Hi,

    It looks like you have enabled the 32-bit mode for compilation, but not for linking. Please ensure that -m32 flag is set in both compiler and linker flags.

    #20931
    surahman
    Participant

    That fixed it, thanks!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.