11

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.

1
  • .so files are the standard in Ubuntu. In which (binary) packages are you unable to find .so files? Jul 15, 2014 at 14:48

3 Answers 3

6

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
2

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
1
  • don`t forget to make clean after adding -fPIC flag
    – user370852
    Jan 21, 2015 at 13:24
1

Relocation R_X86_64_PC32 against undefined symbol , usually happens when LDFLAGS are set with hardening and CFLAGS not .
Maybe just user error:
If you are using -specs=/usr/lib/rpm/redhat/redhat-hardened-ld at link time, you also need to use -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 at compile time, and as you are compiling and linking at the same time, you need either both, or drop the -specs=/usr/lib/rpm/redhat/redhat-hardened-ld . Common fixes :
https://bugzilla.redhat.com/show_bug.cgi?id=1304277#c3
https://github.com/rpmfusion/lxdream/blob/master/lxdream-0.9.1-implicit.patch

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .