ubuntu 12.04 - elocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC -


my server on ubuntu 12.04.

i'm trying install levenshtein-mysql-udf available here : https://github.com/jmcejuela/levenshtein-mysql-udf

i downloaded .zip , locate levenshtein.c file here on server : /home/username/levenshtein.c

when enter in terminal following command :

gcc -o levenshtein.so -shared /home/username/levenshtein.c -i /usr/include/mysql/ 

i obten error :

/usr/bin/ld: /tmp/cccpqijg.o: relocation r_x86_64_32 against `.rodata' can not used when making shared object; recompile -fpic 

/tmp/cccpqijg.o: not read symbols: bad value collect2: ld returned 1 exit status

i googled error find how solve , install build-essential, after have same error.

i don't know how can use -fpic recompile correctly must recompile...

i found lot of topics little bit different of mine , don't know solve problem.

anyone me please ?

thanks ;-)

bbfunk01

i had same problem. after build-essential installation compile shared library -fpic flag:

gcc -fpic -o levenshtein.so -shared /home/username/levenshtein.c -i /usr/include/mysql/ 

just in case install libc6-dev.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -