-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Labels
Description
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!