I cloned the LLVM git repositories and followed https://llvm.org/docs/GettingStarted.html. After configuration with
cmake $SOURCEDIR -G "Unix Makefiles" \
-DCLANG_DEFAULT_CXX_STDLIB=libc++ \
-DC_INCLUDE_DIRS=:/usr/include \
-DLLVM_ENABLE_WERROR=OFF \
-DCMAKE_BUILD_TYPE=DEBUG \
-DCMAKE_C_COMPILER=$CC \
-DCMAKE_CXX_COMPILER=$CXX \
-DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \
-DCMAKE_CXX_FLAGS_RELEASE="${CXXFLAGS}" \
-DCMAKE_INSTALL_PREFIX=$INSTALLDIR \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
I tried to build LLVM and Clang with
make -j 24
but it failes (I added new lines for improved readability):
/home/myUserName/LLVM/sources/tools/clang/utils/TableGen/ClangAttrEmitter.cpp:
In constructor ‘{anonymous}::EnumArgument::EnumArgument(const llvm::Record&, llvm::StringRef)’:
/home/myUserName/LLVM/sources/tools/clang/utils/TableGen/ClangAttrEmitter.cpp:740:42:
error: no matching function for call to
‘std::vector<std::__cxx11::basic_string<char> >::vector(std::vector<llvm::StringRef>)’
uniques(uniqueEnumsInOrder(enums))
^
Unfortunately I don't understand why there is a problem, since this function should be declared in
tools/clang/utils/TableGen/ClangAttrEmitter.cpp:722.
This is an excerpt of the corresponding code:
// Unique the enums, but maintain the original declaration ordering.
std::vector<std::string>
uniqueEnumsInOrder(const std::vector<std::string> &enums) {
std::vector<std::string> uniques;
SmallDenseSet<StringRef, 8> unique_set;
for (const auto &i : enums) {
if (unique_set.insert(i).second)
uniques.push_back(i);
}
return uniques;
}
class EnumArgument : public Argument {
std::string type;
std::vector<std::string> values, enums, uniques;
public:
EnumArgument(const Record &Arg, StringRef Attr)
: Argument(Arg, Attr), type(Arg.getValueAsString("Type")),
values(Arg.getValueAsListOfStrings("Values")),
enums(Arg.getValueAsListOfStrings("Enums")),
uniques(uniqueEnumsInOrder(enums))
{
// FIXME: Emit a proper error
assert(!uniques.empty());
}
I use gcc 7.2.0 and Ubuntu 16.04.3 LTS.
Update:
In the meantime I had the chance to build LLVM+Clang with gcc 5.4.0 and the build finished successfully. Does this mean that there is a compiler bug oder is it an issue respectively the gcc standard?