What to do with "recompile with -fPIC" message

I'm trying to configure the ffmpeg source package to build .so files rather than .a files.

I run make after doing ./configure --enable-shared

This gives me the following message:

/usr/bin/ld: libavutil/display.o: relocation R_X86_64_PC32 against undefined symbol 'hypot@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC

However, I'm not sure where and how to add the -fPIC flag.


There is a ./configure option which might be the easiest way to solve the issue:

andrew@ilium~/source/ffmpeg_build/ffmpeg/ffmpeg$ ./configure --help | grep -i pic
--enable-pic             build position-independent code

I have solved the same error for compiling FFMpeg 2.3.3 sources at Ubuntu 14.04 LTS. I have successfuly compiled the code after set LD_LIBRARY_PATH to /usr/lib/x86_64-linux-gnu and added -fPIC flag to --cc. My working compile commands is here :

LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
./configure --prefix=.. --enable-shared --enable-gpl --enable-version3 --enable-runtime-cpudetect --disable-outdev=sdl --disable-opencl --enable-libmp3lame --enable-libx264 --cc="gcc -m64 -fPIC" --extra-cflags="-I../include" --extra-ldflags="-L../lib -ldl"
make -j4