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

    <tr>
        <th>Summary</th>
        <td>
            Unable to compile LLVM libc due to warnings treated as errors
        </td>
    </tr>

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

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

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

<pre>
    I'm trying to compile the LLVM libc project on Ubuntu, but I keep running into an issue where warnings are being treated as errors, specifically related to type conversion. Here is the relevant error message:

```
In file included from /home/chongchuanlong/src/LLVM/llvm-project-18.1.8.src/libc/src/__support/CPP/stringstream.h:16,
                 from /home/chongchuanlong/src/LLVM/llvm-project-18.1.8.src/libc/src/__support/StringUtil/error_to_string.cpp:14:
/home/chongchuanlong/src/LLVM/llvm-project-18.1.8.src/libc/src/__support/integer_to_string.h:160:58: error: conversion from ‘long unsigned int’ to ‘unsigned char’ may change value [-Werror=conversion]
  160 | template <size_t radix> using Custom = details::Fmt<radix>;
      |                                                          ^
...
cc1plus: all warnings being treated as errors
```


I have already tried setting the following CMake flags:

```
cmake -G "Unix Makefiles" -DLLVM_ENABLE_PROJECTS="libc" -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-Wno-error" -DCMAKE_C_FLAGS="-Wno-error" -DCMAKE_INSTALL_PREFIX=$HOME/local/llvm/libc ../llvm-project-18.1.8.src/llvm
```

And I also tried:


```
make CFLAGS="-Wno-error=format-truncation"
```

And I also tried:


```
env CXXFLAGS="-Wno-ignored-qualifiers -Wno-stringop-truncation -Wno-cast-function-type" make
```

And I also add `set(CMAKE_COMPILE_WARNING_AS_ERROR OFF)` at top of the llvm-project-18.1.8.src/libc/CMakeLists.txt


But the problem persists. 
How can I compile the project successfully without treating these warnings as errors?
Thanks in advance for any help!
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm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