3

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 () {
        printf("Hello");
        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 http://se.archive.ubuntu.com/ubuntu/ lucid-updates/main Packages
        500 http://security.ubuntu.com/ubuntu/ lucid-security/main Packages
        500 http://archive.ualinux.com/ubuntu/ lucid/main Packages
        100 /var/lib/dpkg/status
     4.4.3-4ubuntu5 0
        500 http://se.archive.ubuntu.com/ubuntu/ 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 <[email protected]>
Architecture: amd64
Version: 11.4build1

--

locate cc1:

(ECRYPTFS references omitted):
/usr/lib/gcc/amd64-mingw32msvc/4.4.2/cc1
/usr/lib/gcc/i586-mingw32msvc/4.4.2/cc1
/usr/lib/gcc/x86_64-linux-gnu/4.1/cc1
/usr/lib/gcc/x86_64-linux-gnu/4.3/cc1
/usr/lib/gcc/x86_64-linux-gnu/4.4/cc1

--

EDIT:

env:

TERM=xterm
SHELL=/bin/bash
CUDA_HOME=/usr/local/cuda
LD_LIBRARY_PATH=:/usr/local/cuda/lib64
GLADE_MODULE_PATH=:/usr/lib/glade3/modules
DEFAULTS_PATH=/usr/share/gconf/xubuntu.default.path
XDG_CONFIG_DIRS=/etc/xdg/xdg-xubuntu:/etc/xdg
DESKTOP_SESSION=xubuntu
PATH=/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/cuda/bin
GDM_KEYBOARD_LAYOUT=us
LANG=en_US.utf8
MANDATORY_PATH=/usr/share/gconf/xubuntu.mandatory.path
GDMSESSION=xubuntu
SHLVL=1
GTK_PATH=:/usr/lib/gtk-2.0
XDG_DATA_DIRS=/etc/xdg/xdg-xubuntu:/usr/local/share:/usr/share
LESSOPEN=| /usr/bin/lesspipe %s
DISPLAY=:0.0
LIBGLADE_MODULE_PATH=:/usr/lib/libglade/2.0
GLADE_CATALOG_PATH=:/usr/share/glade3/catalogs
COLORTERM=gnome-terminal
_=/usr/bin/env

--

EDIT 2:

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/libcurand.so is empty, not checked.
/sbin/ldconfig.real: file /usr/local/cuda/lib/libcusparse.so.4 is truncated

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

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

/sbin/ldconfig.real: File /usr/local/cuda/lib/libcurand.so.4.0.12 is empty, not checked.
/sbin/ldconfig.real: File /usr/local/cuda/lib/libcurand.so.4 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.

7
  • 1
    Post the output of env? Also sudo ldconfig? Jul 16, 2012 at 8:39
  • I have added the output of env and sudo ldconfig to the original question.
    – skanatek
    Jul 16, 2012 at 12:48
  • 1
    can you post the command that you have used with gcc ?
    – user827992
    Jul 16, 2012 at 12:57
  • gcc hello.c -o hello -Wall
    – skanatek
    Jul 16, 2012 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. Jul 16, 2012 at 19:01

2 Answers 2

1

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.

1
  • Unfortunately this does not help.
    – skanatek
    Jul 19, 2012 at 7:01
-1

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 https://ftp7.de.netbsd.org/pub/releases.ubuntu.com/ubuntu/pool/main/g/gcc-4.4/, and download the file cpp-4.4_4.4.3-4ubuntu5.1_amd64.deb,maybe it works.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .