R_X86_64_32 error when compiling a shared object with gcc

Solution Unverified - Updated -

Issue

$ gcc -O2 -Wall -shared -o runtime.so runtime.c
/usr/bin/ld: /tmp/cciA7KuP.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/tmp/cciA7KuP.o: could not read symbols: Bad value
collect2: ld returned 1 exit status

Environment

  • Red Hat Enterprise Linux 5 64bits

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.