I am following the code from here for implementing a simple pass, but get the following dump when I run mlir-opt --load-pass-plugin <PATH TO libpass.so>
Failed to load passes from '/home/USER/TEST/build/libpass.so'. Request ignored.
Expected<T> must be checked before access or destruction.
Unchecked Expected<T> contained error:
Could not load library '/home/USER/TEST/build/libpass.so': /home/USER/TEST/build/libpass.so: undefined symbol: _ZTIN4mlir4PassEPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: mlir-opt --load-pass-plugin /home/USER/TEST/build/libpass.so
#0 0x000055d92a9bc518 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/local/bin/mlir-opt+0x1159518)
#1 0x000055d92a9ba02e llvm::sys::RunSignalHandlers() (/usr/local/bin/mlir-opt+0x115702e)
#2 0x000055d92a9bced8 SignalHandler(int) Signals.cpp:0:0
#3 0x00007f2468de0520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007f2468e349fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#5 0x00007f2468e349fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10
#6 0x00007f2468e349fc pthread_kill ./nptl/pthread_kill.c:89:10
#7 0x00007f2468de0476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
#8 0x00007f2468dc67f3 abort ./stdlib/abort.c:81:7
#9 0x000055d92d222c1a llvm::Expected<mlir::PassPlugin>::fatalUncheckedExpected() const (/usr/local/bin/mlir-opt+0x39bfc1a)
#10 0x000055d92d222b1c (/usr/local/bin/mlir-opt+0x39bfb1c)
#11 0x000055d92ac48073 llvm::cl::list<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool, llvm::cl::parser<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>::handleOccurrence(unsigned int, llvm::StringRef, llvm::StringRef) (/usr/local/bin/mlir-opt+0x13e5073)
#12 0x000055d92a9c1cc7 ProvideOption(llvm::cl::Option*, llvm::StringRef, llvm::StringRef, int, char const* const*, int&) CommandLine.cpp:0:0
#13 0x000055d92a9c657b llvm::cl::ParseCommandLineOptions(int, char const* const*, llvm::StringRef, llvm::raw_ostream*, char const*, bool) (/usr/local/bin/mlir-opt+0x116357b)
#14 0x000055d92d21f4f2 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/usr/local/bin/mlir-opt+0x39bc4f2)
#15 0x000055d92a99d7bd main (/usr/local/bin/mlir-opt+0x113a7bd)
#16 0x00007f2468dc7d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#17 0x00007f2468dc7e40 call_init ./csu/../csu/libc-start.c:128:20
#18 0x00007f2468dc7e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#19 0x000055d92a99d395 _start (/usr/local/bin/mlir-opt+0x113a395)
Aborted
Why is the symbol _ZTIN4mlir4PassE
undefined in my shared library?