Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I am not a seasoned C programmer, but I compile some C code sometimes.

The last time I successfully compiled and run some C code I did it on the same system that I have now (the very same OS on the very same machine, no OS deinstallation/reinstallation happened). I did that about 2 months ago.

Now, if I try to compile even a very simple code like this:

#include <stdio.h>

main () {
        return 0;

I get:

gcc: error trying to exec 'cc1': execvp: No such file or directory

Here is the gcc -v -Wall output:

    Using built-in specs.
    Target: x86_64-linux-gnu
    Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5.1' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --e

nable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i486 --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.4.3 (Ubuntu 4.4.3-4ubuntu5.1) 
COLLECT_GCC_OPTIONS='-v' '-Wall' '-mtune=generic'
 cc1 -quiet -v h1.c -D_FORTIFY_SOURCE=2 -quiet -dumpbase h1.c -mtune=generic -auxbase h1 -Wall -version -fstack-protector -o /tmp/ccOlexzJ.s
gcc: error trying to exec 'cc1': execvp: No such file or directory

I have no idea what has happened to my system.

System status:


uname -svrmpio:

Linux 2.6.32-40-generic #87-Ubuntu SMP Tue Mar 6 00:56:56 UTC 2012 x86_64 unknown unknown GNU/Linux


lsb_release -rd:

Description:    Ubuntu 10.04.4 LTS
Release:    10.04


apt-cache policy gcc-4.4 (I do not know what this command does):

Installed: 4.4.3-4ubuntu5.1
  Candidate: 4.4.3-4ubuntu5.1
  Version table:
 *** 4.4.3-4ubuntu5.1 0
        500 lucid-updates/main Packages
        500 lucid-security/main Packages
        500 lucid/main Packages
        100 /var/lib/dpkg/status
     4.4.3-4ubuntu5 0
        500 lucid/main Packages


ls -l /usr/lib/gcc/i486-linux-gnu/4.4/:

ls: cannot access /usr/lib/gcc/i486-linux-gnu/4.4/: No such file or directory


gcc --version:

gcc (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3


dpkg -s build-essential:

Package: build-essential
Status: install ok installed
Priority: optional
Section: devel
Installed-Size: 48
Maintainer: Ubuntu Developers <>
Architecture: amd64
Version: 11.4build1


locate cc1:

(ECRYPTFS references omitted):




LESSOPEN=| /usr/bin/lesspipe %s



The compilation command is issued directly in the terminal (no Python or whatever).


gcc --print-search-dirs:

install: /usr/lib/gcc/x86_64-linux-gnu/4.4.3/
programs: =/usr/lib/gcc/x86_64-linux-gnu/4.4.3/:/usr/lib/gcc/x86_64-linux-gnu/4.4.3/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.4.3/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/libexec/gcc/x86_64-linux-gnu/4.4.3/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.4.3/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../x86_64-linux-gnu/bin/x86_64-linux-gnu/4.4.3/:/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../x86_64-linux-gnu/bin/
libraries: =/usr/lib/gcc/x86_64-linux-gnu/4.4.3/:/usr/lib/gcc/x86_64-linux-gnu/4.4.3/:/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../x86_64-linux-gnu/lib/x86_64-linux-gnu/4.4.3/:/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../x86_64-linux-gnu/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../x86_64-linux-gnu/4.4.3/:/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib/:/lib/x86_64-linux-gnu/4.4.3/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/4.4.3/:/usr/lib/../lib/:/usr/lib/x86_64-linux-gnu/x86_64-linux-gnu/4.4.3/:/usr/lib/x86_64-linux-gnu/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../x86_64-linux-gnu/lib/:/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../:/lib/:/usr/lib/:/usr/lib/x86_64-linux-gnu/

I have also tried to compile the hello file with gcc-4.3 hello.c -o hello and it works. However, I can not run cmake commands and moreover downloading and building packages from the repositories fails with gcc: error trying to exec 'cc1': execvp: No such file or directory (I guess because cmake and dpkg do not know how to use gcc-4.3 instead of gcc).


sudo ldconfig:

/sbin/ldconfig.real: File /usr/local/cuda/lib/ is empty, not checked.
/sbin/ldconfig.real: file /usr/local/cuda/lib/ is truncated

/sbin/ldconfig.real: file /usr/local/cuda/lib/ is truncated

/sbin/ldconfig.real: file /usr/local/cuda/lib/ is truncated

/sbin/ldconfig.real: File /usr/local/cuda/lib/ is empty, not checked.
/sbin/ldconfig.real: File /usr/local/cuda/lib/ is empty, not checked.

Maybe the problem has something to do with CUDA installed on the system?

I have tried to re-install build-essential, but it did not help. I have also made an attempt to re-install the C preprocessor (cpp), but the system made a caution that it will remove a lot of core packages (like acpi-support, xserver-xorg-*, etc), so I did not do that.

share|improve this question
Post the output of env? Also sudo ldconfig? – medigeek Jul 16 '12 at 8:39
I have added the output of env and sudo ldconfig to the original question. – skanatek Jul 16 '12 at 12:48
can you post the command that you have used with gcc ? – user827992 Jul 16 '12 at 12:57
gcc hello.c -o hello -Wall – skanatek Jul 16 '12 at 13:08
The file seems to be provided with cpp-* packages ( In your case package cpp-4.4 ) (1) Is this command issued directly in a terminal like gnome-terminal? Or through php/python/perl? Can you also post the output of gcc -print-search-dirs? (2) Create a new user and try to compile the same thing. Maybe it's a configuration issue in the user home dir. (3) Have you tried with some other gcc version? I see you have installed gcc-4.1 and gcc-4.3 -- use them instead of gcc. – medigeek Jul 16 '12 at 19:01

2 Answers 2

Try removing gcc and re-installing it again.

To remove:

sudo apt-get purge gcc

To install it again:

sudo apt-get update
sudo apt-get install gcc

This should fix the problem.

share|improve this answer
Unfortunately this does not help. – skanatek Jul 19 '12 at 7:01

I met the same problem.In my case,it was related to the GNU C preprocessor,I deleted the file /usr/bin/cpp-4.6 and the directory /usr/lib/gcc/i686-linux-gnu/4.6 by accident.At last,I reinstalled the GNU C preprocessor,and it worked.In your case,Go to, and download the file cpp-4.4_4.4.3-4ubuntu5.1_amd64.deb,maybe it works.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.