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

    <tr>
        <th>Summary</th>
        <td>
            cross build clang cannot find libclang_rt.builtins
        </td>
    </tr>

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

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

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

<pre>
    When we build llvm with this cmd

```
cmake ../llvm -G Ninja -DLLVM_DEFAULT_TARGET_TRIPLE=aarch64-linux-gnu -DLLVM_USE_LINKER=lld -DLLVM_ENABLE_RUNTIMES="compiler-rt;libunwind" -DLLVM_ENABLE_PROJECTS="mlir;clang;clang-tools-extra;lld" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=RelWithDebInfo
```

It builds successfully, while if we try do something like

```
./bin/clang --rtlib=compiler-rt hello.c
```

Something wrong happens
```
/usr/bin/aarch64-linux-gnu-ld: cannot find <PATH>/build-aarch64/lib/clang/19/lib/linux/libclang_rt.builtins-aarch64.a: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VF2T4igU_TX4QiWVQGL0IQ9q4qw7tmPZ9s7sU4oAMUwTcIG07f76LWLs3prp6qoUhI9zOZxzucRacVKc5yBdgrSYkN612uSXf629_kMmtWbX_HvLFbxwWPdCMijlSwcvwrXQtcJC2jEQFSBajO00Gr9hSDvyzGEYArQecMEXuBPqJ4FBsd3-9VAV5XrxtD1Wx8XhS3msjofNflsCXBBiaDtNAilU_xqcVH8HPD2W1Xaz-1oeAC6kZPf5crdYbsvq8LQ7bh7KR4ALgBDV3VlIbgLjAF5KUffqIhQDCP0C2x--_VmujiOsk8IAvKSSqNO9D5zW0gb81RniY8kxyuph8bWsVtXq28N-sx1YDfvfl378-G0RoCVAy7cty6fNtqiOf-_9zQ9cfheuLXi9UY3-UNRbu3E3Qyy0PaXc2qaX8grQCl5aITkUjffMmStkGlrdcdcKdYJSPPNPDPNO1UIBtB6vERgnRe2Zv4sJWy6lDukn7B7fDrwYrU6wJeczV_ZjBFr31rwd_Jv3gWQALyAlSmkHG6EYBHi1Xxz_ALj0MC9DMMJ8pon6zh-gdTx_mxoi3kbDamVc6MFOKHvHh8SftdNe1RY2XkltIBOGU6fNdUzrW2osIDdGG_8jhXrmBlLddUQx2BAhObs9E_4qHKSacRhDgGa95TB4gU5DyzkU6kVT4oRWAM1_UWfCcszmeE4mPI-zOM7mMc5mkzav04Q2aZKmzTyZxREjbIbTKa0zXidp1tQTkaMIJRHGUTTH03gWsozWyRSlJI5RhrMpSCLeESFD_ypDbU4TYW3P81kWp9FEkppLO5QEhEYdka8OJvf7g7o_WZBEUlhn3yM44STPqdHWjqXilkL_9-0j5Se9kXnr3NkC7HMBoPVJuLavQ6q7sXCMXXA2-ienDqD1wNcCtB4o_xcAAP__wmV6-g">