Re: Trouble compiling transcode
Hi.
> gcc -shared .libs/import_ffmpeg.o -ldl -lz -lm -lpthread -lavcodec
> -L/usr/lib -Wl,-soname -Wl,import_ffmpeg.so -o .libs/import_ffmpeg.so
> /usr/bin/ld: /usr/lib/libavcodec.a(utils.o): relocation R_X86_64_32S
> against `a local symbol' can not be used when making a shared object;
> recompile with -fPIC
> I tried adding fPIC to the line:
> CFLAGS = -Wall -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
> -D_FILE_OFFSET_BITS=64 -g -O2
> in Makefile, but no change.
The key point is where to add -fPIC,
problem is in libavcodec.a, not the transcode.
Package libavcodec-dev contains two libraries,
/usr/lib/libavcodec.a and /usr/lib/libavcodec_pic.a
For creating shared library, you have to link with libavcodec_pic.
gcc -shared .libs/import_ffmpeg.o -ldl -lz -lm -lpthread -lavcodec_pic
-L/usr/lib -Wl,-soname -Wl,import_ffmpeg.so -o .libs/import_ffmpeg.so
Regards
Petr
Reply to: