LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to uninstall gcc so I can start over? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-uninstall-gcc-so-i-can-start-over-4175603002/)

NotionCommotion 04-01-2017 06:07 PM

How to uninstall gcc so I can start over?
 
I am trying to upgrade to gcc5 on a rasperry pi. I tried the following:
Code:

sudo apt update
sudo apt upgrade
sudo vi /etc/apt/sources.list    #change “jessie” to “stretch”
sudo apt update
sudo apt install gcc-5

But now I am getting some strage "Segmentation fault"

Code:

michael@raspberrypi3:~/testclient/build $ cmake -DCMAKE_BUILD_TYPE=Release ../ && make
Segmentation fault
michael@raspberrypi3:

Furthermore, it seems like I went past gcc5 all the way to 6.
Code:

michael@raspberrypi3:~ $ gcc --version
gcc (Raspbian 6.3.0-10+rpi1) 6.3.0 20170321
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

michael@raspberrypi3:~ $

How can I completely remove gcc and start over?

jpollard 04-01-2017 08:48 PM

Depends on what broke.

To me, it looks like cmake aborted.

You might try the commands separately to see. You may need an update of cmake.

hydrurga 04-01-2017 09:40 PM

When a distro puts a version together, they pay attention to trying to ensure that everything works together. The system components, of which gcc is one, are part of that intricate web.

So personally, and others may disagree with me, I would have been reticent in the first place to update only gcc and no other system components. If I wanted a more up-to-date version of gcc for a particular purpose, especially with a different major version number, then I would install a separate gcc version in addition to my current one (see http://gcc.gnu.org/faq.html#multiple), keeping the current one to handle everyday system compilations.

However, even then, I would probably prefer to upgrade the entire system version to one more closely matched with the new gcc version.

Uninstalling gcc? It will probably remove several packages with it. You might be better changing the sources list back and then forcing a downgrade. That might cause unintended complications however. Personally I would have made a system image before mucking around with gcc so that I could easily roll back to a previous image if things went awry.

However, in saying all that, see http://unix.stackexchange.com/questi...ian-jessie-8-1

AwesomeMachine 04-02-2017 02:03 AM

Try:
Code:

$ dpkg --purge --force-depends gcc
Then, read the man page for apt-get, so you can specify which branch of Debian to install from, i.e. stable, testing, sid.

Testing uses gcc6 which breaks a few things, like the kernel compile.

hazel 04-02-2017 03:03 AM

Quote:

Originally Posted by hydrurga (Post 5691510)
So personally, and others may disagree with me, I would have been reticent in the first place to update only gcc and no other system components. If I wanted a more up-to-date version of gcc for a particular purpose, especially with a different major version number, then I would install a separate gcc version in addition to my current one (see http://gcc.gnu.org/faq.html#multiple), keeping the current one to handle everyday system compilations.

In LFS, gcc is one of the things that you never update. The others are binutils, glibc and the kernel headers against which glibc was built.

Shadow_7 04-02-2017 04:49 AM

$ sudo apt-get install build-essential

Perhaps you're missing things, which is why it fails.

The NOT best practices way, would be to change the /usr/bin/g?? links to some other version of gcc.

$ ls -l /usr/bin/g??

$ ls -l /usr/bin/gcc-*

$ sudo rm /usr/bin/gcc
$ sudo ln -s /usr/bin/gcc-4.9 /usr/bin/gcc

And such. The way you're supposed to do that is with the package management system. Or by overriding environment variables CC, CXX, ... ... ... But not all build configurations are portable enough to respect the environment vars.


All times are GMT -5. The time now is 12:31 AM.