Hi, I am writing here because I have cloned the torch-mlir GitHub project as explained on the repository (torch-mlir/development.md at main · llvm/torch-mlir · GitHub).
The problem appears when I try to load make project. The first error that was shown is the following:
CMake Error at CMakeLists.txt:91 (find_package):
Could not find a package configuration file provided by "MLIR" with any of
the following names:
MLIRConfig.cmake
mlir-config.cmake
Add the installation prefix of "MLIR" to CMAKE_PREFIX_PATH or set
"MLIR_DIR" to a directory containing one of the above files. If "MLIR"
provides a separate development package or SDK, be sure it has been
installed.
I have found a solution on the forum which told that I need to set MLIR_DIR to the directory containing the MLIRConfig.cmake. So I added the following line to my CmakeLists
set(MLIR_DIR /Users/dvlpr/CLionProjects/torch-mlir/build/lib/cmake/mlir)
But now the following two errors appear:
Make Error at build/cmake_build/lib/cmake/llvm/AddLLVM.cmake:965 (add_executable):
add_executable cannot create target "torch-mlir-dialects-opt" because an
imported target with the same name already exists.
Call Stack (most recent call first):
build/cmake_build/lib/cmake/llvm/AddLLVM.cmake:1338 (add_llvm_executable)
build/cmake_build/lib/cmake/llvm/AddLLVM.cmake:1363 (llvm_add_tool)
externals/llvm-external-projects/torch-mlir-dialects/tools/torch-mlir-dialects-opt/CMakeLists.txt:16 (add_llvm_tool)
CMake Error at build/cmake_build/lib/cmake/llvm/LLVM-Config.cmake:107 (target_link_libraries):
Cannot specify link libraries for target "torch-mlir-dialects-opt" which is
not built by this project.
Call Stack (most recent call first):
build/cmake_build/lib/cmake/llvm/LLVM-Config.cmake:95 (explicit_llvm_config)
build/cmake_build/lib/cmake/llvm/AddLLVM.cmake:1014 (llvm_config)
build/cmake_build/lib/cmake/llvm/AddLLVM.cmake:1338 (add_llvm_executable)
build/cmake_build/lib/cmake/llvm/AddLLVM.cmake:1363 (llvm_add_tool)
externals/llvm-external-projects/torch-mlir-dialects/tools/torch-mlir-dialects-opt/CMakeLists.txt:16 (add_llvm_tool)
-- Configuring incomplete, errors occurred!
See also "/Users/dvlpr/CLionProjects/torch-mlir/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "/Users/dvlpr/CLionProjects/torch-mlir/cmake-build-debug/CMakeFiles/CMakeError.log".
[Failed to reload]
In fact if I try to run an example file of torch_mlir (for instance resnet18) I receive a segmentation fault.
Thank you in advance for your help!