September 26, 2016

Gcc for my Debian system

After installing the debian console image, I find I have no C compiler. This is not entirely unexpected, in fact it is probably desirable to start with a minimal system and add things only as needed. The Debian package system will supply our needs.

Running "apt-get update" does not update the system, it updates the list of packages that apt-get needs to refer to.

apt-get update
apt-cache search gcc
apt-get install gcc-4.7
apt-get remove gcc-4.7
apt-get autoremove
apt-get install gcc
This tells me that gcc 4.4, 4.6, and 4.7 are all available. It wants to install 4.6 by default, but I (unwisely perhaps) decide to install the latest version (4.7). After doing this, typing cc or gcc yield command not found. The commands are in /usr/bin as gcc-4.7 as though they are some "experimental" version, so I back off and install 4.6. I have no clue, but I want to take the path of least resistance.
t@beaglebone:~# apt-get install gcc-4.7
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  binutils cpp-4.7 libc-bin libc-dev-bin libc6 libc6-dev libgmp10 libgomp1
  libmpc2 libmpfr4 linux-libc-dev manpages manpages-dev
Suggested packages:
  binutils-doc gcc-4.7-locales libmudflap0-4.7-dev gcc-4.7-doc libgcc1-dbg
  libgomp1-dbg libitm1-dbg libquadmath-dbg libmudflap0-dbg libcloog-ppl0
  libppl-c2 libppl7 binutils-gold glibc-doc man-browser
Recommended packages:
  gcc c-compiler
The following NEW packages will be installed:
  binutils cpp-4.7 gcc-4.7 libc-dev-bin libc6-dev libgmp10 libgomp1 libmpc2
  libmpfr4 linux-libc-dev manpages manpages-dev
The following packages will be upgraded:
  libc-bin libc6
2 upgraded, 12 newly installed, 0 to remove and 28 not upgraded.
Need to get 25.7 MB of archives.
After this operation, 45.4 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://security.debian.org/ wheezy/updates/main libc-bin armhf 2.13-38+deb7u11 [1169 kB]
Get:2 http://ftp.us.debian.org/debian/ wheezy/main libgmp10 armhf 2:5.0.5+dfsg-2 [198 kB]
Get:3 http://ftp.us.debian.org/debian/ wheezy/main libgomp1 armhf 4.7.2-5 [25.7 kB]
Get:4 http://ftp.us.debian.org/debian/ wheezy/main libmpfr4 armhf 3.1.0-5 [516 kB]
Get:5 http://security.debian.org/ wheezy/updates/main libc6 armhf 2.13-38+deb7u11 [3903 kB]
Get:6 http://ftp.us.debian.org/debian/ wheezy/main libmpc2 armhf 0.9-4+b1 [31.9 kB]
Get:7 http://ftp.us.debian.org/debian/ wheezy/main manpages all 3.44-1 [795 kB]
Get:8 http://security.debian.org/ wheezy/updates/main binutils armhf 2.22-8+deb7u3 [4479 kB]
Get:9 http://ftp.us.debian.org/debian/ wheezy/main cpp-4.7 armhf 4.7.2-5 [4431 kB]
Get:10 http://security.debian.org/ wheezy/updates/main libc-dev-bin armhf 2.13-38+deb7u11 [221 kB]
Get:11 http://security.debian.org/ wheezy/updates/main linux-libc-dev armhf 3.2.81-2 [835 kB]
Get:12 http://security.debian.org/ wheezy/updates/main libc6-dev armhf 2.13-38+deb7u11 [2353 kB]
Get:13 http://ftp.us.debian.org/debian/ wheezy/main gcc-4.7 armhf 4.7.2-5 [4980 kB]
Get:14 http://ftp.us.debian.org/debian/ wheezy/main manpages-dev all 3.44-1 [1737 kB]
Fetched 25.7 MB in 11s (2216 kB/s)                                             
Preconfiguring packages ...
(Reading database ... 11157 files and directories currently installed.)
Preparing to replace libc-bin 2.13-38+deb7u8 (using .../libc-bin_2.13-38+deb7u11_armhf.deb) ...
Unpacking replacement libc-bin ...
Setting up libc-bin (2.13-38+deb7u11) ...
(Reading database ... 11157 files and directories currently installed.)
Preparing to replace libc6:armhf 2.13-38+deb7u8 (using .../libc6_2.13-38+deb7u11_armhf.deb) ...
Unpacking replacement libc6:armhf ...
Setting up libc6:armhf (2.13-38+deb7u11) ...
Selecting previously unselected package libgmp10:armhf.
(Reading database ... 11157 files and directories currently installed.)
Unpacking libgmp10:armhf (from .../libgmp10_2%3a5.0.5+dfsg-2_armhf.deb) ...
Selecting previously unselected package libgomp1:armhf.
Unpacking libgomp1:armhf (from .../libgomp1_4.7.2-5_armhf.deb) ...
Selecting previously unselected package libmpfr4:armhf.
Unpacking libmpfr4:armhf (from .../libmpfr4_3.1.0-5_armhf.deb) ...
Selecting previously unselected package libmpc2:armhf.
Unpacking libmpc2:armhf (from .../libmpc2_0.9-4+b1_armhf.deb) ...
Selecting previously unselected package manpages.
Unpacking manpages (from .../manpages_3.44-1_all.deb) ...
Selecting previously unselected package binutils.
Unpacking binutils (from .../binutils_2.22-8+deb7u3_armhf.deb) ...
Selecting previously unselected package cpp-4.7.
Unpacking cpp-4.7 (from .../cpp-4.7_4.7.2-5_armhf.deb) ...
Selecting previously unselected package gcc-4.7.
Unpacking gcc-4.7 (from .../gcc-4.7_4.7.2-5_armhf.deb) ...
Selecting previously unselected package libc-dev-bin.
Unpacking libc-dev-bin (from .../libc-dev-bin_2.13-38+deb7u11_armhf.deb) ...
Selecting previously unselected package linux-libc-dev:armhf.
Unpacking linux-libc-dev:armhf (from .../linux-libc-dev_3.2.81-2_armhf.deb) ...
Selecting previously unselected package libc6-dev:armhf.
Unpacking libc6-dev:armhf (from .../libc6-dev_2.13-38+deb7u11_armhf.deb) ...
Selecting previously unselected package manpages-dev.
Unpacking manpages-dev (from .../manpages-dev_3.44-1_all.deb) ...
Setting up libgmp10:armhf (2:5.0.5+dfsg-2) ...
Setting up libgomp1:armhf (4.7.2-5) ...
Setting up libmpfr4:armhf (3.1.0-5) ...
Setting up libmpc2:armhf (0.9-4+b1) ...
Setting up manpages (3.44-1) ...
Setting up binutils (2.22-8+deb7u3) ...
Setting up cpp-4.7 (4.7.2-5) ...
Setting up gcc-4.7 (4.7.2-5) ...
Setting up libc-dev-bin (2.13-38+deb7u11) ...
Setting up linux-libc-dev:armhf (3.2.81-2) ...
Setting up libc6-dev:armhf (2.13-38+deb7u11) ...
Setting up manpages-dev (3.44-1) ...

root@beaglebone:~# apt-get remove gcc-4.7
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  binutils cpp-4.7 libc-dev-bin libc6-dev libgmp10 libgomp1 libmpc2 libmpfr4
  linux-libc-dev manpages manpages-dev
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  gcc-4.7
0 upgraded, 0 newly installed, 1 to remove and 28 not upgraded.
After this operation, 10.9 MB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 14718 files and directories currently installed.)
Removing gcc-4.7 ...

root@beaglebone:~# apt-get install gcc
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  cpp-4.7
Use 'apt-get autoremove' to remove it.
The following extra packages will be installed:
  cpp cpp-4.6 gcc-4.6 gcc-4.6-base
Suggested packages:
  cpp-doc gcc-4.6-locales gcc-multilib make autoconf automake1.9 libtool flex
  bison gdb gcc-doc libmudflap0-4.6-dev gcc-4.6-doc libgcc1-dbg libgomp1-dbg
  libquadmath-dbg libmudflap0-dbg binutils-gold
The following NEW packages will be installed:
  cpp cpp-4.6 gcc gcc-4.6 gcc-4.6-base
0 upgraded, 5 newly installed, 0 to remove and 28 not upgraded.
Need to get 8518 kB of archives.
After this operation, 16.5 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://ftp.us.debian.org/debian/ wheezy/main gcc-4.6-base armhf 4.6.3-14 [141 kB]
Get:2 http://ftp.us.debian.org/debian/ wheezy/main cpp-4.6 armhf 4.6.3-14 [4065 kB]
Get:3 http://ftp.us.debian.org/debian/ wheezy/main cpp armhf 4:4.6.3-8 [16.7 kB]
Get:4 http://ftp.us.debian.org/debian/ wheezy/main gcc-4.6 armhf 4.6.3-14 [4290 kB]
Get:5 http://ftp.us.debian.org/debian/ wheezy/main gcc armhf 4:4.6.3-8 [5012 B]
Fetched 8518 kB in 3s (2130 kB/s)
Selecting previously unselected package gcc-4.6-base:armhf.
(Reading database ... 14655 files and directories currently installed.)
Unpacking gcc-4.6-base:armhf (from .../gcc-4.6-base_4.6.3-14_armhf.deb) ...
Selecting previously unselected package cpp-4.6.
Unpacking cpp-4.6 (from .../cpp-4.6_4.6.3-14_armhf.deb) ...
Selecting previously unselected package cpp.
Unpacking cpp (from .../cpp_4%3a4.6.3-8_armhf.deb) ...
Selecting previously unselected package gcc-4.6.
Unpacking gcc-4.6 (from .../gcc-4.6_4.6.3-14_armhf.deb) ...
Selecting previously unselected package gcc.
Unpacking gcc (from .../gcc_4%3a4.6.3-8_armhf.deb) ...
Setting up gcc-4.6-base:armhf (4.6.3-14) ...
Setting up cpp-4.6 (4.6.3-14) ...
Setting up cpp (4:4.6.3-8) ...
Setting up gcc-4.6 (4.6.3-14) ...
Setting up gcc (4:4.6.3-8) ...

root@beaglebone:~# apt-get autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  cpp-4.7
0 upgraded, 0 newly installed, 1 to remove and 28 not upgraded.
After this operation, 8189 kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 14736 files and directories currently installed.)
Removing cpp-4.7 ...


Feedback? Questions? Drop me a line!

Tom's Computer Info / [email protected]