We help IT Professionals succeed at work.

/bin/sh: cc: command not found -- Debian

tia_kamakshi
tia_kamakshi asked
on
Medium Priority
12,418 Views
Last Modified: 2013-12-06
Hi,

I am new to Perl and Linux
I am using Debian

I wanted to install module ReadKey so i used command

cpan Term::ReadKey
I am getting error message: /bin/sh: cc: command not found

I tried to find which compilere I have

I used command

abcd-tstva2:~# which cc
abcd-tstva2:~# which CC
abcd-tstva2:~# which g++
abcd-tstva2:~# which c++

I got no result. Does that mean that no compiler is installed on my OS

Now, I am trying to install ReadKey manually

When I write at path ~/.cpan/sources/authors/id/J/JS/JSTOWE/TermReadKey-2.30

perl Makefile.PL
it works fine

But when I do make test

I get
abcd-tstva2:~/.cpan/sources/authors/id/J/JS/JSTOWE/TermReadKey-2.30# make test
cp ReadKey.pm blib/lib/Term/ReadKey.pm
AutoSplitting blib/lib/Term/ReadKey.pm (blib/lib/auto/Term/ReadKey)
/usr/bin/perl -I/usr/share/perl/5.8 genchars.pl

Writing termio/termios section of cchars.h... Done.
Checking for sgtty...
        Sgtty NOT found.
Writing sgtty section of cchars.h... Done.
/usr/bin/perl /usr/share/perl/5.8/ExtUtils/xsubpp -noprototypes -typemap /usr/share/perl/5.8/ExtUtils/typemap  ReadKey.xs > ReadKey.xsc && mv ReadKey.xsc ReadKey.c
cc -c   -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2   -DVERSION=\"2.30\" -DXS_VERSION=\"2.30\" -fPIC "-I/usr/lib/perl/5.8/CORE"   ReadKey.c
/bin/sh: cc: command not found
make: *** [ReadKey.o] Error 127

Saying
/bin/sh: cc: command not found

How should I fix this. I am new to Debain/Linux
I also tried following

abcd-tstva2:~# up2date cc
 -su: up2date: command not found
 abcd-tstva2:~# up2date CC
 -su: up2date: command not found
 abcd-tstva2:~# yum
 -su: yum: command not found
 abcd-tstva2:~# update CC
 -su: update: command not found

abcd-tstva2:~# apt-get -b cc
E: Invalid operation cc
abcd-tstva2:~# apt-get -b CC
E: Invalid operation CC
abcd-tstva2:~# apt-get CC
E: Invalid operation CC
abcd-tstva2:~# apt-get cc
E: Invalid operation cc

So please guide me how to fix this

Many Thanks
Comment
Watch Question

try gcc

Author

Commented:
Hi,

Thanks for your quick response

I tried apt-get -b gcc, it has started installing and asking for Linux/Debian CD. Today CD guy is not here.

Will try tommorow.

Can we download the package from internet and then we can install.

If yes, can you please guide me how to do that

Many Thanks
Try this command :

apt-get install gcc build-essential

Let me know how it goes.

Author

Commented:
Looks I need to wait CD guy.

It is asking CD again. CD guy will come tommorow or will come in 1 hrs.

Guide me if I can do something without him
May be downloading and installing some package from internet

Thanks
abcd-tstva2:~# apt-get install gcc build-essential
Reading package lists... Done
Building dependency tree... Done
The following extra packages will be installed:
  g++ g++-4.1 gcc-4.1 libc6-dev libssp0 libstdc++6-4.1-dev
  linux-kernel-headers
Suggested packages:
  gcc-4.1-doc lib64stdc++6 manpages-dev autoconf automake1.9 libtool flex
  bison gcc-doc gcc-4.1-locales libc6-dev-amd64 lib64gcc1 lib64ssp0 glibc-doc
  libstdc++6-4.1-doc
Recommended packages:
  libmudflap0-dev
The following NEW packages will be installed
  build-essential g++ g++-4.1 gcc gcc-4.1 libc6-dev libssp0 libstdc++6-4.1-dev
  linux-kernel-headers
0 upgraded, 9 newly installed, 0 to remove and 3 not upgraded.
Need to get 8850kB/9320kB of archives.
After unpacking 39.7MB of additional disk space will be used.
Do you want to continue [Y/n]?
Media Change: Please insert the disc labelled
 âDebian GNU/Linux 4.0 r1 _Etch_ - Official i386 NETINST Binary-1 20070820-20:21â
in the drive â/cdrom/â and press enter
a
Get: 1 http://ftp.uk.debian.org etch/main linux-kernel-headers 2.6.18-7 [1875kB]
Get: 2 http://ftp.uk.debian.org etch/main libc6-dev 2.3.6.ds1-13etch8 [2718kB]
Get: 3 http://ftp.uk.debian.org etch/main libstdc++6-4.1-dev 4.1.1-21 [1634kB]
Get: 4 http://ftp.uk.debian.org etch/main g++-4.1 4.1.1-21 [2615kB]
Get: 5 http://ftp.uk.debian.org etch/main g++ 4:4.1.1-15 [1360B]
Get: 6 http://ftp.uk.debian.org etch/main build-essential 11.3 [6982B]
Media Change: Please insert the disc labelled
 âDebian GNU/Linux 4.0 r1 _Etch_ - Official i386 NETINST Binary-1 20070820-20:21â
in the drive â/cdrom/â and press enter
 
Media Change: Please insert the disc labelled
 âDebian GNU/Linux 4.0 r1 _Etch_ - Official i386 NETINST Binary-1 20070820-20:21â
in the drive â/cdrom/â and press enter
a
Media Change: Please insert the disc labelled
 âDebian GNU/Linux 4.0 r1 _Etch_ - Official i386 NETINST Binary-1 20070820-20:21â
in the drive â/cdrom/â and press enter
a
Media Change: Please insert the disc labelled
 âDebian GNU/Linux 4.0 r1 _Etch_ - Official i386 NETINST Binary-1 20070820-20:21â
in the drive â/cdrom/â and press enter
A
Media Change: Please insert the disc labelled
 âDebian GNU/Linux 4.0 r1 _Etch_ - Official i386 NETINST Binary-1 20070820-20:21â
in the drive â/cdrom/â and press enter

Open in new window

apt-get seems to be trying to install the packages from the CD by default.

So you might want to try commenting out the line for your CD in /etc/apt/sources.list using :

sudo gedit /etc/apt/sources.list

Then run :
sudo apt-get update

Author

Commented:
You are great. Many Thanks It works :)