R_X86_64_32 error when compiling a shared object with gcc

Solution Unverified - Updated -


$ 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


  • Red Hat Enterprise Linux 5 64bits

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content