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

    <tr>
        <th>Summary</th>
        <td>
            Cannot Cross-Compiler Compiler-rt with Clang Since Compiler-rt Is Missing
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

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

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

<pre>
    I have built Clang and LLVM and runtimes on my x86_64 host. I have configured Clang using compiler-rt and libunwind by default. I know Clang was born for cross compiling, so I want to use Clang to build my programs for ARM64. However, when I try to configure Compiler-rt builds, the CMake compiler check is always throwing errors on linking:

```
    ld.lld: error: cannot open crtbeginS.o: No such file or directory
    ld.lld: error: cannot open /usr/local/llvm/lib/clang/19/lib/aarch64-unknown-linux-musl/libclang_rt.builtins.a: No such file or directory
    ld.lld: error: unable to find library -lunwind
    ld.lld: error: cannot open /usr/local/lib/clang/19/lib/aarch64-unknown-linux-musl/libclang_rt.builtins.a: No such file or directory
    ld.lld: error: unable to find library -lunwind
    ld.lld: error: cannot open crtendS.o: No such file or directory
```

If I define `-D CMAKE_C_COMPILER_WORKS=1 -D CMAKE_CXX_COMPILER_WORKS=1` to skip checking them, the configure process will finish, with everything being failed on checking, and the following compilation fails.

How can I boostrap Compiler-rt for that target?

Notes: The Linux headers and musl libc for target `aarch64-unknown-linux-musl` are ready in `/usr/local/aarch64-unknown-linux-musl`. Clang option `--sysroot=/usr/local/aarch64-unknown-linux-musl` should work.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzcVV2PmzgU_TXOy1UQGEKSBx6ymUaNOmlXM6vdvkUGLtgbx0a2Gcq_X13IfGlXVbePlVCwYp_D_TjnWnivWoNYsNVvbHW3EH2Q1hXtKEKHwi1KW4_FEaR4Qih7pQPstTAtCFPD_f2fp2nhehPUFT1YA9c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