Skip to content

Failed to build with LLVM 17 #8

@rhanqtl

Description

@rhanqtl

I'm compiling the Cpu0 code with LLVM 17, and get below error message:

FAILED: lib/Target/Cpu0/MCTargetDesc/CMakeFiles/LLVMCpu0Desc.dir/Cpu0MCTargetDesc.cpp.o 
/usr/sbin/clang++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D_LIBCPP_ENABLE_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/root/projects/llvm-project/llvm/build/lib/Target/Cpu0/MCTargetDesc -I/root/projects/llvm-project/llvm/lib/Target/Cpu0/MCTargetDesc -I/root/projects/llvm-project/llvm/lib/Target/Cpu0 -I/root/projects/llvm-project/llvm/build/lib/Target/Cpu0 -I/root/projects/llvm-project/llvm/build/include -I/root/projects/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g -fvisibility=hidden  -fno-exceptions -funwind-tables -fno-rtti -std=c++17 -MD -MT lib/Target/Cpu0/MCTargetDesc/CMakeFiles/LLVMCpu0Desc.dir/Cpu0MCTargetDesc.cpp.o -MF lib/Target/Cpu0/MCTargetDesc/CMakeFiles/LLVMCpu0Desc.dir/Cpu0MCTargetDesc.cpp.o.d -o lib/Target/Cpu0/MCTargetDesc/CMakeFiles/LLVMCpu0Desc.dir/Cpu0MCTargetDesc.cpp.o -c /root/projects/llvm-project/llvm/lib/Target/Cpu0/MCTargetDesc/Cpu0MCTargetDesc.cpp
In file included from /root/projects/llvm-project/llvm/lib/Target/Cpu0/MCTargetDesc/Cpu0MCTargetDesc.cpp:34:
/root/projects/llvm-project/llvm/build/lib/Target/Cpu0/Cpu0GenSubtargetInfo.inc:74:57: warning: zero size arrays are an extension [-Wzero-length-array]
extern const llvm::SubtargetSubTypeKV Cpu0SubTypeKV[] = {
                                                        ^
/root/projects/llvm-project/llvm/build/lib/Target/Cpu0/Cpu0GenSubtargetInfo.inc:105:73: error: use of undeclared identifier 'None'
  return new Cpu0GenMCSubtargetInfo(TT, CPU, TuneCPU, FS, std::nullopt, None, 
                                                                        ^
1 warning and 1 error generated.

I've tried to solve it by myself, but as a newbie, it's really hard.

What should I do to fix the "use of undeclared identifier" issue? Seems there is something missing.

Configuration and compilation commands (the working directory is llvm-project/llvm):

$ cmake -S . -B build -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug
$ cmake --build build --target all

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions