Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

wrapping MSDK to a shared library

Jacky_W_
Beginner
504 Views

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

0 Kudos
3 Replies
andy4us
Beginner
504 Views

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.

0 Kudos
Jacky_W_
Beginner
504 Views

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???

0 Kudos
Jacky_W_
Beginner
504 Views

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.

0 Kudos
Reply