Encontrado “erro: comando 'c++' falhou com status de saída 1” ao tentar instalar o pymedia no Ubuntu

Encontrado “erro: comando 'c++' falhou com status de saída 1” ao tentar instalar o pymedia no Ubuntu

Estou tentando instalar o pymedia no Ubuntu para executar scripts usando python 2.7. Então, localizei as dependências e as instalei:

sudo apt-get install python-dev libogg-dev libvorbis-dev liblame-dev libfaad2-dev libasound2-dev python-pygame libmp3lame-dev libevent-dev

Então, quando terminei de instalar o acima, durante a próxima etapa que foi construir o pymedia, obtive o seguinte:

Using UNIX configuration...

OGG          : not found
VORBIS       : not found
FAAD         : not found
MP3LAME      : not found
VORBISENC    : not found
ALSA         : not found
Continue building pymedia ? [Y,n]:y
running build
running build_py
running build_ext
building 'pymedia.audio.sound' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -DBUILD_NUM=1866 -DPATH_DEV_DSP="/dev/dsp" -DPATH_DEV_MIXER="/dev/mixer" -D_FILE_OFFSET_BITS=64 -DACCEL_DETECT=1 -DHAVE_MMX=1 -DHAVE_LINUX_DVD_STRUCT=1 -DDVD_STRUCT_IN_LINUX_CDROM_H=1 -DHAVE_AV_CONFIG_H -DUDF_CACHE=1 -I/home/simran/Downloads/pymedia-1.3.7.3 -Isound/ -I/usr/include/python2.7 -c sound/sound.cpp -o build/temp.linux-x86_64-2.7/sound/sound.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
<command-line>:0:14: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
sound/audio_unix.h:54:18: note: in expansion of macro ‘PATH_DEV_DSP’
static char *dsp=PATH_DEV_DSP;
              ^
<command-line>:0:16: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
sound/audio_unix.h:55:15: note: in expansion of macro ‘PATH_DEV_MIXER’
char *mixer = PATH_DEV_MIXER;
           ^
In file included from sound/sound.cpp:33:0:
sound/audio_unix.h: In member function ‘bool Mixer::SetControlValue(int, int, int, int, int)’:
sound/audio_unix.h:838:7: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wparentheses]
 if( iControl )
   ^
sound/sound.cpp: At global scope:
sound/sound.cpp:791:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
 };
 ^
sound/sound.cpp:791:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
sound/sound.cpp:791:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
sound/sound.cpp:791:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
sound/sound.cpp:791:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
sound/sound.cpp:791:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
sound/sound.cpp:791:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
sound/sound.cpp:791:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
sound/sound.cpp:791:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
sound/sound.cpp:791:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
sound/sound.cpp:798:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
};
^
sound/sound.cpp:798:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
sound/sound.cpp: In function ‘void initsound()’:
sound/sound.cpp:1451:66: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
g_cErr = PyErr_NewException(MODULE_NAME".SoundError", NULL, NULL);
                                                              ^
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -DBUILD_NUM=1866 -DPATH_DEV_DSP="/dev/dsp" -DPATH_DEV_MIXER="/dev/mixer" -D_FILE_OFFSET_BITS=64 -DACCEL_DETECT=1 -DHAVE_MMX=1 -DHAVE_LINUX_DVD_STRUCT=1 -DDVD_STRUCT_IN_LINUX_CDROM_H=1 -DHAVE_AV_CONFIG_H -DUDF_CACHE=1 -I/home/simran/Downloads/pymedia-1.3.7.3 -Isound/ -I/usr/include/python2.7 -c sound/resample.c -o build/temp.linux-x86_64-2.7/sound/resample.o
sound/resample.c: In function ‘fractional_resample’:
sound/resample.c:48:24: warning: variable ‘incr’ set but not used [-Wunused-but-set-variable]
 unsigned int frac, incr;
                    ^
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -DBUILD_NUM=1866 -DPATH_DEV_DSP="/dev/dsp" -DPATH_DEV_MIXER="/dev/mixer" -D_FILE_OFFSET_BITS=64 -DACCEL_DETECT=1 -DHAVE_MMX=1 -DHAVE_LINUX_DVD_STRUCT=1 -DDVD_STRUCT_IN_LINUX_CDROM_H=1 -DHAVE_AV_CONFIG_H -DUDF_CACHE=1 -I/home/simran/Downloads/pymedia-1.3.7.3 -Isound/ -I/usr/include/python2.7 -c sound/fft.cpp -o build/temp.linux-x86_64-2.7/sound/fft.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
c++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/sound/sound.o build/temp.linux-x86_64-2.7/sound/resample.o build/temp.linux-x86_64-2.7/sound/fft.o -o build/lib.linux-x86_64-2.7/pymedia/audio/sound.so
/usr/bin/ld: build/temp.linux-x86_64-2.7/sound/sound.o: relocation R_X86_64_32 against `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
build/temp.linux-x86_64-2.7/sound/sound.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
error: command 'c++' failed with exit status 1

Como pode ser visto pelos prints, os pacotes (apesar de terem sido instalados corretamente), são mencionados como 'não encontrados'. E o resultado final do erro parece um erro do gcc para mim. Será muito útil se alguém puder apontar o que pode estar errado aqui.

Responder1

Muitas, muitas pessoas têm esse problema - provavelmente é devido a um script confuso.

Aparentemente, bibliotecas compartilhadas de 64 bits devem ser compiladas com o -fPICsinalizador e sound.cpp não está neste caso.

Existe setup.pyuma função chamada disable_fPIC()- você pode desativar a função simplesmente substituindo todo o código que pertence a ela por instrução pass.Então:

def disable_fPIC():
  pass

informação relacionada