LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   gcc error finding 'cc1' file (https://www.linuxquestions.org/questions/linux-software-2/gcc-error-finding-cc1-file-4175579800/)

djohan 05-14-2016 03:30 PM

gcc error finding 'cc1' file
 
I am using DELL Precision-M2800 with Ubunto installed. gcc is also installed. I ran a simple c program:

#include<stdio.h>
main(){ printf("Hello world!\n"); }

$ gcc test.c
and get:
gcc: error trying to exec 'cc1': execvp: No such file or directory

I tried:
$ sudo apt-get install build-essential
with same result.

I searched LQ and found several threads with same problem but no solutions. Dating back several years. As gcc has worked for me on very sophisticated c programs running Red Hat 9 and lately Puppy-Precise I am asking how to fix this problem with Ubuntu gcc.

Thanks,
djohan

pan64 05-15-2016 10:08 AM

there is no ubuntu gcc, but anyway you need to force reinstall c compiler.

knudfl 05-15-2016 01:35 PM

Your file test.c
Code:

#include<stdio.h>
main(){ printf("Hello world!\n"); }

... works OK here : With gcc-4.9 . The executable result replies "Hello world!".

$ sudo apt-get install build-essential
.. will install g++ and gcc .
If Ubuntu 16.04, you will get gcc-5
http://packages.ubuntu.com/xenial/gcc-5
... and the Ubuntu patched gcc-5 (5.3.1) may fail with some programs?
Please try : 1) $ sudo apt-get install gcc-4.9
2) $ gcc-4.9 test.c


-

djohan 05-16-2016 09:14 PM

$ sudo apt-get install gcc-4.9
[sudo] password for don:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package gcc-4.9
E: Couldn't find any package by regex 'gcc-4.9'

$ gcc-4.9 test.c
Sorry, command-not-found has crashed! Please file a bug report at:
https://bugs.launchpad.net/command-not-found/+filebug
Please include the following information with the report:

command-not-found version: 0.2.44
don@don-Precision-M2800:~/CREATE3d$

pan64 05-17-2016 12:22 AM

so you installed nothing, and tried a non-existent app to run. Trusty has only gcc-4.8, so you need to install either gcc or gcc-4.8. Try: apt-get --reinstall install gcc

John VV 05-17-2016 12:33 AM

What version of ubuntu are you using ?????

also post the output of this

Code:

gcc -v
this is just a basic "hello world "


HOWEVER
if you only ran
Code:

gcc test.c
then all you will get is a "a.out"

use this
Code:

gcc -o test test.c

./test


keefaz 05-17-2016 03:25 AM

Quote:

Originally Posted by John VV (Post 5546578)
What version of ubuntu are you using ?????
[/code]

+1
Quote:

command-not-found has crashed!
Seems like an old ubuntu bug (a wrong locale setting problem)

djohan 05-18-2016 11:53 AM

Response to two commands follows:
Ubuntu was provided Precision-M2800 by DELL.
Version (I believe) is 14.04.1 LTS. I don't
know how to qwery for version #.


don@don-Precision-M2800:~/CREATE3d$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --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.6 --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 --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
don@don-Precision-M2800:~/CREATE3d$
don@don-Precision-M2800:~/CREATE3d$
don@don-Precision-M2800:~/CREATE3d$ gcc -o test test.c
gcc: error trying to exec 'cc1': execvp: No such file or directory
don@don-Precision-M2800:~/CREATE3d$

keefaz 05-18-2016 12:18 PM

Maybe an architecture problem? Could you post output with:
Code:

gcc -print-prog-name=cc1
Code:

uname -a

John VV 05-18-2016 12:19 PM

non standard characters can cause problems sometimes

you might want to remove the "$" from the name of the folder

djohan 05-18-2016 12:39 PM

Thanks Here is output. The $ is not part of the folder. Looks to be
provided by terminal prompt.

on@don-Precision-M2800:~/CREATE3d$ gcc -print-search-dirs
install: /usr/local/bin/../lib/gcc/x86_64-linux-gnu/4.6/
programs: =/usr/local/bin/../lib/gcc/x86_64-linux-gnu/4.6/:/usr/local/bin/../lib/gcc/x86_64-linux-gnu/:/usr/local/bin/../lib/gcc/:/usr/local/bin/../lib/gcc/x86_64-linux-gnu/4.6/../../../../x86_64-linux-gnu/bin/x86_64-linux-gnu/4.6/:/usr/local/bin/../lib/gcc/x86_64-linux-gnu/4.6/../../../../x86_64-linux-gnu/bin/x86_64-linux-gnu/:/usr/local/bin/../lib/gcc/x86_64-linux-gnu/4.6/../../../../x86_64-linux-gnu/bin/
libraries: =/usr/local/bin/../lib/gcc/x86_64-linux-gnu/4.6/:/usr/local/bin/../lib/gcc/x86_64-linux-gnu/:/usr/local/bin/../lib/gcc/:/usr/local/bin/../lib/gcc/x86_64-linux-gnu/4.6/../../../../x86_64-linux-gnu/lib/x86_64-linux-gnu/4.6/:/usr/local/bin/../lib/gcc/x86_64-linux-gnu/4.6/../../../../x86_64-linux-gnu/lib/x86_64-linux-gnu/:/usr/local/bin/../lib/gcc/x86_64-linux-gnu/4.6/../../../../x86_64-linux-gnu/lib/../lib/:/usr/local/bin/../lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/4.6/:/usr/local/bin/../lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/:/usr/local/bin/../lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/:/lib/x86_64-linux-gnu/4.6/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/4.6/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/local/bin/../lib/gcc/x86_64-linux-gnu/4.6/../../../../x86_64-linux-gnu/lib/:/usr/local/bin/../lib/gcc/x86_64-linux-gnu/4.6/../../../:/lib/:/usr/lib/
don@don-Precision-M2800:~/CREATE3d$

djohan 05-18-2016 12:43 PM

To: keefaz- Here is more.

don@don-Precision-M2800:~/CREATE3d$ uname -a
Linux don-Precision-M2800 3.5.0-61-generic #90-Ubuntu SMP Sun Apr 26 11:23:53 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
don@don-Precision-M2800:~/CREATE3d$

Thanks for help.

djohan 05-18-2016 12:58 PM

Here is more:

don@don-Precision-M2800:~/CREATE3d$
don@don-Precision-M2800:~/CREATE3d$ gcc -print-prog-name=cc1
cc1
don@don-Precision-M2800:~/CREATE3d$ uname -a
Linux don-Precision-M2800 3.5.0-61-generic #90-Ubuntu SMP Sun Apr 26 11:23:53 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
don@don-Precision-M2800:~/CREATE3d$

Thanks
Don

keefaz 05-18-2016 01:36 PM

Thanks for the outputs, so gcc doesn't find cc1 indeed...
I notice your gcc appears to search files in /usr/local, while its install prefix is /usr from gcc -v output, I don't know if it's relevant.

Could you perform a file search to find if there is a cc1 somewhere in your system?

Edit: search could be shorten with:
Code:

ls /usr/lib/gcc/*/*/cc1
ls /usr/local/lib/gcc/*/*/cc1


djohan 05-18-2016 02:12 PM

Thanks keefaz- here is output.
Looks like it's there.
I could copy it, but to where?
Don

don@don-Precision-M2800:~/CREATE3d$
don@don-Precision-M2800:~/CREATE3d$ ls /usr/lib/gcc/*/*/cc1
/usr/lib/gcc/i686-w64-mingw32/4.6/cc1 /usr/lib/gcc/x86_64-linux-gnu/4.6/cc1
/usr/lib/gcc/x86_64-linux-gnu/4.6.3/cc1 /usr/lib/gcc/x86_64-w64-mingw32/4.6/cc1
don@don-Precision-M2800:~/CREATE3d$
don@don-Precision-M2800:~/CREATE3d$ ls /usr/local/lib/gcc/*/*/cc1
ls: cannot access /usr/local/lib/gcc/*/*/cc1: No such file or directory
don@don-Precision-M2800:~/CREATE3d$


All times are GMT -5. The time now is 11:20 PM.