eos icon indicating copy to clipboard operation
eos copied to clipboard

Does not give version error if using LLVM 13

Open lackhole opened this issue 3 years ago • 6 comments

When using LLVM 12, configuring CMake gives me an error indicating the correct LLVM version(7 ~ 11) required. But when only LLVM 13(current latest) is installed, the error message is hard to diagnose.

CMake Warning at CMakeLists.txt:8 (message):
  CMAKE_INSTALL_PREFIX is set to /usr/local.  This is not recommended.


CMake Error at /usr/lib/llvm-13/lib/cmake/llvm/LLVMExports.cmake:1501 (message):
  The imported target "llvm-omp-device-info" references the file

     "/usr/lib/llvm-13/bin/llvm-omp-device-info"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/usr/lib/llvm-13/lib/cmake/llvm/LLVMExports.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /usr/lib/llvm-13/cmake/LLVMConfig.cmake:299 (include)
  CMakeLists.txt:76 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/yonggyulee/Documents/GitHub/eos/cmake-build-debug/CMakeFiles/CMakeOutput.log".

lackhole avatar Oct 16 '21 13:10 lackhole

This may be an llvm packaging or installation problem in your environment. On Ubuntu 21.10, which ships llvm 13 as its default llvm version, eosio does print the proper version error. Did you build llvm from source, or using a package; and from what distro?

spoonincode avatar Oct 18 '21 17:10 spoonincode

@spoonincode I was using WSL default(Ubuntu 20.04). I got it using apt-get.

lackhole avatar Oct 25 '21 16:10 lackhole

20.04? Did you apt-get install llvm-13-dev? The default llvm -- the one you'd get with apt-get install llvm-dev -- I believe is llvm 10 on Ubuntu 20.04.

spoonincode avatar Oct 26 '21 19:10 spoonincode

I apologize for hijacking, but it seems that I am facing the exact same issue while trying to compile openmp-13.0.0.src.tar.xz on my set-up, ad that @spoonincode knows how to debug this error.

Set-up:

clang -v
Debian clang version 13.0.1-++20211105082941+216200aff268-1~exp1~20211105203515.22
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8
Candidate multilib: .;@m64
Selected multilib: .;@m64
uname -a
Linux travail 4.19.0-18-amd64 #1 SMP Debian 4.19.208-1 (2021-09-29) x86_64 GNU/Linux

and the error I obtain after issuing

cmake -DCMAKE_C_COMPILER=clang

is

CMake Error at /usr/lib/llvm-13/lib/cmake/llvm/AddLLVM.cmake:877 (add_executable):
  add_executable cannot create target "llvm-omp-device-info" because an
  imported target with the same name already exists.
Call Stack (most recent call first):
  /usr/lib/llvm-13/lib/cmake/llvm/AddLLVM.cmake:1230 (add_llvm_executable)
  libomptarget/tools/deviceinfo/CMakeLists.txt:15 (add_llvm_tool)


CMake Error at /usr/lib/llvm-13/lib/cmake/llvm/LLVM-Config.cmake:92 (target_link_libraries):
  Cannot specify link libraries for target "llvm-omp-device-info" which is
  not built by this project.
Call Stack (most recent call first):
  /usr/lib/llvm-13/lib/cmake/llvm/AddLLVM.cmake:926 (llvm_config)
  /usr/lib/llvm-13/lib/cmake/llvm/AddLLVM.cmake:1230 (add_llvm_executable)
  libomptarget/tools/deviceinfo/CMakeLists.txt:15 (add_llvm_tool)

That error message is indeed hard to debug, should I understand that I must downgrade my version of llvm? Thanks!

aubertc avatar Nov 11 '21 16:11 aubertc

@aubertc a bit confused on the question -- is it about building eosio? It seems you're on Debian 10? There is no need to build LLVM on Debian 10 what is provided in the standard packages is new enough.

spoonincode avatar Nov 17 '21 20:11 spoonincode

Yes, my question is a bit unrelated and I apologize for that -- it is not about building eosio, but about building openmp for llvm, and the error message I receive is very similar to the one you copied, and you seemed to have an idea where this error message was coming from (is it "simply" because I am trying to use llvm 13 to compile something that can be compiled only with llvm 10?), so I was wondering if you could explain it to me.

And I am using a more modern version of llvm than the one shipped with debian for some external reasons.

aubertc avatar Nov 17 '21 20:11 aubertc