I was trying to wrapper MSDK sample codes to a shared library, when I ran into this issue:
relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
Can anyone help me out of this? Thanks a lot.
Something must be mentioned here:
1. Before compiling it to a shared library, I tested my codes by compiling it to a static library, and everything is fine.
2. Tried add -fPIC to my Makefile which used to build the shared library, nothing new happened.\
3. My working environment:
Intel Media SDK:4.0.024-HSW
OS: Ubuntu 12.04 server 64 bit with kernel 3.2
CPU: Core ivy bridge i7-3770
Here is the detail error info:
g++ -Xlinker -fPIC -shared -o "libmsdk_dec.so" ./kdvcodec_msdkdec.o ./vaapi_decode_render.o -lmsdk_common -lmfx -ldl -lva -lva-x11 -lX11
/usr/bin/ld: ./kdvcodec_msdkdec.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
./kdvcodec_msdkdec.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [libmsdk_dec.so] Error 1