CMake error when trying to build
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 736
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 15
Description
Hi, I am trying to build torch mlir having followed your instructions at the following page https://github.com/llvm/torch-mlir/blob/main/docs/development.md.
When I try to run an example I receive a segmentation fault. When I try to reload the cmakeLists in Clion the following error appears
```
-- LLVM and MLIR packages have already been configured.
CMake 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]
```
I had another error before, the file about MLIRConfig.cmake not found but I solved it by adding this to the cmake
```
set(MLIR_DIR /Users/dvlpr/CLionProjects/torch-mlir/build/lib/cmake/mlir)
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with docs/development.md and externals/llvm-external-projects/torch-mlir-dialects/tools/torch-mlir-dialects-opt/CMakeLists.txt, then inspect the reported CMake configuration logs. Determine why the torch-mlir-dialects-opt target is already imported when the tool is added; done means the documented build and CLion reload complete without these configuration errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100