<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/57843>57843</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Clang-15 fails to select proper candidate GCC installation on CentOS7 with multiple devtoolset versions
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          sfc-gh-mheimel
      </td>
    </tr>
</table>

<pre>
    This is a (somewhat obscure) issue that was introduced by [a recent driver change](https://github.com/llvm/llvm-project/commit/9f97720268911abae2ad9d90e270358db234a1c1) to the GCC candidate selection code for RHEL devtoolset installations:

- Before this change, the driver would enumerate a list of hardcoded `/opt/rh/devtoolset-XXX` path prefixes for the various devtoolset versions, from which the driver selects the one that provides the GCC installation with the highest version number.
- After this change, the driver iterates over the `/opt/rh` folder and selects the `devtoolset-XXX` path with the highest number. Only this path is checked for a GCC candidate installation.

This change causes problems on systems that have multiple devtoolset versions installed where the latest version does not provide a GCC installation. For instance, consider a system that has a full devtoolset-10 installation as well as a partial (say, only binutils) devtoolset-11 installation. In this case, the clang-15 driver will fail to detect the devtoolset-10 GCC candidate and fall back to the ancient system GCC, while clang-14 will correctly pick up devtoolset-10.

This issue particularly affects ARM installations of CentOS7: For some reason, CentOS [does not provide a devtoolset-11-gcc package for ARM](https://bugs.centos.org/view.php?id=18393). In our case, we therefore have to rely on using both devtoolset-11-binutils and devtoolset-10-gcc, which means the above bug currently prevents us from migrating to clang 15.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVVUlv4zYY_TXyhbChxZsOOmSSpi3QYoDpHHKlyE8SO5QokJTd_Ps-UrJjJ-kABQSbEpe3fAtrI1-r751yDA9nSX50pqdzxz0ztROTpSQvMecmYj58PXMsHbw1chIkWf3Kkt0XziwJGjyTVp3IMtHxoaVk94TzOu9HlxQPSf6Mp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