irony-mode icon indicating copy to clipboard operation
irony-mode copied to clipboard

"couldn't find irony.el's version header!"

Open madjestic opened this issue 1 year ago • 5 comments

Hey guys,

I am trying to compile irony server in emacs and I am getting this error:

> cmake -DCMAKE_INSTALL_PREFIX\=/home/madjestic/.emacs.d/irony/  /home/madjestic/.emacs.d/elpa/irony-20231018.1915/server && cmake --build . --use-stderr --config Release --target install

...
-- Found zstd: /usr/lib64/libzstd.so
-- Found LibXml2: /usr/lib64/libxml2.so (found version "2.12.7")
CMake Error at src/CMakeLists.txt:84 (message):
  couldn't find irony.el's version header!
Call Stack (most recent call first):
  src/CMakeLists.txt:92 (irony_find_package_version)


-- Configuring incomplete, errors occurred!

Compilation exited abnormally with code 1 at Thu Oct 17 12:47:32

I've tried ripgrepping irony_find_package_version, but it does not seem to be a keyword in sources, or maybe I am doing it wrong. How can I fix/debug this?

Additional system info: I am running GNU Emacs 29.4, irony-20231018.1915, glibc 2.39-r6, clang 18.1.8 Gentoo linux, kernel 6.11.3

Thanks, Vlad

madjestic avatar Oct 17 '24 19:10 madjestic

src/CMakeLists.txt:92 (irony_find_package_version) No need for ripgrep, the error mention the location, did you checked this CMakeLists.txt? The code parses irony.el header, I wonder what in your setup makes this fail.

Sarcasm avatar Oct 20 '24 10:10 Sarcasm

Hi @Sarcasm I am on Window 11 and using Emacs 29.4 and I am getting the same error:

CMake Warning at src/CMakeLists.txt:4 (find_package):
  By not providing "FindClang.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Clang", but
  CMake did not find one.

  Could not find a package configuration file provided by "Clang" with any of
  the following names:

    ClangConfig.cmake
    clang-config.cmake

  Add the installation prefix of "Clang" to CMAKE_PREFIX_PATH or set
  "Clang_DIR" to a directory containing one of the above files.  If "Clang"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Detecting Clang resource directory
-- Detecting libclang builtin headers directory -- success
CMake Error at src/CMakeLists.txt:84 (message):
  couldn't find irony.el's version header!
Call Stack (most recent call first):
  src/CMakeLists.txt:92 (irony_find_package_version)


-- Configuring incomplete, errors occurred!

The command used to install the irony-server was the one showed up automatically after I typed M-x: irony-install-server was

 Install command: "cmake" "-DCMAKE_INSTALL_PREFIX=c:/Users/my_username/AppData/Roaming/.emacs.d/irony/" "c:/Users/my_username/AppData/Roaming/.emacs.d/elpa/irony-20231018.1915/server" && "cmake" --build . --use-stderr --config Release --target install

Also, when I type:

M-x eval-expression RET (executable-find "irony-server") RET, it returns "nil"

When also type:

M-x eval-expression RET irony-server-install-prefix RET, it points to "~/.emacs.d/irony/", but when I go to that path there is no folder named "irony" inside ~/.emacs.d/,

I have clang 19.1.2 isntalled and set in the PATH as well.

Any ideas?

I have this included in the init.el if relevant:

(use-package company
  :ensure t
  :config
  (setq company-idle-delay 0)
  (setq company-minimum-prefix-length 3))

(use-package company-irony
  :ensure t
  :config
  :after (company)
  (add-to-list 'company-backends 'company-irony))

(use-package irony
  :ensure t
  :config
  (add-hook 'c++-mode-hook 'irony-mode)
  (add-hook 'c-mode-hook 'irony-mode)
  (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options))

(use-package irony-eldoc
  :ensure t
  :config
  (add-hook 'irony-mode-hoook #'irony-eldoc)
  )

(with-eval-after-load 'company
  (add-hook 'c++-mode-hook 'company-mode)
  (add-hook 'c-mode-hook 'company-mode))

(use-package flycheck
  :ensure t
  :init
  (global-flycheck-mode t)
  )

(eval-after-load 'flycheck
  '(add-to-list 'flycheck-mode-hook #'flycheck-irony-setup))

pk6x avatar Nov 01 '24 22:11 pk6x

Hey folks,

I am running into the same issue on Arch 6.11.6:

-*- mode: compilation; default-directory: "/tmp/build-irony-server-nil/" -*-

cmake -DCMAKE_INSTALL_PREFIX\=/home/myuser/.emacs.d/irony/  /home/myuser/.emacs.d/elpa/irony-20231018.1915/server && cmake --build . --use-stderr --config Release --target install
CMake Error at src/CMakeLists.txt:84 (message):
  couldn't find irony.el's version header!
Call Stack (most recent call first):
  src/CMakeLists.txt:92 (irony_find_package_version)


-- Configuring incomplete, errors occurred!

Emacs 29.4, CMake 3.31 Installed irony via melpa. Using all default settings via customize-group RET irony RET. /tmp dir has nil in its name where the version should be. M-x irony-version RET from irony.el also returns nil.

Please share if you found a fix, thank you!

nkdpmpkn avatar Nov 09 '24 23:11 nkdpmpkn

I debugged it a bit, it appears that melpa rewrite the irony version header from:

;; Version: 1.6.1

To:

;; Package-Version: 20231018.1915
;; Package-Revision: 40e0ce19eb85

This breaks lm-version called by irony-version here:

https://github.com/Sarcasm/irony-mode/blob/master/irony.el#L445

Not sure what is a proper fix yet.

Sarcasm avatar Nov 10 '24 12:11 Sarcasm

The work around for now is obviously to just insert ;; Version: 1.6.1 into irony.el.

3246251196 avatar Nov 10 '24 13:11 3246251196