llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.48k stars 11.77k forks source link

fatal error: llvm/IR/Attributes.inc: No such file or directory #25939

Closed llvmbot closed 8 years ago

llvmbot commented 8 years ago
Bugzilla Link 25565
Resolution FIXED
Resolved on Nov 19, 2015 14:59
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @ahatanak

Extended Description

markus@x4 llvm_build % cmake -G Ninja -DCMAKE_BUILD_TYPE=release -DLLVM_ENABLE_ASSERTIONS=on -DLLVM_TARGETS_TO_BUILD="X86" -DCMAKE_CXX_FLAGS_RELEASE:STRING="-O3 -fno-strict-aliasing -march=native -DNDEBUG -pipe" -DCMAKE_EXE_LINKER_FLAGS="-Wl,-O1,--hash-style=gnu,--gc-sections,--icf=safe" -DLLVM_BINUTILS_INCDIR=/usr/lib/binutils/x86_64-pc-linux-gnu/git/include -DENABLE_PIC=1 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ ~/llvm

markus@x4 llvm_build % ninja .... [1187/3124] Building CXX object tools/clang/lib/Frontend/CMakeFiles/clangFrontend.dir/CompilerInvocation.cpp.o FAILED: /usr/bin/g++ -DCLANG_ENABLE_ARCMT -DCLANG_ENABLE_OBJC_REWRITER -DCLANG_ENABLE_STATIC_ANALYZER -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -DSTDC_CONSTANTMACROS -D _STDC_FORMAT_MACROS -DSTDC_LIMIT_MACROS -Itools/clang/lib/Frontend -I/home/markus/llvm/tools/clang/lib/Frontend -I/home/markus/llvm/tools/clang/include -Itools/clang/includ e -Iinclude -I/home/markus/llvm/include -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wnon-virtual-dtor -Wno-comment -std=c++11 -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -fno-strict-aliasing -march=native -pipe -UNDEBUG -fno-exceptions -fno-rtti -MMD -MT tools/clang/lib/Frontend/CMakeFiles/clangFrontend.dir/CompilerInvocation.cpp.o -MF tools/clang/lib/Frontend/CMakeFiles/clangFrontend.dir/CompilerInvocation.cpp.o.d -o tools/clang/lib/Frontend/CMakeFiles/clangFrontend.dir/CompilerInvocation.cpp.o -c /home/m arkus/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp In file included from /home/markus/llvm/include/llvm/IR/Argument.h:19:0, from /home/markus/llvm/include/llvm/IR/Function.h:23, from /home/markus/llvm/include/llvm/IR/Module.h:21, from /home/markus/llvm/include/llvm/IR/DiagnosticInfo.h:21, from /home/markus/llvm/include/llvm/Linker/Linker.h:16, from /home/markus/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp:30: /home/markus/llvm/include/llvm/IR/Attributes.h:68:38: fatal error: llvm/IR/Attributes.inc: No such file or directory compilation terminated.

ahatanak commented 8 years ago

Thank you Nakamura-san.

In order to avoid adding Attributes.inc to the dependents of instrinsics_gen, can we clear variable TABLEGEN_OUTPUT after add_public_tablegen_target(attributes_inc)? Alternatively, I think we can add another parameter to function tablegen that indicates whether or not TABLEGEN_OUTPUT should be cleared.

llvmbot commented 8 years ago

Fixed in r253554.

It was really missing dependencies. You can reproduce with;

ninja -t clean ninja clangFrontend

Hatanaka san, FYI,

Trunk of cmakefiles is adding Attributes.inc to intrinsics_gen regardless of add_public_tablegen_target(attributes_inc).

I think we may separate attributes_inc from intrinsics_gen, if we could separate definitions of llvm::Attribute::AttrKind from Attributes.h.

ahatanak commented 8 years ago

The attached patches add dependencies to the cmake files. clang or other parts of llvm that depend on Attributes.h should be built after llvm/IR/Attributes.inc is built.

ahatanak commented 8 years ago

clang patch to add dependencies to cmake files

ahatanak commented 8 years ago

llvm patch to add dependencies to cmake files

ahatanak commented 8 years ago

I believe the build error is caused by the lack of dependencies in the cmake files. I'll work on a patch today.