make error "recompile with -fPIC"

I tried a standard installation. autoreconf , configure
I have this error. I don't understand what fPIC do.
How should I run ./configure? I tried --with-pic ,but no difference.

make all-recursive
make[1]: Entering directory `/home/bob/telem/mocp/trunk'
Making all in themes
make[2]: Entering directory `/home/bob/telem/mocp/trunk/themes'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/bob/telem/mocp/trunk/themes'
Making all in decoder_plugins
make[2]: Entering directory `/home/bob/telem/mocp/trunk/decoder_plugins'
Making all in vorbis
make[3]: Entering directory `/home/bob/telem/mocp/trunk/decoder_plugins/vorbis'
/bin/bash ../../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../.. -I../.. -pthread -g -O2 -Wall -W -I/usr/include/alsa -MT libvorbis_decoder_la-vorbis.lo -MD -MP -MF .deps/libvorbis_decoder_la-vorbis.Tpo -c -o libvorbis_decoder_la-vorbis.lo `test -f 'vorbis.c' || echo './'`vorbis.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../.. -I../.. -pthread -g -O2 -Wall -W -I/usr/include/alsa -MT libvorbis_decoder_la-vorbis.lo -MD -MP -MF .deps/libvorbis_decoder_la-vorbis.Tpo -c vorbis.c -fPIC -DPIC -o .libs/libvorbis_decoder_la-vorbis.o
mv -f .deps/libvorbis_decoder_la-vorbis.Tpo .deps/libvorbis_decoder_la-vorbis.Plo
/bin/bash ../../libtool --tag=CC --mode=link gcc -I../.. -pthread -g -O2 -Wall -W -I/usr/include/alsa -module -avoid-version -o libvorbis_decoder.la -rpath /usr/local/lib/moc/decoder_plugins libvorbis_decoder_la-vorbis.lo -lvorbisfile -lvorbis -lm -logg -lm -ldb
libtool: link: rm -fr .libs/libvorbis_decoder.la .libs/libvorbis_decoder.lai .libs/libvorbis_decoder.so
libtool: link: gcc -shared -fPIC -DPIC .libs/libvorbis_decoder_la-vorbis.o /usr/lib/x86_64-linux-gnu/libvorbisfile.so /usr/lib/x86_64-linux-gnu/libvorbis.so -logg -lm -ldb -pthread -O2 -pthread -Wl,-soname -Wl,libvorbis_decoder.so -o .libs/libvorbis_decoder.so
libtool: link: ( cd ".libs" && rm -f "libvorbis_decoder.la" && ln -s "../libvorbis_decoder.la" "libvorbis_decoder.la" )
make[3]: Leaving directory `/home/bob/telem/mocp/trunk/decoder_plugins/vorbis'
Making all in ffmpeg
make[3]: Entering directory `/home/bob/telem/mocp/trunk/decoder_plugins/ffmpeg'
/bin/bash ../../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../.. -I/usr/local/include -I../.. -I/usr/local/include -I../.. -pthread -g -O2 -Wall -W -I/usr/include/alsa -MT libffmpeg_decoder_la-ffmpeg.lo -MD -MP -MF .deps/libffmpeg_decoder_la-ffmpeg.Tpo -c -o libffmpeg_decoder_la-ffmpeg.lo `test -f 'ffmpeg.c' || echo './'`ffmpeg.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../.. -I/usr/local/include -I../.. -I/usr/local/include -I../.. -pthread -g -O2 -Wall -W -I/usr/include/alsa -MT libffmpeg_decoder_la-ffmpeg.lo -MD -MP -MF .deps/libffmpeg_decoder_la-ffmpeg.Tpo -c ffmpeg.c -fPIC -DPIC -o .libs/libffmpeg_decoder_la-ffmpeg.o
ffmpeg.c: In function 'locking_cb':
ffmpeg.c:306:2: warning: 'result' may be used uninitialized in this function [-Wuninitialized]
mv -f .deps/libffmpeg_decoder_la-ffmpeg.Tpo .deps/libffmpeg_decoder_la-ffmpeg.Plo
/bin/bash ../../libtool --tag=CC --mode=link gcc -I/usr/local/include -I../.. -pthread -g -O2 -Wall -W -I/usr/include/alsa -module -avoid-version -o libffmpeg_decoder.la -rpath /usr/local/lib/moc/decoder_plugins libffmpeg_decoder_la-ffmpeg.lo -pthread -L/usr/local/lib -lavformat -lavcodec -ldl -lasound -lSDL -lz -lrt -lavutil -lm -lm -ldb
libtool: link: gcc -shared -fPIC -DPIC .libs/libffmpeg_decoder_la-ffmpeg.o -L/usr/local/lib -lavformat -lavcodec -ldl -lasound -lSDL -lz -lrt -lavutil -lm -ldb -pthread -O2 -pthread -pthread -Wl,-soname -Wl,libffmpeg_decoder.so -o .libs/libffmpeg_decoder.so
/usr/bin/ld: /usr/local/lib/libavformat.a(allformats.o): relocation R_X86_64_32 against `ff_a64_muxer' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libavformat.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[3]: *** [libffmpeg_decoder.la] Error 1
make[3]: Leaving directory `/home/bob/telem/mocp/trunk/decoder_plugins/ffmpeg'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/bob/telem/mocp/trunk/decoder_plugins'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/bob/telem/mocp/trunk'
make: *** [all] Error 2

My first guess is that you only have static FFmpeg/LibAV libraries installed and not the shared libraries (which MOC requires). In the directory where these libraries live (/usr/lib or /usr/local/lib), are there any files matching libav*.so* or are they all libav*.a? Which distribution are you using and how did you install these libraries?

I've now reproduced this problem by building MOC against static-only FFmpeg libraries. Can you just confirm this is what you're doing?

This is the sort of problem which should be caught by an appropriately coded configure step, but it would have to be done for all plug-in decoder libraries and introduces a coupling which ideally MOC shouldn't have. I've not noted any other application testing specificly for shared libraries; it may be a step too far.

I compiled ffmpeg before, followed an Ubuntu guide (12.04) : http://trac.ffmpeg.org/wiki/UbuntuCompilationGuide
I dont know i have a static libraries or not.

:~$ find /usr/lib* -name "libav*.so"
/usr/lib/x86_64-linux-gnu/libavutil.so
/usr/lib/x86_64-linux-gnu/libavahi-common.so
/usr/lib/x86_64-linux-gnu/libavcodec.so
/usr/lib/x86_64-linux-gnu/libavahi-client.so
/usr/lib/x86_64-linux-gnu/libavformat.so
/usr/lib/vlc/plugins/demux/libavi_plugin.so
/usr/lib/vlc/plugins/demux/libavformat_plugin.so
/usr/lib/vlc/plugins/codec/libavcodec_plugin.so
:~$ find /usr/local/lib* -name "libav*.so"
:~$ find /usr/lib* -name "libav*.a"
/usr/lib/x86_64-linux-gnu/libavahi-client.a
/usr/lib/x86_64-linux-gnu/libavutil.a
/usr/lib/x86_64-linux-gnu/libavahi-common.a
/usr/lib/x86_64-linux-gnu/libavcodec.a
/usr/lib/x86_64-linux-gnu/libavformat.a
:~$ find /usr/local/lib* -name "libav*.a"
/usr/local/lib/libavdevice.a
/usr/local/lib/libavutil.a
/usr/local/lib/libavcodec.a
/usr/local/lib/libavfilter.a
/usr/local/lib/libavformat.a


:~$ ffmpeg
ffmpeg version git-2013-08-02-154c8bf Copyright (c) 2000-2013 the FFmpeg developers
built on Aug 3 2013 00:38:52 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configuration: --prefix=/home/bob/ffmpeg_build --extra-cflags=-I/home/bob/ffmpeg_build/include --extra-ldflags=-L/home/bob/ffmpeg_build/lib --bindir=/home/bob/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab

As far as I can tell, that FFmpeg UbuntuCompilationGuide recipe isn't going to work as is and if you don't know why it won't work you won't know enough to fix it.

It seems that what you've ended up with is multiple FFmpegs installed in three places:

  • /usr/lib as both static and shared libraries
  • /usr/local/lib as static libraries only
  • /home/bob/ffmpeg_build/lib with no additional information

I suspect the first was the result of your initial distribution install, the second the result of a previous self-install, and the third the result of your latest install. Looking at the file dates will clarify this.

The MOC configure is looking (or has been told to look) in /usr/local/lib and thus finding only static libraries.

You first need to clean out the self-installed copies of FFmpeg. If there's no real need to install FFmpeg from source, I'd suggest you then install your Ubuntu's FFmpeg '-dev' package. (You may need to remove your Ubuntu installed FFmpeg first; sorry, I'm not a Ubuntu user.)

If you really do need to install FFmpeg from source then get back to us and I (or hopefully an actual Ubuntu user) will get back to you with more workable instructions.

I couldnt find ffmpeg-dev.
I've successfully compiled ffmpeg following ubuntu guide but with --enable-shared
Added local libs to /etc/ld.so.conf
Moc is compiled. I removed the default package. Now I have 2.5.0 beta1 !

I love MOC , is my choice for playing music on my Linux ! Terminal is rocks !

I'm not sure that your system is in a completely healthy state with reqgard to the multiple FFmpeg libraries now, but at least you're up and working again.

MOC 2.5.0-beta1 is a much cleaner version that alpha4 was, and the good news is that with a couple of debugging breakthroughs this very morning beta2 is now just around the corner with even more bug fixes. I'm glad you find MOC so enjoyable.

Your system gets crazy that way. moc beta1 is available in Ubuntu universe. Why don't you install that version?

Elimar

I have 1:2.5.0~alpha4+svn20120224-1ubuntu1 for 12.04 in Universe repo.