wusq10
January 30, 2023, 7:37am
1
when i compile on my project, i miss this question:
in function `mlir::(anonymous namespace)::GraphOptPass::runOnOperation()':
/home/wusq10/develop/XpengRT/xpengrt/backend/lib/Transform/XRTGraphOptPass.cpp:82: undefined reference to `mlir::FrozenRewritePatternSet::FrozenRewritePatternSet(mlir::RewritePatternSet&&, llvm::ArrayRef<std::string>, llvm::ArrayRef<std::string>)'
/usr/bin/ld: /home/wusq10/develop/XpengRT/xpengrt/backend/lib/Transform/XRTGraphOptPass.cpp:88: undefined reference to `mlir::FrozenRewritePatternSet::FrozenRewritePatternSet(mlir::RewritePatternSet&&, llvm::ArrayRef<std::string>, llvm::ArrayRef<std::string>)'
/usr/bin/ld: /home/wusq10/develop/XpengRT/xpengrt/backend/lib/Transform/XRTGraphOptPass.cpp:92: undefined reference to `mlir::FrozenRewritePatternSet::FrozenRewritePatternSet(mlir::RewritePatternSet&&, llvm::ArrayRef<std::string>, llvm::ArrayRef<std::string>)'
When you have an undefined reference to a symbol, it means your are linking a binary and missing the library that provides the symbol. In this case it is MLIRRewrite
.
wusq10
January 30, 2023, 8:19am
3
I have make the llvm-project and the folder of ./build/bin has the file(libMLIRRewrite.a)
i write in cmakelist.txt of my project
add_mlir_library(XRTransform
XRTComputePass.cc
XRTEnginePass.cpp
XRTDeployConfigPass.cc
XRTGraphOptPass.cpp
${INTERFACE_FILES}
DEPENDS
MLIRXRTPassIncGen
LINK_LIBS
MLIRRewrite
MLIRTransforms
XRTCom
XRTBuilder
EngineTaskLib
XRTGraphOpt
)
but it does not work.
and i also have the error for example:
/home/wusq10/develop/XpengRT/third_party/llvm-project/llvm/include/llvm/ADT/SmallVector.h:221: undefined reference to `vtable for llvm::cl::OptionValue<std::string>'
/usr/bin/ld: CMakeFiles/xp-mlir.dir/xp-mlir.cc.o: in function `llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >::opt<char [2], llvm::cl::desc, llvm::cl::value_desc, llvm::cl::cat, llvm::cl::ValueExpected>(char const (&) [2], llvm::cl::desc const&, llvm::cl::value_desc const&, llvm::cl::cat const&, llvm::cl::ValueExpected const&)':