Gcc 오류 : gcc : 'cc1'exec 시도 오류 : execvp : 해당 파일 또는 디렉토리가 없습니다.
Linux Mint 12에서 gcc를 성공적으로 사용하고 있습니다. 이제 오류가 발생합니다. 나는 최근에 몇 가지 .so 빌드를 수행하고 얼마 전까지 Clang을 설치했지만 두 이벤트 이후 성공적으로 컴파일되었으므로 무엇이 변경되었는지 확실하지 않습니다. GUI 소프트웨어 관리자를 사용하여 gcc를 제거한 다음 다시 설치했지만 결과는 동일합니다.
~/code/c/ut: which gcc
/usr/bin/gcc
~/code/c/ut: gcc -std=c99 -Wall -Wextra -g -c object.c
gcc: error trying to exec 'cc1': execvp: No such file or directory
데비안 / 우분투에서 다음을 다시 설치하여이 문제를 해결했습니다 build-essential
.
sudo apt-get update
sudo apt-get install --reinstall build-essential
CentOS 또는 Fedora에서
yum install gcc-c++
1. 설명
오류 메시지는 빌드 시간 종속성 (이 경우에는 cc1
)을 찾을 수 없으므로 필요한 모든 것-시스템에 적절한 패키지를 설치 (패키지 관리자 사용, 소스에서 빌드 또는 다른 방법 사용)
무엇입니까 cc1
:
cc1
전처리 된 C 언어 파일을 가져와 어셈블리로 변환하는 내부 명령입니다. C를 컴파일하는 실제 부분입니다. C ++의 경우 cc1plus 및 다른 언어에 대한 기타 내부 명령이 있습니다.
이 답변에서 가져온 에 의해 앨런 Shutko 씨 .
솔루션 : Ubuntu / Linux Mint
sudo apt-get install --reinstall build-essential
솔루션 : Docker-alpine 환경
docker-alpine 환경에 있는 경우 다음 을 추가 하여 빌드 기반 패키지를 설치 합니다 Dockerfile
.
RUN apk add build-base
Pablo Castellano가 제공 한 더 나은 패키지 이름 . 자세한 내용은 여기를 참조하세요 .
빌드 목적으로 더 많은 패키지가 필요한 경우 alpine-sdk 패키지 추가를 고려하십시오 .
RUN apk add alpine-sdk
솔루션 : Amazon Linux
sudo yum install gcc72-c++
에서 촬영 이 댓글 로 CoderChris
이 방법으로 누락 된 종속성을 설치하려고 할 수도 있습니다 ( 하지만 문제를 해결하지 않는다고합니다 ).
sudo yum install gcc-c++.noarch
이 답변 에서 가져온
이는 gcc
입력 처리를 완료하기 위해 다른 많은 실행 파일을 호출 cc1
하고 포함 된 경로에 없기 때문입니다.
쉘 유형 whereis cc1
. 경우 cc1
발견, 더 나은 가서의 디렉토리에 소프트 링크를 만들 것 gcc
; 그렇지 않으면 cc1
이 설치되어 있지 않으며 패키지 관리자를 사용하여 gcc-c ++ 를 설치해야합니다 .
Amazon Linux : GCC 문제 수정
이것이 Google의 첫 번째 결과이므로 Amazon Linux에 대한 경험을 문서화하고 싶었습니다. 설치 gcc-c++.noarch
하면 문제가 해결되었습니다.
sudo yum install gcc-c++.noarch
일부 사람들은이 대안을 해결책으로보고했습니다.
sudo yum install gcc72-c++
오늘도 비슷한 문제가 발생했습니다. 동료가 자신의 소프트웨어를 빌드 할 수는 없었지만 빌드 할 수있었습니다. 그가 달렸을 때 gcc
그것은 찾을 수 없습니다 cc1
.
그의 실행 경로는 합리적으로 보였지만 실패를 쉽게 복제 할 수 없다는 사실은 그의 환경에서 원인으로 무언가를 암시했습니다.
결국 우리는 발견 GCC_EXEC_PREFIX
범인이었다 자신의 환경에 정의와 오해의 소지가되었다 gcc
에 대한 검색에 cc1
. 이것은 그의 쉘 시작 스크립트의 일부였으며 더 이상 사용되지 않는 SPARC / Solaris 시스템의 제한 사항을 해결하기위한 것입니다. 이 환경 변수를 설정하지 않으면 문제가 해결되었습니다.
http://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html
g ++를 명시 적으로 설치하여이 문제를 해결했습니다.
sudo apt-get install g++
Pandas를 설치하는 동안 Ubuntu 12.04에서 문제가 발생했습니다. (위험 해 감사합니다.)
yum install gcc-c++
수정했습니다.
를 GCC_EXEC_PREFIX(env)
내 보내지 않았는지 확인 PATH
하고 올바른 도구 체인으로 내 보내야합니다.
나는 RHEL 7에서 새로운 GCC (버전 8.1)를 컴파일하고 설치 한 직후에 이것을 경험했습니다. 결국 권한 문제가되었습니다. 내 루트 umask가 범인이었습니다. 나는 결국 cc1
숨어있는 것을 발견 했습니다 /usr/local/libexec
.
[root@nacelle gdb-8.1]# ls -l /usr/local/libexec/gcc/x86_64-pc-linux-gnu/8.1.0/ | grep cc1
-rwxr-xr-x 1 root root 196481344 Jul 2 13:53 cc1
그러나 거기로 이어지는 디렉토리에 대한 권한은 내 표준 사용자 계정을 허용하지 않았습니다.
[root@nacelle gdb-8.1]# ls -l /usr/local/libexec/
total 4
drwxr-x--- 3 root root 4096 Jul 2 13:53 gcc
[root@nacelle gdb-8.1]# ls -l /usr/local/libexec/gcc/
total 4
drwxr-x--- 3 root root 4096 Jul 2 13:53 x86_64-pc-linux-gnu
[root@nacelle gdb-8.1]# ls -l /usr/local/libexec/gcc/x86_64-pc-linux-gnu/
total 4
drwxr-x--- 4 root root 4096 Jul 2 13:53 8.1.0
chmod
세계 읽기 / 실행 권한을 추가 하는 빠른 재귀 가 바로 수정되었습니다.
[root@nacelle 8.1.0]# cd /usr/local/libexec
[root@nacelle lib]# ls -l | grep gcc
drwxr-x--- 3 root root 4096 Jul 2 13:53 gcc
[root@nacelle lib]# chmod -R o+rx gcc
[root@nacelle lib]# ls -l | grep gcc
drwxr-xr-x 3 root root 4096 Jul 2 13:53 gcc
그리고 이제 내가 무언가를 컴파일하도록 요청할 때 gcc
찾을 수 있습니다 cc1
!
This might also be the displayed error message if you try to run 32-bit gcc binaries on a 64-bit OS and missing 32-bit glibc. According to this readme: "For 64 bit system, 32 bit libc and libncurses are required to run the tools.". In this case there is no problem with the path and cc1 is actually found, but reported as missing as no 32 bit glibc.
What helped for me was to use llvm-gcc
instead:
ln -s $(which llvm-gcc) /usr/local/bin/gcc
Just to document my trouble with this issue even though it just appears to be a specific example of other answers; as a relative newbie I feel like this might help others.
Solution:
I added '/usr/bin' to the beginning of PATH for a single session using PATH='/usr/path/:$PATH'
and everything started to work fine.
I used gedit to update the PATH permanently, after ensuring it wouldn't break my regular toolchains.
Explanation:
I have multiple toolchains installed on Ubuntu 14.04LTS and I use just a couple on a regular basis. When I tried to use gcc from the command line I got the issue describe by the OP. '/usr/bin' is in the PATH but it is behind the other toolchain locations. Turns out the cc1 for those other toolchains is incompatible with gcc.
Just to complement @maxkoryukov's answer regarding Alpine.
The equivalent to Debian's build-essential
in Alpine is build-base
. In fact, the above mentioned alpine-sdk
depends on build-base
.
/ # apk info -R build-base
build-base-0.5-r1 depends on:
binutils
file
gcc
g++
make
libc-dev
fortify-headers
/ # apk info -R alpine-sdk
alpine-sdk-1.0-r0 depends on:
abuild
build-base
git
You can fix that by running this: On Fedora:
sudo dnf install redhat-rpm-config
I experienced this problem on a reasonably fresh install of Fedora 27. I tried all the other suggestions or their equivalents; installing the various packages either said "already installed" or installed something new which didn't help.
Fixed with
# dnf remove gcc
# dnf install gcc gcc-c++
On Scientific Linux 6 (similar to CentOS 6-- SL is now replaced by CentOS, AIUI), I had to use /usr/sbin/prelink -av -mR
which I found suggested at https://stelfox.net/blog/2014/08/dependency-prelink-issues/
Until I did that, I got a cc1 error gcc: error trying to exec 'cc1': execvp: No such file or directory
when I tried to compile, and gcc --version reported 4.2.2 instead of 4.4.7, despite that version being reported by yum.
It may or may not be related, but the system had run out of space on /var
It's in this package (Ubuntu 19.04):
sudo apt install g++-6
'Nice programing' 카테고리의 다른 글
mysql 테이블 열 데이터 유형을 얻는 방법은 무엇입니까? (0) | 2020.10.06 |
---|---|
JavaScript로 사용자 에이전트 가져 오기 (0) | 2020.10.06 |
std :: dynarray 대 std :: vector (0) | 2020.10.05 |
OPTIONS 프리 플라이트 요청을 건너 뛰는 방법은 무엇입니까? (0) | 2020.10.05 |
만약 ' (0) | 2020.10.05 |