CMake Error: Could Not Find Devtoolset Compiler on CentOS 7

This error message occurs when CMake cannot locate the devtoolset compiler and linker on CentOS 7 systems. It typically arises when compiling software that requires a specific compiler version.

Error Message:

-- Running cmake version 3.22.0-rc1
-- Found Git: /usr/bin/git (found version '1.8.3.1')
-- This is .el7. as found from 'rpm -qf /'
-- Looking for a devtoolset compiler
CMake Warning at CMakeLists.txt:347 (MESSAGE):
  Could not find devtoolset compiler/linker in /opt/rh/devtoolset-10

CMake Warning at CMakeLists.txt:349 (MESSAGE):
  You need to install the required packages:

   yum install devtoolset-10-gcc devtoolset-10-gcc-c++ devtoolset-10-binutils

Solution:

The warning message provides the solution: you need to install the devtoolset-10 packages on your CentOS 7 system.

Installation Steps:

  1. Install the devtoolset-10 packages using yum:

yum install devtoolset-10-gcc devtoolset-10-gcc-c++ devtoolset-10-binutils


2. **Activate the devtoolset environment:**

```bash
source /opt/rh/devtoolset-10/enable
  1. Re-run CMake:

    After installing the devtoolset-10 packages and activating the environment, re-run CMake to resolve the error.

Explanation:

The devtoolset is a collection of compilers and tools that provide different versions of the GCC compiler and other related utilities. When a project requires a specific compiler version, it might not be available in the default system packages. This is why you need to install the devtoolset packages to use a different compiler version.

Note:

  • If you encounter problems installing the devtoolset packages, make sure your system is up-to-date and has a working internet connection.
  • You might need to use the sudo command to install packages using yum if you don't have root privileges.
  • The devtoolset environment is activated only for the current shell session. You might need to re-activate it each time you open a new terminal window.

By following these steps, you can successfully install the required devtoolset-10 packages and resolve the 'Could not find devtoolset compiler/linker' error on your CentOS 7 system. This will allow you to compile software that depends on a specific compiler version.

CMake Error: Could Not Find Devtoolset Compiler on CentOS 7

原文地址: http://www.cveoy.top/t/topic/pb2b 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录