우분투에서 pymedia를 설치하는 동안 "오류: 'c++' 명령이 종료 상태 1로 실패했습니다"가 발생했습니다.

우분투에서 pymedia를 설치하는 동안 "오류: 'c++' 명령이 종료 상태 1로 실패했습니다"가 발생했습니다.

Python 2.7을 사용하여 스크립트를 실행하기 위해 우분투에 pymedia를 설치하려고합니다. 그래서 종속성을 추적하여 설치했습니다.

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

따라서 위의 설치를 마쳤을 때 pymedia를 빌드하는 다음 단계에서 다음을 얻었습니다.

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

인쇄물에서 볼 수 있듯이 패키지는 (제대로 설치되었음에도 불구하고) '찾을 수 없음'으로 언급됩니다. 그리고 오류의 결론은 나에게 gcc 오류처럼 보입니다. 누군가 여기서 무엇이 잘못될 수 있는지 지적할 수 있다면 정말 도움이 될 것입니다.

답변1

아주 많은 사람들이 이 문제를 겪고 있습니다. 이는 아마도 엉망인 스크립트 때문일 가능성이 높습니다.

분명히 64비트 공유 라이브러리는 플래그를 사용하여 컴파일해야 하며 -fPIC이 경우 sound.cpp는 그렇지 않습니다.

여기 에는 setup.py라는 함수가 있습니다 disable_fPIC(). 해당 함수에 속한 모든 코드를 명령문으로 바꾸면 함수를 비활성화할 수 있습니다 pass.그래서:

def disable_fPIC():
  pass

관련 정보