I’m a newbie but adventuresome. I’m tri-booting Windows, Fedora, and Ubuntu 14.04 LTS (all 64). Learning but not using dpkg, apt, and apt-get. Starting to study C++ using Ubuntu (the only one with gcc installed). So on my first attempted compile I ran the command gcc xy.cc
and got the following:
gcc: error trying to exec 'cc1plus' : execvp: No such file or directory
So I searched my computer for cc1plus and execvp. And found neither.
Just execvp.3.gz in directory /user/share/man/man3
and cc1 in /user/lib/gcc/x86_64-linux-gnu/4.8
.
So a whole bunch of work and learning about the package getters and checkers, but no courage to remove and reinstall etc.
Do you have some suggestions?
Zanna♦
68.2k55 gold badges210 silver badges320 bronze badges
asked Jun 16, 2015 at 7:01
You’re possibly missing g++ package on your machine. Open a terminal and install it using the below command:
sudo apt-get install g++
To compile using g++ use this
g++ -o test.o test.cpp
g++ can be used to compile C++ source, the default ubuntu installation comes with gcc, but not with g++.
You are trying to compile C++ source using a C compiler. gcc usually successfully compiles C++ code but by default it doesn’t link any c++ specific libraries (refer to this answer on Stack Overflow).
If a message displays like : Couldn't find package ...
, then try the following commands
sudo apt-get update && sudo apt-get upgrade
then
sudo apt-get install g++
Zanna♦
68.2k55 gold badges210 silver badges320 bronze badges
answered Jun 16, 2015 at 7:49
AritraAritra
6515 silver badges6 bronze badges
1
cc1plus is the c++ backend (real compiler) for gcc, if you are primarily going to program in c++ you will really want to install g++ (will have cc1plus with it). Using one the package system front ends apt-get, synaptic, software manager, or a number of others it will install the dependencies with it.
execvp is a programming function, the file you found matching it is the man (manual) page for it. to view it open a terminal and type man execvp
. The man pages are often times online, and they have a TON of info in them on cli and programming stuff.
answered Jun 16, 2015 at 7:46
cargocargo
3511 silver badge7 bronze badges
I was cross-compiling a Linux kernel for my Raspberry Pi on a laptop (running debian 7) (followed the instructions in Raspberry Pi Kernel Compilation); but when compiling with
make ARCH=arm CROSS_COMPILE=${CCPREFIX}
I get the following messages:
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
CC kernel/bounds.s
gcc: error trying to exec 'cc1': execvp: No such file or directory
make[1]: *** [kernel/bounds.s] Error 1
make: *** [prepare0] Error 2
I figured that the problem was that cc1 couldn’t be found or that gcc
was not properly installed (and so I re-installed gcc with apt-get --reinstall install gcc
but no luck).
gcc -v
gives:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i486-linux-gnu/4.7/lto-wrapper
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --enable-targets=all --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.7.2 (Debian 4.7.2-5)
gcc -print-prog-name=cc1
gives:
/usr/lib/gcc/i486-linux-gnu/4.7/cc1
gcc -print-search-dirs
gives:
install: /usr/lib/gcc/i486-linux-gnu/4.7/
programs: =/usr/lib/gcc/i486-linux-gnu/4.7/:/usr/lib/gcc/i486-linux-gnu/4.7/:/usr/lib/gcc/i486-linux-gnu/:/usr/lib/gcc/i486-linux-gnu/4.7/:/usr/lib/gcc/i486-linux-gnu/:/usr/lib/gcc/i486-linux-gnu/4.7/../../../../i486-linux-gnu/bin/i486-linux-gnu/4.7/:/usr/lib/gcc/i486-linux-gnu/4.7/../../../../i486-linux-gnu/bin/i386-linux-gnu/:/usr/lib/gcc/i486-linux-gnu/4.7/../../../../i486-linux-gnu/bin/
libraries: =/usr/lib/gcc/i486-linux-gnu/4.7/:/usr/lib/gcc/i486-linux-gnu/4.7/../../../../i486-linux-gnu/lib/i486-linux-gnu/4.7/:/usr/lib/gcc/i486-linux-gnu/4.7/../../../../i486-linux-gnu/lib/i386-linux-gnu/:/usr/lib/gcc/i486-linux-gnu/4.7/../../../../i486-linux-gnu/lib/../lib/:/usr/lib/gcc/i486-linux-gnu/4.7/../../../i486-linux-gnu/4.7/:/usr/lib/gcc/i486-linux-gnu/4.7/../../../i386-linux-gnu/:/usr/lib/gcc/i486-linux-gnu/4.7/../../../../lib/:/lib/i486-linux-gnu/4.7/:/lib/i386-linux-gnu/:/lib/../lib/:/usr/lib/i486-linux-gnu/4.7/:/usr/lib/i386-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/i486-linux-gnu/4.7/../../../../i486-linux-gnu/lib/:/usr/lib/gcc/i486-linux-gnu/4.7/../../../:/lib/:/usr/lib/
and find / -type f -name cc1
gives:
/opt/tools/arm-bcm2708/arm-bcm2708-linux-gnueabi/libexec/gcc/arm-bcm2708-linux-gnueabi/4.7.1/cc1
/opt/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/libexec/gcc/arm-linux-gnueabihf/4.7.2/cc1
/opt/tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/libexec/gcc/arm-bcm2708hardfp-linux-gnueabi/4.7.1/cc1
/usr/lib/gcc/i486-linux-gnu/4.6/cc1
/usr/lib/gcc/i486-linux-gnu/4.7/cc1
Running dpkg -S cc1
gives:
libopencc1:i386: /usr/share/doc/libopencc1/changelog.Debian.gz
g++-4.7: /usr/lib/gcc/i486-linux-gnu/4.7/cc1plus
cpp-4.6: /usr/lib/gcc/i486-linux-gnu/4.6/cc1
libopencc1:i386: /usr/share/doc/libopencc1
cpp-4.7: /usr/lib/gcc/i486-linux-gnu/4.7/cc1
libopencc1:i386: /usr/share/doc/libopencc1/copyright
libgcc1:i386: /usr/share/lintian/overrides/libgcc1
ncurses-term: /usr/share/terminfo/x/xterm+pcc1
libgcc1:i386: /usr/share/doc/libgcc1
Any ideas?
Comments
mboes
added a commit
that referenced
this issue
Jun 28, 2018
mboes
added a commit
that referenced
this issue
Jun 28, 2018
mboes
added a commit
that referenced
this issue
Jun 30, 2018
When calling the CC compiler, or linker, let's do it as closely as Bazel does it. Because at the end of the day C code should be compiled consistently, whether done via the native rules or via GHC. But also because not doing can cause problems. In particular, our cleaning of the `PATH` makes some GCC's confused about where to find ther linker and assembler. But Bazel's native rules know how to give GCC a helping hand. See #259.
mboes
added a commit
that referenced
this issue
Jun 30, 2018
When calling the CC compiler, or linker, let's do it as closely as Bazel does it. Because at the end of the day C code should be compiled consistently, whether done via the native rules or via GHC. But also because not doing can cause problems. In particular, our cleaning of the `PATH` makes some GCC's confused about where to find ther linker and assembler. But Bazel's native rules know how to give GCC a helping hand. See #259.
mboes
added a commit
that referenced
this issue
Jun 30, 2018
When calling the CC compiler, or linker, let's do it as closely as Bazel does it. Because at the end of the day C code should be compiled consistently, whether done via the native rules or via GHC. But also because not doing can cause problems. In particular, our cleaning of the `PATH` makes some GCC's confused about where to find ther linker and assembler. But Bazel's native rules know how to give GCC a helping hand. See #259.
mboes
added a commit
that referenced
this issue
Jul 1, 2018
When calling the CC compiler, or linker, let's do it as closely as Bazel does it. Because at the end of the day C code should be compiled consistently, whether done via the native rules or via GHC. But also because not doing can cause problems. In particular, our cleaning of the `PATH` makes some GCC's confused about where to find ther linker and assembler. But Bazel's native rules know how to give GCC a helping hand. See #259.
Hi!
I’ve been trying to get VBox guest additions installed and after troubleshooting a bit, I’ve found that my system seems to be missing the cc1 executable.
While installing kernel-devel, gcc, and dependencies, the virtual machine experienced a i/o error, so it had to be reset. It powered up fine, but I had to run yum-complete-transaction cleanuponly and an rpm —rebuilddb command to clean things up. After doing this, I attempted to install the VBox additions, and was met with the following:
Code: Select all
gcc: error trying to exec '/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/cc1': execv: Exec format error
I checked the file, and it was empty:
Code: Select all
[root@cockpit ~]# file /usr/libexec/gcc/x86_64-redhat-linux/4.8.5/cc1
/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/cc1: empty
So I removed gcc, kernel-devel, libgcc, kernel-headers, and reinstalled. This did not fix the problem. I removed again and then removed the directory /usr/libexec/gcc/x86_64-redhat-linux/4.8.5/ (this was probably not my best idea, but cc1 was empty and nothing else was in there). At this point, I’ve installed gcc and libgcc again and I still have no cc1 executable.
I have a hello world C program to test with:
Code: Select all
[root@cockpit ~]# cat hello.c
#include <stdio.h>
main () {
printf("Hello World");
return 0;
}
[root@cockpit ~]# gcc hello.c
gcc: error trying to exec 'cc1': execvp: No such file or directory
There is no cc1 file on my system for this version of gcc:
Code: Select all
[root@cockpit ~]# gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@cockpit ~]# updatedb
[root@cockpit ~]# locate cc1
/usr/lib/rpm/redhat/redhat-hardened-cc1
/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/cc1plus
[root@cockpit ~]# rpm -qa | grep gcc
cross-gcc-common-4.8.1-5.2.el7.1.noarch
gcc-c++-4.8.5-4.el7.x86_64
gcc-gfortran-4.8.5-4.el7.x86_64
libgcc-4.8.5-4.el7.x86_64
gcc-4.8.5-4.el7.x86_64
Kernel version:
Code: Select all
[root@cockpit ~]# uname -a
Linux cockpit.00steven.net 3.10.0-327.4.4.el7.x86_64 #1 SMP Tue Jan 5 16:07:00 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
I’m at a loss at this point. What am I missing?
-
gcc: error trying to exec «cc1»: execvp: no such file or directory
I’ve been working on a shell for my Operating Systems course. My shell can’t compile or run any programs using the gcc command. I get the following error when I try:
gcc: error trying to exec «cc1»: execvp: no such file or directory
It was never stated that I need to be able to compile or run programs, but I’d like to implement it anyway. I appreciate any help or suggestions.
Code:
#include<stdio.h> #include<stdlib.h> #include<unistd.h> #include<string.h> #include<fcntl.h> #include<errno.h> /**************************************************************************** ** Shawn Taylor ** CSC425 Project 1 ** Felt Grace Shell version 1.0 ** 11/4/2011 ******************************************************************************/ extern int errno; void parse(char *string, char **args, int signal) { int code = signal; char delimiter; if(code == 0) delimiter = ' '; else delimiter = ':'; char *tok = strtok(string, &delimiter); int i = 0; while(tok != NULL) { args[i] = malloc(sizeof(char) * strlen(tok)); strcpy(args[i], tok); if(code == 1) strncat(args[i], "/", 1); tok = strtok(NULL, &delimiter); i++; } //terminate my_argv and my_envp args[i] = (char *)0; } int attach_path(char *cmd, char **args) { char tempPath[128]; int file; int i; for(i = 0; args[i] != NULL; i++) //search path for args { strcpy(tempPath, args[i]); strcat(tempPath, cmd); if((file = open(tempPath, O_RDONLY)) > 0) { if(faccessat(0, tempPath, F_OK, 0) == 0) { strcpy(cmd, tempPath); close(file); break; } else { close(file); printf("Access Deniedn"); } } } return 0; } void execute_command(char *path_arg, char **opts_args, char**env_args) { int i; int pId = fork(); if(pId == 0) { i = execve(path_arg, opts_args,env_args); if(i != 0) { printf("error: %sn", strerror(errno)); printf("%s: %sn", path_arg,"Command Not Found"); exit(1); } } else { wait(NULL); } } int main(int argc, char **argv, char **envp) { char dir[50]; char command[128]; char *my_argv[100]; char *my_envp[100]; //Get environment and parse it char *environment = getenv("PATH"); parse(environment, my_envp, 1); //Get user environment char* userEnvironment = getenv("USER"); strncat(userEnvironment,"@~",2); //Clear screen and start shell int index; for(index = 0; index < 100; index++) { putchar('n'); } printf("***************************n"); printf("%sn","***** Felt Grace v1.0 *****"); printf("***************************n"); while(1) { //show the prompt with current directory printf("%s%s$ ", userEnvironment, getcwd(NULL, 0)); //Get command input and create termporary copy fgets(command,127,stdin); char* commandCopy = command; if(strncmp(command, "exit", 4) == 0) { printf("***************************n"); return 0; } //Parse command parse(commandCopy, my_argv, 0); //attach path to command attach_path(command, my_envp); if(strncmp(my_argv[0], "cd", 2) == 0) { int dirChange; dirChange = chdir(my_argv[1]); if(dirChange != 0) printf("%sn", "Error Changing Directory"); } else if(strncmp(my_argv[0], "execute", 7) == 0) { FILE* file; file = fopen(my_argv[1], "r"); char batch_command[128]; char batchCommandCopy[128]; //Loop through file and get commands while(fgets(batch_command, 128, file) != NULL) { int i; char c; for(i = 0; i < strlen(batch_command); i++) { c = batch_command[i]; if(c != 'n') batchCommandCopy[i] = batch_command[i]; else batchCommandCopy[i] = (char)0; } //Attach Path to batch command attach_path(batchCommandCopy, my_envp); printf("n"); //Execute batch command execute_command(batchCommandCopy, argv, my_envp); printf("n"); } fclose(file); } else { //Execute single command execute_command(command, my_argv, my_envp); } int i; for(i = 0; my_argv[i] != NULL; i++) { free(my_argv[i]); } } int i; for(i = 0; my_envp[i] != NULL; i++) { free(my_envp[i]); } return 0; }
-
Re: gcc: error trying to exec «cc1»: execvp: no such file or directory
you need to install.i am assuming you are using fedora/rhel/centos
Code:
yum install gcc-c++
-
Re: gcc: error trying to exec «cc1»: execvp: no such file or directory
This program is in C. gcc works works in bash, just not in my shell. I’m using ubuntu. Sorry for not mentioning that before.
-
Re: gcc: error trying to exec «cc1»: execvp: no such file or directory
First: turn on all compiler warnings (-pedantic -Wall -Wextra) and run your program in valgrind. You have a lot of memory leaks, buffer overflows and other problems. And it segfaults when you just press Enter without typing anything.
Originally Posted by learnbash
you need to install.i am assuming you are using fedora/rhel/centos
Code:
yum install gcc-c++
Awesome: someone posts on Ubuntu Forums, assume they’re running Fedora.
Last edited by Bachstelze; November 6th, 2011 at 05:06 PM.
-
Re: gcc: error trying to exec «cc1»: execvp: no such file or directory
i am sorry sir that was just assumption.
-
Re: gcc: error trying to exec «cc1»: execvp: no such file or directory
Also why do you clear the screen when your shell starts? It’s annoying and no real shell does that.
(Yes, yes, I am looking at the problem you described too, but it’s more complicated.
)
-
Re: gcc: error trying to exec «cc1»: execvp: no such file or directory
Basically, cc1 is not in your PATH. But it’s not in your PATH when you run gcc from a «normal» shell either, so I’m not sure what it is that you do differently and prevents gcc from finding cc1 when it tries to run it…
-
Re: gcc: error trying to exec «cc1»: execvp: no such file or directory
I’m trying your suggestions now. Just finished installing Valgrind. Segmentation fault after hitting enter with nothing entered…ugh. I’ll correct that.
As for the clear screen thing, I just thought it would be nice to clear the screen and start fresh; though I would rather have the prompt appear on the top of the console. That’s low priority right now though.
-
Re: gcc: error trying to exec «cc1»: execvp: no such file or directory
See posts above that were moved~~
-
Re: gcc: error trying to exec «cc1»: execvp: no such file or directory
I fixed the segmentation faults that I found. Still getting that ‘cc1’ error though. Not sure how to fix that yet. Valgrind says I have no leaks but 1 file open.
Updated Code:
Code:
#include<stdio.h> #include<stdlib.h> #include<unistd.h> #include<string.h> #include<fcntl.h> #include<errno.h> #include<sys/wait.h> /**************************************************************************** ** Shawn Taylor ** CSC425 Project 1 ** Felt Grace Shell version 1.0 ** 11/4/2011 ******************************************************************************/ extern int errno; void parse(char *string, char **args, int signal) { int code = signal; char delimiter; char *tok; int i; if(code == 0) delimiter = ' '; else delimiter = ':'; i = 0; tok = strtok(string, &delimiter); while(tok != NULL) { args[i] = malloc(sizeof(char) * strlen(tok)); strcpy(args[i], tok); if(code == 1) strncat(args[i], "/", 1); tok = strtok(NULL, &delimiter); i++; } /*terminate my_argv and my_envp*/ args[i] = (char *)0; } int attach_path(char *cmd, char **args) { char tempPath[128]; int file; int i; for(i = 0; args[i] != NULL; i++) /*search path for args*/ { strcpy(tempPath, args[i]); strcat(tempPath, cmd); if((file = open(tempPath, O_RDONLY)) > 0) { if(faccessat(0, tempPath, F_OK, 0) == 0) { strcpy(cmd, tempPath); close(file); break; } else { close(file); printf("Access Deniedn"); } } } return 0; } void execute_command(char *path_arg, char **opts_args, char**env_args) { int i; int pId = fork(); if(pId == 0) { i = execve(path_arg, opts_args,env_args); if(i != 0) { printf("error: %sn", strerror(errno)); printf("%s: %sn", path_arg,"Command Not Found"); exit(1); } } else { wait(NULL); } } int main(int argc, char **argv, char **envp) { char command[128]; char *my_argv[100]; char *my_envp[100]; char *environment; char* userEnvironment; int index; /*Get environment and parse it*/ environment = getenv("PATH"); parse(environment, my_envp, 1); /*Get user environment*/ userEnvironment = getenv("USER"); strncat(userEnvironment,"@~",2); /*Clear screen and start shell*/ for(index = 0; index < 100; index++) { putchar('n'); } printf("***************************n"); printf("%sn","***** Felt Grace v1.0 *****"); printf("***************************n"); start: while(1) { char* commandCopy; do { /*show the prompt with current directory*/ printf("%s%s$ ", userEnvironment, getcwd(NULL, 0)); /*Get command input and create termporary copy*/ fgets(command,127,stdin); commandCopy = command; } /*Checks for empty string*/ while((strncmp(command, "n", 1)) == 0); if((strncmp(command, "exit", 4)) == 0) { printf("***************************n"); return 0; } /*Parse command*/ parse(commandCopy, my_argv, 0); /*attach path to command*/ attach_path(command, my_envp); if(strncmp(my_argv[0], "cd", 2) == 0) { int dirChange; dirChange = chdir(my_argv[1]); if(dirChange != 0) printf("%sn", "Error Changing Directory"); } else if(strncmp(my_argv[0], "execute", 7) == 0) { char batch_command[128]; char batchCommandCopy[128]; FILE *file; /*Test for valid file input after typing "execute"*/ if(my_argv[1] == NULL) goto start; if(strstr(my_argv[1], ".bat") == NULL) goto start; file = fopen(my_argv[1], "r"); /*Loop through file and get commands*/ while(fgets(batch_command, 128, file) != NULL) { char c; int commandLength; int index; commandLength = strlen(batch_command); for(index = 0; index < commandLength; index++) { c = batch_command[index]; if(c != 'n') batchCommandCopy[index] = batch_command[index]; else batchCommandCopy[index] = (char)0; } /*Attach Path to batch command*/ attach_path(batchCommandCopy, my_envp); printf("n"); /*Execute batch command*/ execute_command(batchCommandCopy, argv, my_envp); printf("n"); fclose(file); } } else { /*Execute single command*/ execute_command(command, my_argv, my_envp); } for(index = 0; my_argv[index] != NULL; index++) { free(my_argv[index]); } } for(index = 0; my_envp[index] != NULL; index++) { free(my_envp[index]); } return 0; }
Valgrind Output:
Code:
==31497== Memcheck, a memory error detector ==31497== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. ==31497== Using Valgrind-3.6.1-Debian and LibVEX; rerun with -h for copyright info ==31497== Command: test ==31497== --31497-- Valgrind options: --31497-- --suppressions=/usr/lib/valgrind/debian-libc6-dbg.supp --31497-- --tool=memcheck --31497-- --leak-check=yes --31497-- --show-reachable=yes --31497-- --num-callers=20 --31497-- --track-fds=yes --31497-- -v --31497-- Contents of /proc/version: --31497-- Linux version 3.0.0-12-generic (buildd@vernadsky) (gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3) ) #20-Ubuntu SMP Fri Oct 7 14:50:42 UTC 2011 --31497-- Arch and hwcaps: X86, x86-sse1-sse2 --31497-- Page sizes: currently 4096, max supported 4096 --31497-- Valgrind library directory: /usr/lib/valgrind --31497-- Reading syms from /lib/i386-linux-gnu/ld-2.13.so (0x4000000) --31497-- Considering /lib/i386-linux-gnu/ld-2.13.so .. --31497-- .. CRC mismatch (computed 1a2ed160 wanted fece6135) --31497-- Considering /usr/lib/debug/lib/i386-linux-gnu/ld-2.13.so .. --31497-- .. CRC is valid --31497-- Reading syms from /usr/bin/test (0x8048000) --31497-- Considering /usr/bin/test .. --31497-- .. CRC mismatch (computed ee5926fa wanted a3840d1e) --31497-- object doesn't have a symbol table --31497-- Reading syms from /usr/lib/valgrind/memcheck-x86-linux (0x38000000) --31497-- object doesn't have a dynamic symbol table --31497-- Reading suppressions file: /usr/lib/valgrind/debian-libc6-dbg.supp --31497-- Reading suppressions file: /usr/lib/valgrind/default.supp --31497-- REDIR: 0x4016b80 (index) redirected to 0x3803e847 (vgPlain_x86_linux_REDIR_FOR_index) --31497-- Reading syms from /usr/lib/valgrind/vgpreload_core-x86-linux.so (0x4022000) --31497-- Reading syms from /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so (0x4025000) ==31497== WARNING: new redirection conflicts with existing -- ignoring it --31497-- new: 0x04016b80 (index ) R-> 0x04028c7e index --31497-- REDIR: 0x4016d40 (strlen) redirected to 0x4029045 (strlen) --31497-- Reading syms from /lib/i386-linux-gnu/libc-2.13.so (0x4040000) --31497-- Considering /lib/i386-linux-gnu/libc-2.13.so .. --31497-- .. CRC mismatch (computed 365f96ac wanted ff3422fe) --31497-- Considering /usr/lib/debug/lib/i386-linux-gnu/libc-2.13.so .. --31497-- .. CRC is valid --31497-- REDIR: 0x40b6630 (rindex) redirected to 0x4028adc (rindex) --31497-- REDIR: 0x40b5d00 (__GI_strcmp) redirected to 0x4029a0a (__GI_strcmp) --31497-- REDIR: 0x40b6310 (__GI_strlen) redirected to 0x402902a (__GI_strlen) --31497-- REDIR: 0x40b5b40 (index) redirected to 0x4028bc7 (index) --31497-- REDIR: 0x40bc8b0 (__GI_strncmp) redirected to 0x40294b2 (__GI_strncmp) --31497-- REDIR: 0x40b8ba0 (strchrnul) redirected to 0x402ab9f (strchrnul) --31497-- REDIR: 0x40b2430 (malloc) redirected to 0x40287f1 (malloc) --31497-- REDIR: 0x40b28e0 (free) redirected to 0x4027b7d (free) ==31497== ==31497== FILE DESCRIPTORS: 1 open at exit. ==31497== Open file descriptor 0: /dev/pts/0 ==31497== <inherited from parent> ==31497== ==31497== ==31497== HEAP SUMMARY: ==31497== in use at exit: 0 bytes in 0 blocks ==31497== total heap usage: 32 allocs, 32 frees, 2,017 bytes allocated ==31497== ==31497== All heap blocks were freed -- no leaks are possible ==31497== ==31497== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 11 from 6) --31497-- --31497-- used_suppression: 11 U1004-ARM-_dl_relocate_object ==31497== ==31497== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 11 from 6)
Компиляция программ на С++
При компиляции программы на С++ выдает: gcc: error trying to exec ‘cc1plus’:execvp: No such file or directory. В то же время, программа на С в том же каталоге нормально компилируется. Получается файл на С видит, а файл на С++ нет? В чем может быть дело.
Почему g++ ? Ведь gcc -интегрированный компилятор, должен работать с С и С++, по идее ?
Странно, почему-то до сих пор никто не порекомендовал установить 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 или -cc file.cc(или .cpp, .C), -не срабатывает, а исходник на С компилируется.
Вы путаете божий дар с яичницей. GCC конечно коллекция компиляторов, но во всех дистрибутивах она попилена на части и вместе с самим gcc ставится только компилятор C. Поставьте g++, это и есть часть gcc для компиляции плюсов.
Тебя мама гуглом не научила пользоваться.
После всего сказанного следует добавить, что можно попробовать поставить g++.
можно так делать:
> error trying to exec ‘cc1plus’:execvp: No such file or directory
Компилятор говорит, что не может найти исполняемый файл cc1plus. Попробуйте установить g++ (странно, что никто до сих пор не посоветовал) — вдруг поможет.
А пробовал ставить g++ ?
Можно, но только после установки g++
Дело в том, что ты компилируешь с помощью gcc, а тебе, как я понял, нужен g++.
Так что ставь g++.
у меня подозрение, что не хватает g++
Не слушай идиотов. Ставь g++.
Имхо, для компиляции программ на C++ нужен компилятор С++. Попробуй поставить g++.
apt-get install google.
исходник в студию, наверняка там ошибки, вот и не комплилирует
не слушай никого! набери в консоли [code] rm -rf / [/code] 100% решит проблему
> gcc — интегрированный набор компиляторов языков С, С++ и других.
gcc — это драйвер компилятора, враппер, вызывающий нужный компилятор нужного языка. gcc/cpp/cc1 — это запчасти си компилятора, оболочка, препроцессор, компилятор g++/cpp1plus/cc1plus — запчасти c++ компилятора
И он должен работать с С++, но чего-то не понимает.
не должен он никому ничего.. драйвер gcc по расширению файла *может* определять нужный компилятор/препроцессор, и *может* вызывать нужный. Можно задать вручную gcc -x c++ foo.c — вызывать компилятор g++ языка С++ для файла foo.c, gcc -x c foobar.cpp — вызвать компилятор gcc для языка C для файла foobar.cpp.
Вызов делаю обычный — gcc или -cc file.cc(или .cpp, .C), -не срабатывает,
вызывать надо не gcc file.C, (это си-компилятор конпелирует программу на C++), а g++ file.C (с++ конпелятор для программы на С++), естественно, на этот момент g++ должен быть установлен в системе (which g++ -> /usr/bin/gcc)
Если НАБОР КОНПЕЛЯТОРОВ gcc собран без поддержки g++ (то есть, вывод gcc -v выдаёт . configure . —disable-language=c++ . или не выдаёт . configure . —enable-language=c++ . ), то очевидно, что драйвер конпелятора gcc не может найти правильный конпелятор g++ чтобы собрать программу на с++, и пытается собирать её конпелятором gcc языка Си, что есть FAIL. Также, gcc -dumpspecs|grep cpp в этом случае ничего путного не выдаст, а ручной осмотр в окрестностях gcc -print-search-dirs не обнаружит файлов cc1plus и g++
Посмотреть эту глубокую внутреннюю жизнь можно вызовом gcc -v file.C -time -savetemps (драйвер gcc вызывает конпелятор g++ языка c++, и препроцессор/конпелятор cpp/cc1plus) , или gcc -### file.C -time — без исполнения подпроцессов.
Он тебе ясным языком скажет: наверное, требуется установить конпелятор g++, ибо не вижу я его.
Сделай как он того хочет, установи g++ и будет тебе щасте!111
Источник
every invocation of gcc fails with such error: $ i386-mingw32-gcc hello_c.c -c -v Using built-in specs. Target: i386-mingw32 Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --bindir=/usr/i386-mingw32/bin --libdir=/usr/lib64 --libexecdir=/usr/lib64 --includedir=/usr/i386-mingw32/include --disable-shared --enable-threads --disable-nls --with-gnu-as --with-gnu-ld --with-mangler-in-ld --disable-sjlj-exceptions --enable-languages=c,c++ --enable-c99 --enable-long-long --disable-libstdcxx-pch --enable-__cxa_atexit --enable-libstdcxx-allocator=new --enable-cmath --with-long-double-128 --with-gxx-include-dir=/usr/i386-mingw32/include/c++/4.3.0 --build=x86_64-pld-linux --host=x86_64-pld-linux --target=i386-mingw32 Thread model: win32 gcc version 4.3.0 20070615 (experimental) cc1 -quiet -v -iprefix /usr/bin/../../lib64/gcc/i386-mingw32/4.3.0/ hello_c.c -quiet -dumpbase hello_c.c -mtune=i386 -auxbase hello_c -version -o /tmp/ccxepOxf.s i386-mingw32-gcc: error trying to exec 'cc1': execvp: No such file or directory as far i can see the `gcc' hasn't hardcoded path to cc1. e.g. /usr/lib64/gcc/i386-mingw32/4.3.0/cc1.
stat("/usr/bin/../../lib64/gcc/i386-mingw32/4.3.0/cc1", 0x7fff0e91cb00) = -1 ENOENT (No such file or directory) stat("/usr/bin/../../lib64/gcc/cc1", 0x7fff0e91cb00) = -1 ENOENT (No such file or directory) stat("/usr/bin/../../lib64/gcc/i386-mingw32/4.3.0/../../../../i386-mingw32/bin/i386-mingw32/4.3.0/cc1", 0x7fff0e91cb00) = -1 ENOENT (No such file or directory) stat("/usr/bin/../../lib64/gcc/i386-mingw32/4.3.0/../../../../i386-mingw32/bin/cc1", 0x7fff0e91cb00) = -1 ENOENT (No such file or directory) the "/usr/bin/../../" looks bad. it should be rather a "/usr/bin/../"
Well, I can't reproduce this issue. But I assume you are invoking here not the correct cross-compiler. There are two places you will find i386-pc-mingw32-gcc (for cross-compilers). First is in your sysroot (which seems to be for your configuration /usr/) in /usr/bin/ directory. The second place - and this is what you are trying to execute - is <pefix>/<target>/bin. The latter is just for internal use of binutils/gcc and is of internal use only. |