<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63238>63238</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[libc] math.h is not generated in some (bootstrap) configurations
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
s-barannikov
</td>
</tr>
</table>
<pre>
***Steps to reproduce***
```
cd llvm-project
git checkout 9615d485
patch -p1 < patch.txt
cmake -DCMAKE_BUILD_TYPE=Release -S llvm -B cmake-build-release -G Ninja \
-DCMAKE_INSTALL_PREFIX=install \
-DBUILD_SHARED_LIBS=ON \
-DLLVM_CCACHE_BUILD=ON \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DLLVM_ENABLE_LLD=ON \
-DLLVM_TARGETS_TO_BUILD="ARM" \
-DLLVM_ENABLE_PROJECTS="clang;lld" \
-DLLVM_ENABLE_RUNTIMES="libc" \
-DLLVM_DEFAULT_TARGET_TRIPLE="armv7m-none-eabi" \
-DLLVM_RUNTIME_TARGETS="armv7m-none-eabi" \
-DLLVM_LIBC_FULL_BUILD=ON \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DRUNTIMES_armv7m-none-eabi_LLVM_INCLUDE_TESTS=OFF
ninja -C cmake-build-release install
```
[patch.txt](https://github.com/llvm/llvm-project/files/11712751/patch.txt)
The specific revision is necessary because the very next commit breaks the build further.
The patch reduces the number of entrypoints to the necessary set (ctype.h, math.h headers, a few entrypoints).
It also works around a bug that causes the host linker to be used for linking target libraries.
***Expected behavior***
Installation succeeds, install/include contains math.h.
***Actual behavior***
Installation fails with error:
```
-- Install configuration: "Release"
-- Installing: /mnt/d/llvm-project/install/include/ctype.h
CMake Error at runtimes/runtimes-armv7m-none-eabi-bins/libc/include/cmake_install.cmake:50 (file):
file INSTALL cannot find
"/mnt/d/llvm-project/cmake-build-release/runtimes/runtimes-armv7m-none-eabi-bins/libc/include/math.h":
No such file or directory.
Call Stack (most recent call first):
runtimes/runtimes-armv7m-none-eabi-bins/libc/cmake_install.cmake:47 (include)
runtimes/runtimes-armv7m-none-eabi-bins/cmake_install.cmake:47 (include)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVlFvo7wS_TXOy4iImJI2D3kgBL7NvTStkvRq7xMyZgjegh3Zpt3--08G0nbb7Gp3pagN9sycMzNnJjBjxFEiLkm4IuF6wjpbK700XsE0k1I8qqdJocqXJaHR8NlbPBmwCjSetCo7jq9XxF8TPyJzf_z0j7yEpnlqvZNW35Db4fAoLPAa-aPqLCzms7C8ugmHqxOzvAbvNAMSxNA_Te330Y-37BHBW8e30X-TfPWwydb54f_3CQnWO2yQGQRv3-OBt4Le2is60ZSePl__A1shvzEgYTzEPEfbbPeHKMvy-12Sbr6SYC2ksaxp3lsOiPsv0S5Z59lmtSfB-m773iLL_nebx3EUfxn5fbIY0OI8vru932TJjgRr3jB5vGDz9esnK0JXhK4-ISbbaJUleXYBr78_RLt_ksM-P9y9siKURrtbQunPgt3v7v6TxIf9YDugB6umKX_hs3vYHja3yejTiIJfMl4nafSQHUZW-WG3uc-SwYXp9um69aSS6CErxCX3EeSc1O87ZptVnKcPWfaT1rzPJNrvk91hc7f93ONzkvlHzLwPsNnG2cM6yQ_Jvid3l6aDp-yF58UXhTmq7eIMkXD1NgjhmtCb2tqTIUFEaEpoehS27oopVy2hqVP_-O916GhaiQYNoelsdj2j1-GM0PQtJF2MOP3fQ41gTshFJThofBJGKAnCgESOxjD9AgVy1hkEWyM8oX4Bid8tcNW2wkKhkT2a_q5PEapO2xr19C38MOQa3foYLGXXFqhBVYDS6peTEtL2a6a_fAU2aIHQG25fTjitCY2hZbae1lAjK1Ebd8Kgwuf3YQhdjNgbC6wxCp6VfjTAtOpkCQyK7gi2Zhb6rAZCtTIWGiEfUTsaBUJnsIRK6f5UyCNYpo_ojArNtEAzfV_F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