Select Your Language

Infrastructure and Management

Cloud Computing

Storage

Runtimes

Integration and Automation

  • Comments
  • Can not compile a 32 bit binary on a x86_64 host due to ld failure

    Posted on

    Not an unexpected message but not clear how to solve :

    $ gcc -m32 -std=iso9899:1999 -fno-builtin -o hello hello.c
    /bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.8.5/libgcc_s.so when searching for -lgcc_s
    /bin/ld: cannot find -lgcc_s
    collect2: error: ld returned 1 exit status

    So looks like I need the 32-bit libs for gcc but it isn't clear what their yum names are.

    Strangely a symlink exists but no actual lib :

    $ ls -lad /usr/lib/gcc/x86_64-redhat-linux/4.8.2/32/libgcc_s.so
    lrwxrwxrwx. 1 root root 18 Dec 5 18:36 /usr/lib/gcc/x86_64-redhat-linux/4.8.2/32/libgcc_s.so -> /lib/libgcc_s.so.1
    $ ls -lad /lib
    lrwxrwxrwx. 1 root root 7 Dec 5 09:21 /lib -> usr/lib
    $ ls -lad /usr/lib/libgcc*
    ls: cannot access /usr/lib/libgcc*: No such file or directory
    $

    So that is odd.

    by

    points

    Responses

    Red Hat LinkedIn YouTube Facebook X, formerly Twitter

    Quick Links

    Help

    Site Info

    Related Sites

    © 2026 Red Hat