2
zhangkehu@ubuntu:/$ gcc -v 
The program 'gcc' is currently not installed. You can install it by typing: sudo apt-get install gcc 
zhangkehu@ubuntu:/$ sudo apt-get install gcc 
Reading package lists... Done Building dependency tree Reading state information... Done gcc is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

so what should I do now? Anybody can help me?Any help will be very appreciated.

I'm using ubuntu14.04(64-bit),

zhangkehu@ubuntu:/$ apt-cache policy gcc
gcc:
  Installed: 4:4.8.2-1ubuntu6
  Candidate: 4:4.8.2-1ubuntu6
  Version table:
 *** 4:4.8.2-1ubuntu6 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
        100 /var/lib/dpkg/status

zhangkehu@ubuntu:/$ apt-cache depends gcc
gcc
  Depends: cpp
  Depends: gcc-4.8
  Suggests: gcc-multilib
  Suggests: make
    make:i386
  Suggests: manpages-dev
  Suggests: autoconf
  Suggests: automake1.9
  Suggests: libtool
    libtool:i386
  Suggests: flex
    flex:i386
  Suggests: bison
    bison:i386
  Suggests: gdb
  Suggests: gcc-doc
 |Recommends: libc6-dev
  Recommends: <libc-dev>
    libc6-dev
  Conflicts: gcc-doc
  Conflicts: gcc-doc:i386
  Conflicts: gcc:i386

By the way,I delete gcc in somewhere because I can't install clang-3.5,some context in here

Hi,there is some messages:

zhangkehu@ubuntu:/$ sudo apt full-upgrade
[sudo] password for zhangkehu: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  g++-4.8 libstdc++-4.8-dev
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
  libandroid-properties1 libcairo-perl libglib-perl libgtk2-perl
  liboxideqtquick0 libpango-perl libsctp1 libxcb-keysyms1 libxkbcommon-x11-0
  linux-headers-3.13.0-125 linux-headers-3.13.0-125-generic
  linux-image-3.13.0-125-generic linux-image-extra-3.13.0-125-generic
  lksctp-tools
The following packages will be upgraded:
  account-plugin-aim account-plugin-facebook account-plugin-flickr
  account-plugin-google account-plugin-jabber account-plugin-salut
  account-plugin-twitter account-plugin-windows-live account-plugin-yahoo
  accountsservice activity-log-manager activity-log-manager-control-center
  app-install-data apparmor apport apport-gtk apt apt-transport-https
  apt-utils aptdaemon aptdaemon-data avahi-autoipd avahi-daemon avahi-utils
  base-files bash bash-completion bind9-host binutils
  binutils-arm-linux-gnueabihf bluez bluez-alsa bluez-cups bsdutils
  ca-certificates compiz compiz-core compiz-gnome compiz-plugins-default
  coreutils cpio cpp-4.8 cpp-4.8-arm-linux-gnueabihf cups cups-browsed
  cups-bsd cups-client cups-common cups-core-drivers cups-daemon cups-filters
  cups-filters-core-drivers cups-ppdc cups-server-common dbus dbus-x11
  deja-dup deja-dup-backend-gvfs desktop-file-utils dh-python dnsmasq-base
  dnsutils dosfstools dpkg dpkg-dev duplicity e2fslibs e2fsprogs eject empathy
  empathy-common eog evince evince-common evolution-data-server
  evolution-data-server-common evolution-data-server-online-accounts exim4
  exim4-base exim4-config exim4-daemon-light file file-roller firefox
  firefox-locale-en fontconfig fontconfig-config fonts-droid fonts-opensymbol
  fuse g++-4.8 gcc-4.8 gcc-4.8-arm-linux-gnueabihf
  gcc-4.8-arm-linux-gnueabihf-base gcc-4.8-base
  gcc-4.8-multilib-arm-linux-gnueabihf gcc-4.9-base gdb gdisk gettext
  gettext-base ghostscript ghostscript-x gir1.2-appindicator3-0.1
  gir1.2-dbusmenu-glib-0.4 gir1.2-ebook-1.2 gir1.2-ebookcontacts-1.2
  gir1.2-edataserver-1.2 gir1.2-freedesktop gir1.2-gdkpixbuf-2.0
  gir1.2-glib-2.0 gir1.2-gnomebluetooth-1.0 gir1.2-gst-plugins-base-1.0
  gir1.2-gstreamer-1.0 gir1.2-gtk-3.0 gir1.2-gudev-1.0 gir1.2-ibus-1.0
  gir1.2-javascriptcoregtk-3.0 gir1.2-networkmanager-1.0 gir1.2-pango-1.0
  gir1.2-rb-3.0 gir1.2-soup-2.4 gir1.2-udisks-2.0 gir1.2-vte-2.90
  gir1.2-webkit-3.0 gir1.2-wnck-3.0 git git-man glib-networking
  glib-networking-common glib-networking-services gnome-bluetooth
  gnome-calculator gnome-contacts gnome-control-center-shared-data
  gnome-desktop3-data gnome-keyring gnome-session-bin gnome-session-common
  gnome-settings-daemon-schemas gnome-sudoku gnupg gpgv grub-common grub-pc
  grub-pc-bin grub2-common gstreamer0.10-alsa gstreamer0.10-plugins-base
  gstreamer0.10-plugins-base-apps gstreamer0.10-plugins-good
  gstreamer0.10-pulseaudio gstreamer0.10-x gstreamer1.0-alsa
  gstreamer1.0-plugins-base gstreamer1.0-plugins-base-apps
  gstreamer1.0-plugins-good gstreamer1.0-pulseaudio gstreamer1.0-tools
  gstreamer1.0-x gvfs gvfs-backends gvfs-bin gvfs-common gvfs-daemons
  gvfs-fuse gvfs-libs hardening-includes hplip hplip-data hud ibus ibus-gtk
  ibus-gtk3 icedtea-7-jre-jamvm ifupdown im-config indicator-printers
  indicator-session init-system-helpers initscripts intel-gpu-tools iproute
  iproute2 iputils-arping iputils-ping iputils-tracepath irqbalance
  isc-dhcp-client isc-dhcp-common klibc-utils krb5-locales
  landscape-client-ui-install language-pack-en language-pack-en-base
  language-selector-common language-selector-gnome
  libaccount-plugin-generic-oauth libaccount-plugin-google libaccountsservice0
  libapparmor-perl libapparmor1 libappindicator3-1 libapt-inst1.5
  libapt-pkg4.12 libarchive13 libasan0 libasan0-armhf-cross libasn1-8-heimdal
  libasprintf-dev libasprintf0c2 libatomic1 libatomic1-armhf-cross
  libavahi-client3 libavahi-common-data libavahi-common3 libavahi-core7
  libavahi-glib1 libavahi-gobject0 libbind9-90 libblkid1 libbluetooth3
  libboost-date-time1.54.0 libboost-system1.54.0 libc-bin libc-dev-bin libc6
  libc6-dbg libc6-dev libcairo-gobject2 libcairo2 libcamel-1.2-45
  libcgmanager0 libclutter-gtk-1.0-0 libcomerr2 libcompizconfig0 libcups2
  libcupscgi1 libcupsfilters1 libcupsimage2 libcupsmime1 libcupsppdc1 libcurl3
  libcurl3-gnutls libdbus-1-3 libdbusmenu-glib4 libdbusmenu-gtk3-4
  libdbusmenu-gtk4 libdecoration0 libdns100 libdpkg-perl libdrm-intel1
  libdrm-nouveau2 libdrm-radeon1 libdrm2 libebackend-1.2-7 libebook-1.2-14
  libebook-contacts-1.2-0 libecal-1.2-16 libedata-book-1.2-20
  libedata-cal-1.2-23 libedataserver-1.2-18 libegl1-mesa libegl1-mesa-drivers
  libelf1 libevdocument3-4 libevent-2.0-5 libevview3-3 libexpat1 libffi-dev
  libffi6 libflac8 libfontconfig1 libfontembed1 libfreetype6 libfuse2
  libgail-3-0 libgail-common libgail18 libgbm1 libgc1c2 libgcc-4.8-dev
  libgcc-4.8-dev-armhf-cross libgcc1 libgcc1-armhf-cross libgcrypt11 libgd3
  libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgettextpo-dev libgettextpo0
  libgexiv2-2 libgirepository-1.0-1 libgl1-mesa-dri libgl1-mesa-glx
  libglapi-mesa libgles2-mesa libglib2.0-0 libglib2.0-bin libglib2.0-data
  libgnome-bluetooth11 libgnome-control-center1 libgnome-desktop-3-7
  libgnutls-openssl27 libgnutls26 libgomp1 libgomp1-armhf-cross libgpgme11
  libgphoto2-6 libgphoto2-l10n libgphoto2-port10 libgraphite2-3 libgs9
  libgs9-common libgssapi-krb5-2 libgssapi3-heimdal
  libgstreamer-plugins-base0.10-0 libgstreamer-plugins-base1.0-0
  libgstreamer-plugins-good1.0-0 libgstreamer1.0-0 libgtk-3-0 libgtk-3-bin
  libgtk-3-common libgtk2.0-0 libgtk2.0-bin libgtk2.0-common libgudev-1.0-0
  libgweather-3-6 libgweather-common libharfbuzz-icu0 libharfbuzz0b
  libhcrypto4-heimdal libheimbase1-heimdal libheimntlm0-heimdal libhpmud0
  libhud2 libhunspell-1.3-0 libhx509-5-heimdal libibus-1.0-5 libicu52 libidn11
  libido3-0.1-0 libimobiledevice4 libindicator3-7 libisc95 libisccc90
  libisccfg90 libitm1 libjasper1 libjavascriptcoregtk-3.0-0 libjbig0
  libjbig2dec0 libjson-c2 libjson0 libk5crypto3 libklibc libkrb5-26-heimdal
  libkrb5-3 libkrb5support0 liblcms2-2 libldap-2.4-2 libldb1
  liblightdm-gobject-1-0 liblwres90 liblzo2-2 libmagic1 libmbim-glib0
  libmetacity-private0a libminiupnpc8 libmm-glib0 libmount1 libmtp-common
  libmtp-runtime libmtp9 libnautilus-extension1a libnettle4 libnl-3-200
  libnl-genl-3-200 libnl-route-3-200 libnm-glib-vpn1 libnm-glib4
  libnm-gtk-common libnm-gtk0 libnm-util2 libnspr4 libnss3 libnss3-1d
  libnss3-nssdb libnuma1 libnux-4.0-0 libnux-4.0-common libopenvg1-mesa
  liboxideqt-qmlplugin liboxideqtcore0 libp11-kit-gnome-keyring
  libpam-gnome-keyring libpam-modules libpam-modules-bin libpam-runtime
  libpam-systemd libpam0g libpango-1.0-0 libpango1.0-0 libpangocairo-1.0-0
  libpangoft2-1.0-0 libpangoxft-1.0-0 libparted0debian1 libpci3 libpcre3
  libpcsclite1 libperl5.18 libpixman-1-0 libplymouth2 libpng12-0
  libpolkit-agent-1-0 libpolkit-backend-1-0 libpolkit-gobject-1-0
  libpoppler-glib8 libpoppler44 libprocps3 libpulse-mainloop-glib0 libpulse0
  libpulsedsp libpurple-bin libpurple0 libpwquality-common libpwquality1
  libpython2.7 libpython2.7-minimal libpython2.7-stdlib libpython3.4
  libpython3.4-minimal libpython3.4-stdlib libqt4-dbus libqt4-declarative
  libqt4-designer libqt4-help libqt4-network libqt4-opengl libqt4-script
  libqt4-scripttools libqt4-sql libqt4-sql-sqlite libqt4-svg libqt4-test
  libqt4-xml libqt4-xmlpatterns libqt5core5a libqt5dbus5 libqt5gui5
  libqt5network5 libqt5opengl5 libqt5printsupport5 libqt5qml5 libqt5quick5
  libqt5sql5 libqt5sql5-sqlite libqt5test5 libqt5widgets5 libqt5xml5
  libqtcore4 libqtdbus4 libqtgui4 libquadmath0
  libreoffice-avmedia-backend-gstreamer libreoffice-base-core libreoffice-calc
  libreoffice-common libreoffice-core libreoffice-draw libreoffice-gnome
  libreoffice-gtk libreoffice-impress libreoffice-math libreoffice-ogltrans
  libreoffice-pdfimport libreoffice-presentation-minimizer
  libreoffice-style-human libreoffice-writer librhythmbox-core8
  libroken18-heimdal librtmp0 libsane libsane-common libsane-hpaio libselinux1
  libsepol1 libsfasan0-armhf-cross libsfatomic1-armhf-cross
  libsfgcc-4.8-dev-armhf-cross libsfgcc1-armhf-cross libsfgomp1-armhf-cross
  libsmbclient libsndfile1 libsnmp-base libsnmp30 libsoup-gnome2.4-1
  libsoup2.4-1 libspectre1 libspice-server1 libsqlite3-0 libss2 libssh-4
  libssl1.0.0 libstdc++-4.8-dev libstdc++6 libstdc++6-armhf-cross
  libsystemd-daemon0 libsystemd-journal0 libsystemd-login0 libtalloc2
  libtasn1-6 libtdb1 libtevent0 libthumbnailer0 libtiff5 libtsan0 libudev1
  libudisks2-0 libufe-xidgetter0 libunity-control-center1 libunity-core-6.0-9
  libunity-gtk2-parser0 libunity-gtk3-parser0 libupstart1 libuuid1
  libvncserver0 libvte-2.90-9 libvte-2.90-common libwayland-egl1-mesa
  libwbclient0 libwebkitgtk-3.0-0 libwebkitgtk-3.0-common libwhoopsie0
  libwind0-heimdal libwmf0.2-7 libwmf0.2-7-gtk libwnck-3-0 libwnck-3-common
  libxatracker2 libxext6 libxfixes3 libxfont1 libxi6 libxml2 libxpm4
  libxrandr2 libxrender1 libxslt1.1 libzeitgeist-2.0-0 lightdm linux-firmware
  linux-generic linux-headers-3.13.0-24 linux-headers-3.13.0-24-generic
  linux-headers-generic linux-image-3.13.0-24-generic
  linux-image-extra-3.13.0-24-generic linux-image-generic linux-libc-dev
  locales login logrotate lsb-base lsb-release lshw ltrace makedev man-db
  mcp-account-manager-uoa metacity-common mime-support modemmanager mount
  multiarch-support nautilus nautilus-data nautilus-sendto-empathy net-tools
  network-manager network-manager-gnome ninja-build notify-osd-icons ntpdate
  nux-tools onboard onboard-data oneconf oneconf-common openjdk-7-jre-headless
  openssh-client openssl os-prober oxideqt-codecs parted passwd patch pciutils
  perl perl-base perl-modules plymouth plymouth-label
  plymouth-theme-ubuntu-logo plymouth-theme-ubuntu-text pm-utils policykit-1
  poppler-utils ppp printer-driver-hpcups printer-driver-postscript-hp procps
  pulseaudio pulseaudio-module-bluetooth pulseaudio-module-x11
  pulseaudio-utils python-apt python-apt-common python-aptdaemon
  python-aptdaemon.gtk3widgets python-crypto python-cupshelpers python-gi
  python-gi-cairo python-gobject python-html5lib python-ibus python-imaging
  python-ldb python-libxml2 python-lxml python-oneconf python-pexpect
  python-pil python-pkg-resources python-requests python-samba
  python-setuptools python-six python-talloc python-tdb python-urllib3
  python-zeitgeist python2.7 python2.7-minimal python3-apport python3-apt
  python3-aptdaemon python3-aptdaemon.gtk3widgets python3-aptdaemon.pkcompat
  python3-chardet python3-crypto python3-distupgrade python3-gdbm python3-gi
  python3-gi-cairo python3-lxml python3-oneconf python3-pkg-resources
  python3-problem-report python3-requests python3-six
  python3-software-properties python3-uno python3-update-manager
  python3-urllib3 python3.4 python3.4-minimal qdbus qtcore4-l10n
  qtdeclarative5-dialogs-plugin qtdeclarative5-localstorage-plugin
  qtdeclarative5-privatewidgets-plugin qtdeclarative5-qtquick2-plugin
  qtdeclarative5-ubuntu-ui-extras-browser-plugin
  qtdeclarative5-ubuntu-ui-extras-browser-plugin-assets
  qtdeclarative5-window-plugin resolvconf rhythmbox rhythmbox-data
  rhythmbox-mozilla rhythmbox-plugin-cdrecorder rhythmbox-plugin-magnatune
  rhythmbox-plugin-zeitgeist rhythmbox-plugins rsync rsyslog samba-common
  samba-common-bin samba-libs sane-utils shotwell shotwell-common simple-scan
  smbclient software-center software-properties-common software-properties-gtk
  ssh-askpass-gnome sudo system-config-printer-common
  system-config-printer-gnome system-config-printer-udev systemd-services
  sysv-rc sysvinit-utils t1utils tar tcpdump telepathy-gabble thunderbird
  thunderbird-gnome-support thunderbird-locale-en thunderbird-locale-en-us
  transmission-common transmission-gtk tzdata tzdata-java ubuntu-docs
  ubuntu-drivers-common ubuntu-release-upgrader-core
  ubuntu-release-upgrader-gtk ubuntu-session udev udisks2 unattended-upgrades
  unity unity-control-center unity-greeter unity-gtk-module-common
  unity-gtk2-module unity-gtk3-module unity-lens-music unity-scope-musicstores
  unity-services unity-settings-daemon uno-libs3 unzip update-manager
  update-manager-core update-notifier update-notifier-common upstart ure
  usb-creator-common usb-creator-gtk usbutils util-linux uuid-runtime vim
  vim-common vim-runtime vim-tiny webaccounts-extension-common
  webapp-container webbrowser-app wget whoopsie wpasupplicant x11-common
  xdg-utils xorg xserver-common xserver-xorg xserver-xorg-core
  xserver-xorg-input-all xserver-xorg-video-all xserver-xorg-video-ati
  xserver-xorg-video-intel xserver-xorg-video-openchrome
  xserver-xorg-video-radeon xul-ext-ubufox xul-ext-unity xul-ext-webaccounts
  xul-ext-websites-integration zeitgeist zeitgeist-core zeitgeist-datahub
778 upgraded, 14 newly installed, 0 to remove and 0 not upgraded.
Need to get 140 MB/672 MB of archives.
After this operation, 463 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty/main libxcb-keysyms1 amd64 0.3.9-1ubuntu1 [8,008 B]
Get:2 http://us.archive.ubuntu.com/ubuntu/ trusty/main libxkbcommon-x11-0 amd64 0.4.1-0ubuntu1 [13.6 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ trusty-security/main libqt5gui5 amd64 5.2.1+dfsg-1ubuntu14.3 [1,857 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu/ trusty/main libsctp1 amd64 1.0.15+dfsg-1 [9,226 B]
Get:5 http://us.archive.ubuntu.com/ubuntu/ trusty-security/main linux-image-3.13.0-125-generic amd64 3.13.0-125.174 [15.5 MB]
Get:6 http://us.archive.ubuntu.com/ubuntu/ trusty-security/main icedtea-7-jre-jamvm amd64 7u131-2.6.9-0ubuntu0.14.04.2 [431 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu/ trusty-security/main openjdk-7-jre-headless amd64 7u131-2.6.9-0ubuntu0.14.04.2 [39.4 MB]
Get:8 http://us.archive.ubuntu.com/ubuntu/ trusty/universe libcairo-perl amd64 1.104-1 [114 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu/ trusty/universe libglib-perl amd64 3:1.304-1 [332 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu/ trusty/universe libpango-perl amd64 1.224-2 [220 kB]
Get:11 http://us.archive.ubuntu.com/ubuntu/ trusty/universe libgtk2-perl amd64 2:1.249-2 [553 kB]
Get:12 http://us.archive.ubuntu.com/ubuntu/ trusty-security/main linux-image-extra-3.13.0-125-generic amd64 3.13.0-125.174 [36.6 MB]
Get:13 http://us.archive.ubuntu.com/ubuntu/ trusty-security/main linux-generic amd64 3.13.0.125.135 [1,786 B]
Get:14 http://us.archive.ubuntu.com/ubuntu/ trusty-security/main linux-image-generic amd64 3.13.0.125.135 [2,296 B]
Get:15 http://us.archive.ubuntu.com/ubuntu/ trusty-security/main linux-headers-3.13.0-125 all 3.13.0-125.174 [8,890 kB]
Get:16 http://us.archive.ubuntu.com/ubuntu/ trusty-security/main linux-headers-3.13.0-125-generic amd64 3.13.0-125.174 [695 kB]
Get:17 http://us.archive.ubuntu.com/ubuntu/ trusty-security/main linux-headers-generic amd64 3.13.0.125.135 [2,282 B]
Get:18 http://us.archive.ubuntu.com/ubuntu/ trusty/main lksctp-tools amd64 1.0.15+dfsg-1 [51.3 kB]
Get:19 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main software-properties-common all 0.92.37.8 [9,384 B]
Get:20 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main software-properties-gtk all 0.92.37.8 [47.0 kB]
Get:21 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main python3-software-properties all 0.92.37.8 [19.2 kB]
Get:22 http://us.archive.ubuntu.com/ubuntu/ trusty-security/main liboxideqtcore0 amd64 1.21.5-0ubuntu0.14.04.1 [32.8 MB]
Get:23 http://us.archive.ubuntu.com/ubuntu/ trusty-security/main liboxideqtcore0 amd64 1.21.5-0ubuntu0.14.04.1 [32.8 MB]
Get:24 http://us.archive.ubuntu.com/ubuntu/ trusty-security/main oxideqt-codecs amd64 1.21.5-0ubuntu0.14.04.1 [644 kB]
Get:25 http://us.archive.ubuntu.com/ubuntu/ trusty/main libandroid-properties1 amd64 0.1.0+git20131207+e452e83-0ubuntu12 [9,494 B]
Get:26 http://us.archive.ubuntu.com/ubuntu/ trusty-security/main liboxideqtquick0 amd64 1.21.5-0ubuntu0.14.04.1 [240 kB]
Get:27 http://us.archive.ubuntu.com/ubuntu/ trusty-security/main liboxideqt-qmlplugin amd64 1.21.5-0ubuntu0.14.04.1 [157 kB]
Err http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main libqt4-xmlpatterns amd64 4:4.8.5+git192-g085f851+dfsg-2ubuntu4.1
  Unable to connect to 101.44.1.9:http:
Fetched 130 MB in 1h 51min 54s (19.3 kB/s)                                     
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/q/qt4-x11/libqt4-xmlpatterns_4.8.5+git192-g085f851+dfsg-2ubuntu4.1_amd64.deb  Unable to connect to 101.44.1.9:http:

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
zhangkehu@ubuntu:/$ sudo apt-get install gcc
[sudo] password for zhangkehu: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  g++-4.8 libstdc++-4.8-dev
Use 'apt-get autoremove' to remove them.
Suggested packages:
  gcc-multilib autoconf automake1.9 libtool flex bison gcc-doc
The following NEW packages will be installed:
  gcc
0 upgraded, 1 newly installed, 0 to remove and 778 not upgraded.
Need to get 5,098 B of archives.
After this operation, 42.0 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty/main gcc amd64 4:4.8.2-1ubuntu6 [5,098 B]
Fetched 5,098 B in 21s (235 B/s)
Selecting previously unselected package gcc.
(Reading database ... 203314 files and directories currently installed.)
Preparing to unpack .../gcc_4%3a4.8.2-1ubuntu6_amd64.deb ...
Unpacking gcc (4:4.8.2-1ubuntu6) ...
Processing triggers for man-db (2.6.7.1-1) ...
Setting up gcc (4:4.8.2-1ubuntu6) ...
update-alternatives: error: alternative path /usr/bin/gcc doesn't exist
dpkg: error processing package gcc (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
 gcc
E: Sub-process /usr/bin/dpkg returned an error code (1)
zhangkehu@ubuntu:/$ sudo apt install gcc
Reading package lists... Done
Building dependency tree        
Reading state information... Done
gcc is already the newest version.
The following packages were automatically installed and are no longer required:
  g++-4.8 libstdc++-4.8-dev
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 778 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up gcc (4:4.8.2-1ubuntu6) ...
update-alternatives: error: alternative path /usr/bin/gcc doesn't exist
dpkg: error processing package gcc (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
 gcc
E: Sub-process /usr/bin/dpkg returned an error code (1)
zhangkehu@ubuntu:/$ sudo dpkg --configure -a
Setting up gcc (4:4.8.2-1ubuntu6) ...
update-alternatives: error: alternative path /usr/bin/gcc doesn't exist
dpkg: error processing package gcc (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
 gcc
5
  • You have probably deleted the dependent package. What version of Ubuntu are you using? What are the outputs of apt-cache policy gcc and apt-cache depends gcc? Please edit your question to include these. Aug 2, 2017 at 14:42
  • try sudo apt-get install build-essential , should install everything gcc needs.
    – mondjunge
    Aug 2, 2017 at 15:14
  • You probably need to re-install gcc-4.8 - however it's hard to be sure unless you can be more specific than "I delete gcc in somewhere" - did you delete the package? or the executable? or the symbolic link? Aug 2, 2017 at 15:25
  • Yes,the command "sudo apt-get install build-essential" seems work,thanks.
    – aolphn
    Aug 4, 2017 at 15:08
  • You were able to install the build-essential as well as you can now also install gcc after having cleaned your repository. There were packages that were incompatible with the Ubuntu repository libraries that were interfering with your subsequent install gcc installs. Aug 4, 2017 at 15:27

1 Answer 1

2

You'll have to completely purge what you have and perform a fresh install.

Much of this is done automatically when using the GUI. But when using the commandline you have to be specific to remove the leftover packages and other files manually.

First completely purge/remove what you currently have installed, which isn't working. Clean and update your repository cache and packages, then freshly install gcc.

$ sudo apt purge gcc
$ sudo apt-get autoremove
$ sudo apt update
$ sudo apt upgrade
$ sudo apt full-upgrade
$ sudo apt install gcc

Check for errors between commands. There shouldn't be errors. If they are, address the suggested remedy provided to fix the error. For instance, there might be an occasional warning or error such as:

E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.

To resolve that particular state, run:

$ sudo dpkg --configure -a

Then after fixing that part, proceed to the next step.

Each of the commands should give a clean state. You'll then have a fresh install from the repository.

7
  • well,I follow your command and encounter some errors:
    – aolphn
    Aug 3, 2017 at 14:35
  • As indicated in the answer, there will be errors at various points. The errors will have resolution steps. Perform the step provided on the console, then proceed to the next step. I added an example of an error that could happen and showed how to proceed according to the example error. Run the command it suggests. In your case can you add the command you issued and the console error/response to that command? When you update your question with the output, please use text... not a picture of the text. I'll interpret for you how to respond to the output error/message. Aug 3, 2017 at 14:40
  • zhangkehu@ubuntu:/$ sudo dpkg --configure -a Setting up gcc (4:4.8.2-1ubuntu6) ... update-alternatives: error: alternative path /usr/bin/gcc doesn't exist dpkg: error processing package gcc (--configure): subprocess installed post-installation script returned error exit status 2 Errors were encountered while processing: gcc
    – aolphn
    Aug 3, 2017 at 14:41
  • I can't make out your output. If you copy/paste the command and output to your question, either I or some of the other users will format it for you to make it easy to read. Aug 3, 2017 at 14:45
  • ok,I post it into question.
    – aolphn
    Aug 3, 2017 at 14:52

You must log in to answer this question.

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