Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to install pymedia: on ubuntu. I'm fine with building pymedia itself from source, as that seems my only option, but I'd rather not have source built versions of its prerequisites lying around if I can avoid it.

I installed most of the prereq's with the following:

sudo apt-get install python-dev libogg-dev libvorbis-dev libfaad-dev libasound2-dev libmp3lame-dev

Then I downloaded the pymedia source tarball and ran:

python build

With that I get:

OGG          : found
VORBIS       : found
FAAD         : found
MP3LAME      : found
VORBISENC    : found
ALSA         : found
Continue building pymedia ? [Y,n]:

Which looks good. I hit yes.. and it errors out with:

g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-x86_64-2.6/sound/sound.o build/temp.linux-x86_64-2.6/sound/resample.o build/temp.linux-x86_64-2.6/sound/fft.o -logg -lvorbis -lfaad -lmp3lame -lvorbisenc -lasound -o build/lib.linux-x86_64-2.6/pymedia/audio/
/usr/bin/ld: build/temp.linux-x86_64-2.6/sound/sound.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
build/temp.linux-x86_64-2.6/sound/sound.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
error: command 'g++' failed with exit status 1

What gives?

share|improve this question

This error is not related to the prereqs, it's likely a bad build script.

If I understand this correct (my C-foo is weak) 64bits shared libraries must be compiled with the -fPIC flag and sound.cpp isn't in this case.

In the of pymedia there is a function called *disable_fPIC* that forces gcc to compile all it's libraries without it. You can try to disable that function (just replace all the code with a pass statement) and try to compile it again. It shoul read something like this:

def disable_fPIC():

I can't test it as my machine is 32bits, so I can just hope that it helps.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.