Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

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

Closed Quuxplusone closed 8 years ago

Quuxplusone commented 8 years ago
Bugzilla Link PR25565
Status RESOLVED FIXED
Importance P normal
Reported by octoploid (octoploid@yandex.com)
Reported on 2015-11-18 09:16:43 -0800
Last modified on 2015-11-19 14:59:31 -0800
Version trunk
Hardware PC Linux
CC ahatanak@gmail.com, geek4civic@gmail.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments attr-llvm1.patch (16317 bytes, text/plain)
attr-clang1.patch (527 bytes, text/plain)
Blocks
Blocked by
See also
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 -
D__STDC_CONSTANT_MACROS -D_
_STDC_FORMAT_MACROS -D__STDC_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.
Quuxplusone 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.

Quuxplusone commented 8 years ago

Attached attr-llvm1.patch (16317 bytes, text/plain): llvm patch to add dependencies to cmake files

Quuxplusone commented 8 years ago

Attached attr-clang1.patch (527 bytes, text/plain): clang patch to add dependencies to cmake files

Quuxplusone 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.

Quuxplusone 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.
Quuxplusone 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.