relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
<p>I'm trying to run the following makefile for JNI in Eclipse on Ubuntu 14.04</p>

<pre><code>CLASS_PATH = ../bin

vpath %.class $(CLASS_PATH)

all : libSend.so

libSend.so : Send.o
        gcc -fPIC -shared -o $@ $&lt;

Send.o : Send.c Send.h
        gcc -fPIC -I"/usr/lib/jvm/java-8-openjdk-amd64/include" -I"/usr/lib/jvm/java-8-openjdk-amd64/include/linux" -c $&lt; -o $@

Send.h : Send.class
        javah -classpath $(CLASS_PATH) $*

clean :
        rm Send.h Send.o libSend.so
</code></pre>

<p>When I try to build this makefile. I'm getting the follwing error:</p>

<pre><code>make all 
javah -classpath ../bin Send
gcc -fPIC -shared -o libSend.so Send.o
/usr/bin/ld: Send.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
Send.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [libSend.so] Error 1
</code></pre>

<p>Please help me to resolve this issue.</p>