gcc error trying to exec cc1plus execvp нет такого файла или каталога
Ошибка компиляции: «g++: ошибка при попытке выполнить «cc1plus»: execvp: нет такого файла или каталога»
но если я запускаю PHP-код в оболочке.. работает отлично..
7 ответов
вам нужно установить gcc-c++ пакета.
Я не знаю, почему, но я просто переименовал свой исходный файл COLARR.C-коларру.C и ошибка исчезла! вероятно, вам это нужно
эта проблема может возникнуть, если установлены разные версии g++ и gcc.
если они не дают результата, у вас, вероятно, установлено несколько версий gcc. Вы можете проверить, используя:
обычно /usr/bin /gcc будет sym-связан с/etc/alternatives /gcc, который снова sym-связан с say/usr/bin /gcc-4.6 или/usr/bin / gcc-4.8 (если у вас установлен gcc-4.6, gcc-4.8.)
изменив эту ссылку, вы можете сделать gcc и g++ работать в одной и той же версии и это может решить вашу проблему!
каждый компилятор имеет свой собственный каталог libexec/. Обычно каталог libexec содержит небольшие вспомогательные программы, вызываемые другими программами. В этом случае gcc ищет свой собственный компилятор «cc1». Ваша машина может содержать разные версии gcc, и каждая версия должна иметь свой собственный «cc1». Обычно эти компиляторы находятся на:
аналогичный путь для g++. Выше ошибка означает, что текущая версия gcc используется не в состоянии найти свой собственный компилятор «cc1». Этот обычно указывает на проблему пути.
у меня была та же проблема с gcc «gnat1», и это было связано с неправильным путем. Gnat1 был на версии 4.6, но я выполнял версию 4.8.1, которую я установил. В качестве временного решения я скопировал gnat1 из 4.6 и вставил в папку 4.8.1.
Вы можете найти путь, используя команду find:
в вашем случае вы бы искали cc1plus:
конечно, это быстрое решение, и более твердый ответ будет фиксировать сломанный путь.
gcc: error trying to exec ‘cc1plus’: execvp: No such file or directory
I’m trying to install this python module, which requires compilation (on Ubuntu 16.04). I’m struggling to understand exactly what’s causing it stall; what am I missing?
6 Answers 6
The following worked for me:
The routine commands that saved me time after time for such errors:
This link helped me to fix this issue.
You need to run below command to get g++ installed
That helped me to build Python greenlet on Docker alpine
For Conda environments the following should help:
See an old discussion about this issue here.
Not the answer you’re looking for? Browse other questions tagged python gcc or ask your own question.
Linked
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.11.10.40696
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
Компиляция программ на С++
При компиляции программы на С++ выдает: gcc: error trying to exec ‘cc1plus’:execvp: No such file or directory. В то же время, программа на С в том же каталоге нормально компилируется. Получается файл на С видит, а файл на С++ нет? В чем может быть дело.
Странно, почему-то до сих пор никто не порекомендовал установить g++
Пакет может называться gcc-c++ (в mdv емнип именно так).
$ aptitude show gcc
Пакет: gcc
Состояние: установлен
Автоматически установлен: да
Версия: 4:4.4.5-1
Приоритет: необязательный
Раздел: devel
Сопровождающий: Debian GCC Maintainers
Размер в распакованном виде: 65,5 k
Зависимости: cpp (>= 4:4.4.5-1), gcc-4.4 (>= 4.4.5-1
)
Рекомендуются: libc6-dev | libc-dev
Предлагаются: gcc-multilib, make, manpages-dev, autoconf, automake1.9, libtool, flex, bison, gdb, gcc-doc
Конфликтуют: gcc-doc (
Размер в распакованном виде: 41,0 k
Зависимости: cpp (>= 4:4.4.5-1), gcc (>= 4:4.4.5-1), g++-4.4 (>= 4.4.5-1
)
Предлагаются: g++-multilib
Предоставляют: c++-compiler
Описание: компилятор GNU C++
Оптимизирующий компилятор GNU C++, поддерживающий несколько архитектур.
Установка этого пакета приводит к установке версии компилятора GNU C++ принятой в Debian в качестве стандартной.
В Debian получается так )
Я думаю, тут не хватает g++
Вы путаете божий дар с яичницей. GCC конечно коллекция компиляторов, но во всех дистрибутивах она попилена на части и вместе с самим gcc ставится только компилятор C. Поставьте g++, это и есть часть gcc для компиляции плюсов.
Тебя мама гуглом не научила пользоваться.
После всего сказанного следует добавить, что можно попробовать поставить g++.
> error trying to exec ‘cc1plus’:execvp: No such file or directory
Можно, но только после установки g++
Дело в том, что ты компилируешь с помощью gcc, а тебе, как я понял, нужен g++.
у меня подозрение, что не хватает g++
Не слушай идиотов. Ставь g++.
Имхо, для компиляции программ на C++ нужен компилятор С++. Попробуй поставить g++.
apt-get install google.
исходник в студию, наверняка там ошибки, вот и не комплилирует
gcc — это драйвер компилятора, враппер, вызывающий нужный компилятор нужного языка. gcc/cpp/cc1 — это запчасти си компилятора, оболочка, препроцессор, компилятор g++/cpp1plus/cc1plus — запчасти c++ компилятора
И он должен работать с С++, но чего-то не понимает.
Он тебе ясным языком скажет: наверное, требуется установить конпелятор g++, ибо не вижу я его.
Сделай как он того хочет, установи g++ и будет тебе щасте!111
Gcc error: gcc: error trying to exec ‘cc1’: execvp: No such file or directory
24 Answers 24
Explanation
The error message told us, that the build-time dependency (in this case it is cc1 ) was not found, so all we need — install the appropriate package to the system (using package manager // from sources // another way)
cc1 is the internal command which takes preprocessed C-language files and converts them to assembly. It’s the actual part that compiles C. For C++, there’s cc1plus, and other internal commands for different languages.
Solution for: Ubuntu / Linux Mint
Solution for: Docker-alpine environment
If you are in docker-alpine environment install the build-base package by adding this to your Dockerfile :
Better package name provided by Pablo Castellano. More details here.
If you need more packages for building purposes, consider adding of the alpine-sdk package:
Solution for: CentOS/Fedora
This answer contains instructions for CentOS and Fedora Linux
Solution for: Amazon Linux
You could also try to install missed dependencies by this (though, it is said to not to solve the issue):
On CentOS or Fedora
On debian / ubuntu I fixed this problem by reinstalling build-essential :
This is because gcc calls many other executables to complete the processing of the input, and cc1 is not in the included path.
Amazon Linux: fixing GCC issue
Since this comes up as the first result on Google, I just wanted to document my experience with Amazon Linux. Installing gcc-c++.noarch fixed the problem:
sudo yum install gcc-c++.noarch
Some people also reported this alternative as a solution:
sudo yum install gcc72-c++
I fixed this problem by explicitly installing g++:
Problem was encountered on Ubuntu 12.04 while installing pandas. (Thanks perilbrain.)
His executable path looked reasonable but the fact that I could not easily replicate the failure suggested something in his environment as the cause.
yum install gcc-c++ did the fix.
Make sure your GCC_EXEC_PREFIX(env) is not exported and your PATH is exported to right tool chain.
I experienced this soon after compiling and installing a shiny new GCC — version 8.1 — on RHEL 7. In the end, it ended up being a permissions problem; my root umask was the culprit. I eventually found cc1 hiding in /usr/local/libexec :
However, the permissions on the directories leading there didn’t allow my standard user account:
A quick recursive chmod to add world read/execute permissions fixed it right up:
And now gcc can find cc1 when I ask it to compile something!
Just to complement @maxkoryukov’s answer regarding Alpine.
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:
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.
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.
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.
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.
Compile error: «g++: error trying to exec ‘cc1plus’: execvp: No such file or directory»
but if I run php code in shell.. it works fine..
10 Answers 10
You need to install gcc-c++ package.
I don’t know why but i just renamed my source file COLARR.C to colarr.c and the error vanished! probably you need this
This problem can happen if different versions of g++ and gcc are installed.
If these don’t give the result, you probably have multiple versions of gcc installed. You can check by using:
Usually, /usr/bin/gcc will be sym-linked to /etc/alternatives/gcc which is again sym-linked to say /usr/bin/gcc-4.6 or /usr/bin/gcc-4.8 (In case you have gcc-4.6, gcc-4.8 installed.)
By changing this link you can make gcc and g++ run in the same version and this may resolve your issue!
Each compiler has its own libexec/ directory. Normally libexec directory contains small helper programs called by other programs. In this case, gcc is looking for its own ‘cc1’ compiler. Your machine may contains different versions of gcc, and each version should have its own ‘cc1’. Normally these compilers are located on:
Similar path for g++. Above error means, that the current gcc version used is not able to find its own ‘cc1’ compiler. This normally points to a PATH issue.