Nanny level tutorial of gcc upgrade version under Ubuntu system

Error installing cuda Failed to verify gcc version. See log at /var/log/cuda-installer.log for details.

After installing cuda , use the following command: sudo sh cuda_11.3_450.51.05_linux.run

The result is an error message: Failed to verify gcc version. See log at /var/log/cuda-installer.log for details.

Be careful not to delete gcc, and don't mess with other versions of gcc. Many gcc articles are very vague, and it is easy to mess up the system.

The GNU Compiler Collection is a collection of compilers and libraries for language development, including: C, C++, Objective-C, Fortran, Ada, Go, and D and other programming languages. Many open source projects, including the Linux kernel and GNU tools, are compiled using GCC.
This article describes how to install GCC on Ubuntu.

The default Ubuntu software repositories contain a package group named "build-essential", which contains the GNU Editor Collection, GNU Debugger, and other development libraries and tools necessary to compile software.
To install the development tools package, run the following command as a user with sudo privileges or as root:

sudo apt update
sudo apt install build-essential

This command will install a series of packages, including gcc, g++, and make.
You may also want to install the manual on how to develop with GNU/Linux.

sudo apt-get install manpages-dev

Verify that the GCC compiler is successfully installed by running the following command to print the GCC version.

sudo apt install gcc-8 g++-8 gcc-9 g++-9 gcc-10 g++-10
gcc --version
gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0
Copyright (C) 2019 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.

 

3. Install multiple GCC versions

Every Ubuntu system comes with multiple versions of gcc, but the highest version of gcc is the default

Check your gcc version, if it is version 11.x, it will have version 9 and 10

sudo apt install gcc-9 g++-9 gcc-10 g++-10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /usr/bin/gcov gcov /usr/bin/gcov-9

The above command configures each version and sets the priority. The default version is the one with the highest priority, in our case gcc-10. If an error still occurs, set gcc-9 to the highest level.

Guess you like

Origin blog.csdn.net/weixin_45303602/article/details/129784467