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

    <tr>
        <th>Summary</th>
        <td>
            LLVM_ENABLE_RUNTIMES and non-canonical triples don't match
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          rorth
      </td>
    </tr>
</table>

<pre>
    Between LLVM 14.0.0 rc1 and rc2, `test-release.sh` changed to configure with `-DLLVM_ENABLE_RUNTIMES=`.  This broke quite a number of tests on Solaris/amd64, which I usually build with `-triple amd64-pc-solaris2.11 -configure-flags " -DLLVM_HOST_TRIPLE=amd64-pc-solaris2.11"` to match the common name of the 64-bit x86 architecture on Solaris.

As it turns out, the introduction of `-DLLVM_ENABLE_RUNTIMES=` changes the directory
layout for the runtime libs.  Before, we had
```
./lib/clang/14.0.0/lib/sunos/libclang_rt.asan-x86_64.so
./lib/clang/14.0.0/lib/sunos/libclang_rt.asan-i386.so
```
while now there's
```
./lib/clang/14.0.0/lib/x86_64-pc-solaris2.11/libclang_rt.asan.so
./lib/clang/14.0.0/lib/i386-pc-solaris2.11/libclang_rt.asan.so
```
instead.

It seems `clang` only searches for the form of the triple passed during `cmake`, while the directories always use the canonical form of the triple, as can be seen like this:
```
$ ./bin/clang -print-runtime-dir
lib/clang/14.0.0/lib/sunos
$ ./bin/clang -print-runtime-dir -target x86_64-pc-solaris2.11
lib/clang/14.0.0/lib/x86_64-pc-solaris2.11
```
Obviously the two (configured triple and subdir used for runtime libs) need to be consistent.  Once could either use the configured triple for the subdir names or (more reliable because there can always be different non-canonical forms) always normalize the give triple when searching for libs.

Note that the issue is in no way Solaris-specific. I observe exactly the same issue on Linux/x86_64 with `target amd64-pc-linux-gnu` when configured for `x86_64-pc-linux-gnu`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm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