I am trying to build llvm from source for compiler development ( Suggest any alternative if you have ) It seems the build is necessary but I have tried using different build systems like make and ninja and both have failed at some point, how to I get about this error and I don’t know what is going on here, following is the error log that followed by the build command. The complete error log was just too big to post here, if necessary please ask.
Build command
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_ENABLE_PROJECTS='clang;lldb;lld;mlir;clang-tools-extra;compiler-rt;libcxx;libcxxabi;libunwind' -DLLVM_CCACHE_BUILD=ON ../llvm
ninja
Error log :
Building CXX object projects/libcxxabi/src/CMakeFiles/cxxabi_static_objects.dir/cxa_vector.cpp.o
FAILED: projects/libcxxabi/src/CMakeFiles/cxxabi_static_objects.dir/cxa_vector.cpp.o
CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /usr/bin/c++ -DHAVE___CXA_THREAD_ATEXIT_IMPL -DLIBCXX_BUILDING_LIBCXXABI -D_GNU_SOURCE -D_LIBCPP_BUILDING_LIBRARY -D_LIBCXXABI_BUILDING_LIBRARY -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iprojects/libcxxabi/src -I/home/pawan31/llvm/libcxxabi/src -Iinclude -I/home/pawan31/llvm/llvm/include -I/home/pawan31/llvm/libcxxabi/../libcxx/src -Iinclude/c++/v1 -Iinclude/x86_64-unknown-linux-gnu/c++/v1 -I/home/pawan31/llvm/libcxxabi/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -nostdinc++ -Werror=return-type -W -Wall -Wchar-subscripts -Wconversion -Wmissing-braces -Wunused-function -Wshadow -Wsign-compare -Wsign-conversion -Wstrict-aliasing=2 -Wstrict-overflow=4 -Wunused-parameter -Wunused-variable -Wwrite-strings -Wundef -Wno-suggest-override -Wno-error -pedantic -fstrict-aliasing -funwind-tables -D_DEBUG -UNDEBUG -std=c++2a -MD -MT projects/libcxxabi/src/CMakeFiles/cxxabi_static_objects.dir/cxa_vector.cpp.o -MF projects/libcxxabi/src/CMakeFiles/cxxabi_static_objects.dir/cxa_vector.cpp.o.d -o projects/libcxxabi/src/CMakeFiles/cxxabi_static_objects.dir/cxa_vector.cpp.o -c /home/pawan31/llvm/libcxxabi/src/cxa_vector.cpp
In file included from include/c++/v1/__type_traits/is_referenceable.h:14,
from include/c++/v1/__type_traits/add_lvalue_reference.h:13,
from include/c++/v1/__functional/invoke.h:14,
from include/c++/v1/type_traits:421,
from include/c++/v1/exception:85,
from /home/pawan31/llvm/libcxxabi/src/cxa_vector.cpp:16:
include/c++/v1/__type_traits/is_same.h:22:53: error: there are no arguments to ‘__is_same’ that depend on a template parameter, so a declaration of ‘__is_same’ must be available [-fpermissive]
22 | struct _LIBCPP_TEMPLATE_VIS is_same : _BoolConstant<__is_same(_Tp, _Up)> { };
| ^~~~~~~~~
include/c++/v1/__type_traits/is_same.h:22:53: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
include/c++/v1/__type_traits/is_same.h:22:72: error: template argument 1 is invalid
22 | struct _LIBCPP_TEMPLATE_VIS is_same : _BoolConstant<__is_same(_Tp, _Up)> { };
| ^
...
include/c++/v1/__algorithm/copy.h:79:24: error: ‘value’ is not a member of ‘std::__1::is_copy_constructible<{anonymous}::itanium_demangle::ForwardTemplateReference**>’
78 | __enable_if_t<!(is_copy_constructible<_InIter>::value
| ~~~~~
79 | && is_copy_constructible<_Sent>::value
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/c++/v1/__algorithm/copy.h:79:24: error: ‘value’ is not a member of ‘std::__1::is_copy_constructible<{anonymous}::itanium_demangle::ForwardTemplateReference**>’
include/c++/v1/__algorithm/copy.h:80:24: error: ‘value’ is not a member of ‘std::__1::is_copy_constructible<{anonymous}::itanium_demangle::ForwardTemplateReference**>’
78 | __enable_if_t<!(is_copy_constructible<_InIter>::value
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
79 | && is_copy_constructible<_Sent>::value
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
80 | && is_copy_constructible<_OutIter>::value), int> = 0 >
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/c++/v1/__algorithm/copy.h:92:1: note: candidate: ‘template<class _InIter, class _Sent, class _OutIter, typename std::__1::enable_if<((std::__1::is_copy_constructible<_Tp>::value && std::__1::is_copy_constructible<_Hash>::value) && std::__1::is_copy_constructible<_OutIter>::value), int>::type <anonymous> > constexpr std::__1::pair<_InputIterator, _ForwardIterator> std::__1::__copy(_InIter, _Sent, _OutIter)’
92 | __copy(_InIter __first, _Sent __last, _OutIter __result) {
| ^~~~~~
include/c++/v1/__algorithm/copy.h:92:1: note: substitution of deduced template arguments resulted in errors seen above
In file included from include/c++/v1/__algorithm/next_permutation.h:14,
from include/c++/v1/algorithm:1433,
from include/c++/v1/array:127,
from /home/pawan31/llvm/libcxxabi/src/demangle/Utility.h:20,
from /home/pawan31/llvm/libcxxabi/src/demangle/ItaniumDemangle.h:21,
from /home/pawan31/llvm/libcxxabi/src/cxa_demangle.cpp:13:
include/c++/v1/__algorithm/reverse.h: In instantiation of ‘constexpr void std::__1::reverse(_BidirectionalIterator, _BidirectionalIterator) [with _BidirectionalIterator = char*]’:
/home/pawan31/llvm/libcxxabi/src/demangle/ItaniumDemangle.h:2333:19: required from ‘void {anonymous}::itanium_demangle::FloatLiteralImpl<Float>::printLeft({anonymous}::itanium_demangle::OutputBuffer&) const [with Float = long double]’
/home/pawan31/llvm/libcxxabi/src/demangle/ItaniumDemangle.h:2311:8: required from here
include/c++/v1/__algorithm/reverse.h:51:89: error: no type named ‘iterator_category’ in ‘struct std::__1::iterator_traits<char*>’
51 | _VSTD::__reverse(__first, __last, typename iterator_traits<_BidirectionalIterator>::iterator_category());
| ^~~~~~~~~~~~~~~~~~~
In file included from /home/pawan31/llvm/libcxxabi/src/cxa_demangle.cpp:13:
/home/pawan31/llvm/libcxxabi/src/demangle/ItaniumDemangle.h:136:10: warning: ‘size_t {anonymous}::itanium_demangle::PODSmallVector<T, N>::size() const [with T = {anonymous}::itanium_demangle::Node*; long unsigned int N = 8]’ used but never defined
136 | size_t size() const { return static_cast<size_t>(Last - First); }
| ^~~~
/home/pawan31/llvm/libcxxabi/src/demangle/ItaniumDemangle.h:136:10: warning: ‘size_t {anonymous}::itanium_demangle::PODSmallVector<T, N>::size() const [with T = {anonymous}::itanium_demangle::PODSmallVector<{anonymous}::itanium_demangle::Node*, 8>*; long unsigned int N = 4]’ used but never defined
ninja: build stopped: subcommand failed.
It seems the following is the problem
include/c++/v1/__type_traits/is_same.h:22:53: error: there are no arguments to ‘__is_same’ that depend on a template parameter, so a declaration of ‘__is_same’ must be available [-fpermissive]
22 | struct _LIBCPP_TEMPLATE_VIS is_same : _BoolConstant<__is_same(_Tp, _Up)> { };
| ^~~~~~~~~
include/c++/v1/__type_traits/is_same.h:22:53: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
include/c++/v1/__type_traits/is_same.h:22:72: error: template argument 1 is invalid
22 | struct _LIBCPP_TEMPLATE_VIS is_same : _BoolConstant<__is_same(_Tp, _Up)> { };