Sarcasm / irony-mode

A C/C++ minor mode for Emacs powered by libclang
GNU General Public License v3.0
901 stars 98 forks source link

The imported target "clangBasic" references the file libclangBasic.a but this file does not exist #588

Closed Wheest closed 7 months ago

Wheest commented 7 months ago

I've recently got back into working with C++, and was prompted to run M-x install-irony-server. I'm on Debian 11 bullseye. I was able to fix the issue, below is info for anyone searching the error messages.

I used the default compile flag, and got an error:

-*- mode: compilation; default-directory: "/tmp/build-irony-server-1.6.1/" -*-
Compilation started at Thu Nov 30 11:18:56

cmake -DCMAKE_INSTALL_PREFIX\=/home/user/.emacs.d/.local/cache/irony/  /home/pez/.emacs.d/.local/straight/build-29.1/irony/server && cmake --build . --use-stderr --config Release --target install
CMake Error at /usr/lib/llvm-11/lib/cmake/clang/ClangTargets.cmake:671 (message):
  The imported target "clangBasic" references the file

     "/usr/lib/llvm-11/lib/libclangBasic.a"

  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-11/lib/cmake/clang/ClangTargets.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /usr/lib/cmake/clang-11/ClangConfig.cmake:20 (include)
  src/CMakeLists.txt:4 (find_package)

-- Configuring incomplete, errors occurred!

Compilation exited abnormally with code 1 at Thu Nov 30 11:18:56

I could not find a similar issue here.

I think it could be caused by a missing or incomplete installation of Clang on my system, or because the particular version of LLVM/Clang installed does not include the static libraries. If I go to /usr/lib/llvm-11/lib/, there are lots of files there, but not libclangBasic.a

Clang is installed, but libclang-dev was not, which is a pre-requisite for this repo. Installing it and re-running M-x install-irony-server fixed the problem.