Search code examples
gccinstallation

gcc : permission denied after new installion


It's a new installation on Deepin OS. I wanted to install gcc-8.3.0 on my computer.

I've done this manually cause it only propose me gcc-6 with apt. So I've installed all the depedency (GMP, MPFR, MPC, isl...) then I've proceeded to gcc. I've followed this tutorial : https://archerfmy.github.io/2017/04/12/How-to-switch-your-gcc-g-version-in-ubuntu/ to add the new installation. But now the problem is that I can't use gcc anymore.


gcc 
zsh: permission denied: gcc

which -a gcc
gcc not found

Solution

  • I've found ! It seems pretty obvious now but while reading update-alternatives's man page I realized that I wasn't putting the right parameters. In fact, I was giving the path to the directory of gcc-8.3.0 but not the path to gcc itself. I mean, only /usr/lib/gcc-8.3.0 instead of /usr/lib/gcc-8.3.0/bin/x86_64-pc-linux-gnu-gcc-8.3.0. It took me so long to find out, f me.

    In my case the right cmd was :


    sudo update-alternatives --install /usr/bin/gcc gcc /usr/lib/gcc-8.3.0/bin/x86_64-pc-linux-gnu-gcc-8.3.0 50
    

    Hope it can help someone else and saving them time.