Relocation R_X86_64_32S against `.rodata' ... While compiling on 64-bit platform

Trying to compile xmlrpc-c-1.06.41 in CentOS 6.5, I have encountered same linking problem, which was solved by the following: In ./src/cpp, I have modified Makefile: line 142 to

CXXFLAGS = $(CXXFLAGS_COMMON) $(CFLAGS_PERSONAL) $(CADD) -shared -fPIC

More info regarding the flags can be found link


I encountered the same problem when I try to create a shared library which need to link a static library.

I solved the problem by adding -fPIC to CXXFLAGS to compile .o files which are archived in the static library.


If this problem still exist after adding "-fPIC",try clean all the .o files,and run again


The solution was to compile everything with -fPIC, and link shared objects with -shared.

Add -fPIC to CFLAGS or CXXFLAGS for make-based projects.