Repository navigation
Closed
Description
With #160, #161, #164 and #165 merged into the current master (HEAD at b745c14), I am close to build iree-tblgen. In addition to the already proposed changes the following modifications are further required:
CMakeLists.txt
add_subdirectory(build_tools/embed_data/)build_tools/cmake/iree_copts.cmake
set(IREE_TABLEGEN_EXE iree-tblgen)iree/tools/CMakeLists.txt
iree_cc_binary(
NAME
iree-tblgen
OUT
iree-tblgen
SRCS
"${IREE_ROOT_DIR}/third_party/mlir/tools/mlir-tblgen/mlir-tblgen.cpp"
DEPS
iree::compiler::Dialect::VM::Tools
LLVMMLIRTableGen
MLIRSupport
LLVMTableGen
LLVMMC
LLVMDebugInfoCodeView
LLVMBinaryFormat
LLVMDebugInfoMSF
LLVMSupport
LLVMDemangle
LINKOPTS
"-lpthread"
)
add_executable(iree-tblgen ALIAS iree_tools_iree-tblgen)Now setting IREE_BUILD_COMPILER to ON and IREE_BUILD_SAMPLES to OFF, the build fails within the linkage stage for iree-tblgen with the following error:
[ 86%] Linking CXX executable iree-tblgen
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: CMakeFiles/iree_tools_iree-tblgen.dir/__/__/third_party/mlir/tools/mlir-tblgen/mlir-tblgen.cpp.o:(.rodata._ZTIN4llvm2cl6parserIPKN4mlir7GenInfoEEE[_ZTIN4llvm2cl6parserIPKN4mlir7GenInfoEEE]+0x10): undefined reference to `typeinfo for llvm::cl::generic_parser_base'
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: CMakeFiles/iree_tools_iree-tblgen.dir/__/__/third_party/mlir/tools/mlir-tblgen/mlir-tblgen.cpp.o:(.rodata._ZTIN4llvm2cl3optIPKN4mlir7GenInfoELb0ENS2_13GenNameParserEEE[_ZTIN4llvm2cl3optIPKN4mlir7GenInfoELb0ENS2_13GenNameParserEEE]+0x18): undefined reference to `typeinfo for llvm::cl::Option'
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: CMakeFiles/iree_tools_iree-tblgen.dir/__/__/third_party/mlir/tools/mlir-tblgen/mlir-tblgen.cpp.o:(.rodata._ZTIN4llvm2cl15OptionValueCopyIPKN4mlir7GenInfoEEE[_ZTIN4llvm2cl15OptionValueCopyIPKN4mlir7GenInfoEEE]+0x10): undefined reference to `typeinfo for llvm::cl::GenericOptionValue'
clang-8: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [iree/tools/CMakeFiles/iree_tools_iree-tblgen.dir/build.make:94: iree/tools/iree-tblgen] Error 1
make[1]: *** [CMakeFiles/Makefile2:40659: iree/tools/CMakeFiles/iree_tools_iree-tblgen.dir/all] Error 2
make: *** [Makefile:152: all] Error 2
I greped (hopefully all) dependencies from the Bazel intermediate file execroot/iree_core/bazel-out/host/bin/iree/tools/iree-tblgen-2.params, but something is different or I simply missed a dep. Maybe somebody else sees my mistake and can help out.
Metadata
Metadata
Assignees
Labels
No labels
Activity
stellaraccident commentedon Dec 11, 2019
I'm not at a real computer to verify, but those symbols should be coming in from LLVMSupport but it is suspicious that you are just missing the typeinfo: if you were actually missing the dep, there should be more complaints.
Afaik, there are few primary ways to trigger undefined symbols for missing typeinfo:
Without looking further, I would discount #2, and generally assume that this part of LLVM has enough mileage on it to not be problematic. Before going further, I would definitely do a quick check of the various rtti related flags in command lines. Or just hardcode a CPPFLAGS of -frtti and see if that clears it up (for triaging).
#3 seems unlikely given what I can see.
stellaraccident commentedon Dec 11, 2019
Also, is this a debug or an opt build? I have seen this kind of error on debug builds due either to extra asserts requiring RTTI or code not getting optimized out.
marbre commentedon Dec 12, 2019
Thank you for the detailed response. I really appreciate this. The hint to get a look at rtti, of which I was not aware, allowed me to fix the issue and enabled the build of iree-tblgen. By default LLVM is indeed build with
-fno-rtti.Update nightly dependencies (#182)