ld.lld: error: undefined symbol: mlirModuleGetOperation
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
I am building with x86_64-windows-gnu target with -DBUILD_SHARED_LIBS=On and -flto=thin. I get mlirModuleGetOperation. What's going on here?
Thanks :)
```
FAILED: [code=1] bin/libMLIRCAPIExportSMTLIB.dll lib/libMLIRCAPIExportSMTLIB.dll.a
: && /home/iflsrdas/toolchains/llvm/x86_64-linux-gnu/llvm/bin/clang++ --target=x86_64-windows-gnu --sysroot=/home/iflsrdas/toolchains/llvm/x86_64-windows-gnu/x86_64-windows-gnu -fuse-ld=lld -fuse-lipo=llvm-lipo -flto=thin -Wno-unused-command-line-argument -rtlib=compiler-rt -stdlib=libc++ --unwindlib=libunwind -lc++abi -lc++abi -stdlib=libc++ -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported -ffunction-sections -fdata-sections -Xclang -fno-pch-timestamp -flto=thin -Wundef -Werror=mismatched-tags -O3 -DNDEBUG -shared -stdlib=libc++ -fuse-ld=lld -flto=thin -Wl,--thinlto-cache-dir=/home/iflsrdas/toolchains_build/toolchainbuildscripts/llvm/.artifacts/llvm/x86_64-windows-gnu/llvm/lto.cache -Wl,--gc-sections -fuse-ld=lld -o bin/libMLIRCAPIExportSMTLIB.dll -Wl,--out-implib,lib/libMLIRCAPIExportSMTLIB.dll.a -Wl,--major-image-version,0,--minor-image-version,0 tools/mlir/lib/CAPI/Target/CMakeFiles/obj.MLIRCAPIExportSMTLIB.dir/ExportSMTLIB.cpp.obj lib/libMLIRCAPIIR.dll.a lib/libMLIRExportSMTLIB.dll.a lib/libLLVMSupport.dll.a lib/libMLIRBytecodeWriter.dll.a lib/libMLIRBytecodeOpInterface.dll.a lib/libMLIRPass.dll.a lib/libMLIRAnalysis.dll.a lib/libMLIRDataLayoutInterfaces.dll.a lib/libMLIRDialectUtils.dll.a lib/libMLIRInferStridedMetadataInterface.dll.a lib/libMLIRLoopLikeInterface.dll.a lib/libMLIRPresburger.dll.a lib/libMLIRViewLikeInterface.dll.a lib/libMLIRArithDialect.dll.a lib/libMLIRCastInterfaces.dll.a lib/libMLIRDialect.dll.a lib/libMLIRInferIntDivisibilityOpInterface.dll.a lib/libMLIRInferIntRangeCommon.dll.a lib/libMLIRShapedOpInterfaces.dll.a lib/libMLIRInferIntRangeInterface.dll.a lib/libMLIRUBDialect.dll.a lib/libMLIRFuncDialect.dll.a lib/libMLIRFunctionInterfaces.dll.a lib/libMLIRCallInterfaces.dll.a lib/libMLIRSMT.dll.a lib/libMLIRInferTypeOpInterface.dll.a lib/libMLIRControlFlowInterfaces.dll.a lib/libMLIRSideEffectInterfaces.dll.a lib/libMLIRTranslateLib.dll.a lib/libMLIRParser.dll.a lib/libMLIRBytecodeReader.dll.a lib/libMLIRAsmParser.dll.a lib/libMLIRIR.dll.a lib/libMLIRSupport.dll.a lib/libLLVMCore.dll.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && :
ld.lld: error: undefined symbol: mlirModuleGetOperation
>>> referenced by /home/iflsrdas/toolchains_build/llvm-project/mlir/lib/CAPI/Target/ExportSMTLIB.cpp
>>> tools/mlir/lib/CAPI/Target/CMakeFiles/obj.MLIRCAPIExportSMTLIB.dir/ExportSMTLIB.cpp.obj
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[2/150] Linking CXX executable bin/cir-lsp-server.exe
ninja: build stopped: subcommand failed
```
Contributor guide
Research direction
Start by reproducing the x86_64-windows-gnu shared build with ThinLTO from the reported command, then inspect mlir/lib/CAPI/Target/ExportSMTLIB.cpp and the linked MLIR import libraries for mlirModuleGetOperation. Done means identifying the missing linkage or export and completing the failing DLL link successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 42/100