wrapping MSDK to a shared library

wrapping MSDK to a shared library

Аватар пользователя Jacky W.

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

4 posts / 0 новое
Последнее сообщение
Пожалуйста, обратитесь к странице Уведомление об оптимизации для более подробной информации относительно производительности и оптимизации в программных продуктах компании Intel.
Аватар пользователя andy4us

MY guess is that the sources also need to be rebuilt. Force a clean. Probably it is not rebuilding the sources because the source files have not changed, so it's just trying to relink.

Аватар пользователя Jacky W.

What source are you refering to? If you mean the source of my wrapper, then it has been rebuilt for times (with all .o files cleaned/removed), however, whatever I do, the error remains.

I'm wondering, could it have something to do with the mfx.lib which I can never rebuild???

Аватар пользователя Jacky W.

Update:

This issue has been confirmed that was caused by one another static library libmsdk_common.a which did not add -fPIC in compiling.
After rebuilt that library with -fPIC, then my library finally can be built as a shared library.

Thanks.

Зарегистрируйтесь, чтобы оставить комментарий.