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

    <tr>
        <th>Summary</th>
        <td>
            compiler-rt in the stage 2 and stage 3 build can't generate sanitizer libraries as stage 1 build
        </td>
    </tr>

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

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

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

<pre>
    Hello,
 The build script I'm using is build-llvm.sh which is attached as [build-llvm.sh.txt](https://github.com/llvm/llvm-project/files/10330004/build-llvm.sh.txt) . Inside that script, it is very clear can see how cmake configuration has been done. I can sucessfully to do a 3 stages build for clang linked with libc++ without gcc. But only meet one issue is that during stage 2 and stage 3 build, it can't generate sanitizer libraries like stage 1 which such like libclang_rt.asan.a and some other libclang_rt.*san*.a in relative path lib/clang/15.0.6/lib/x86_64-unknown-linux-gnu.
![image](https://user-images.githubusercontent.com/20179047/210195653-343df7ae-2eae-4b9e-b076-69c77f083a21.png)

 Below are the build trace for stage 1 to 3.
[build-stage1.log](https://github.com/llvm/llvm-project/files/10330000/build-stage1.log)
[build-stage2.log](https://github.com/llvm/llvm-project/files/10330001/build-stage2.log)
[build-stage3.log](https://github.com/llvm/llvm-project/files/10330002/build-stage3.log)

 According to build-stage1.log, I have found the result of "Compiler-RT supported architectures" is x86_64.
![image](https://user-images.githubusercontent.com/20179047/210195824-70661658-4317-4b6b-9b17-c4243a838fd5.png)

 But for build-stage2.log, also as build-stage3.log, the result of the result of "Compiler-RT supported architectures" is empty. I'm still searching why it is empty. I think this will cause sanitizer libraries in compiler-rt will not included to build.
![image](https://user-images.githubusercontent.com/20179047/210195873-4ad0209c-d8a6-4307-abb3-dd328210cf0f.png)
 
   I have also found If I move 'compiler-rt' from the list of LLVM_ENABLE_RUNTIMES to LLVM_ENABLE_PROJECTS. the compiler-rt in stage 2 and stage 3 build can sucessfully to generate libclang_rt.asan.a and other libclang_rt.*san*.a in relative path lib/clang/15.0.6/lib/x86_64-unknown-linux-gnu as stage 1 build.

The compile behaviour is quite strange. What my purpose is stage 2 and stage 3 can do like stage 1 to generate all the sanitizer libraries. Any thing doing wrong for my build-llvm.sh?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8Vl1z27YS_TXQyw45IPipBz1YjjXXd5LcO4nbPnpAcEkiBgEVH1bUX98BKTlW7KTTadIXiAIXPLt7DnDAnZODRtyQckvKNyse_Gjs5pPkeoiDG7letaY7bv6DShnCrgl9Q-gV3I0IbZCqAyes3Hu4JayeIDipB5BueZco9TilboTDKMUYp7n3XIzYAXdAyu1FVOo_e1K-IawZvd87kl8RtiNsN0g_hjYVZiJsF2NPP8nemk8oPGG7Xip0hO0ymueU0oKw3ctPszWkcKud7BD8yP0pc8KuQfqY3CPaIwiF3ILgGhwijOYAYuIPCMLoXg7Bci-NhpE7aBE1dEZjCrfLgiDQuT4odQRvoDPAIQfn-YCnhkBvLAjF9QBK6gfs4CD9CEq2grAtYdv5vwkeBiFS2AYPRqsjTIjxCUE6F-K4FNAFG9s9IwADrrvTc77AnUoTXBNWexhQo-UewXEtvfwDbUS23Ep0oOQDnlZnJ75cEOMyHxOMWd9bn3LHdcoXMDMhGD8uH3qKIOzKRcirlIPUYFFxLx8R9nyplbDdHBsJK1OaVpHQefpzU91XRRL0gzYHnSipw-dk0CFdVEdYRsqtnPiArwklOLTJ_Nali2jijDDao_Yn_TCa1Wta1PExo9m6rMo8yYu862uOCUOOSdGuMWlpXSXVWtR1T5ucsyzdx4TXp0SWTbBFZQ7AbdTTeTt4ywXOPJ-b6Q3k5wLOkp_fZakyw49RPH1S_LMvP2V7gcp-HGp2icq-g5r_OFR2iZpfoi7MXAlhbBc3hzfwsjHXcAsjf4w8Bd3N7Fl0QXkwPRDGrs20lwpt8uEOXNjvjfXxzLJilB6FDzbmw-I-XBT7E_XZsCKpaVVlVdk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