Sarcasm / flycheck-irony

C, C++ and Objective-C support for Flycheck, using Irony Mode
56 stars 10 forks source link

flycheck error: (invalid-function (cb callback)) #7

Closed krgn closed 9 years ago

krgn commented 9 years ago

Hi,

I'm seeing this error after installing flycheck-irony:

Error while checking syntax automatically: (invalid-function (cb callback))

I followed the installation instructions and company-irony is working. What could be the issue?

Cheers,

k

Sarcasm commented 9 years ago

What is your emacs version?

How did you install irony?

krgn commented 9 years ago

Emacs 24.4 (Arch Linux) + Cask

Sarcasm commented 9 years ago

Does it happens with the most basic configuration of flycheck irony?

Can you print the arguments of irony-diagnostics--request-handler?

(defun irony-diagnostics--request-handler (diagnostics callback)
  (message "diagnostics: %s, callback: %s" diagnostics callback)
  (cond
   ((irony--buffer-parsed-p)
    (funcall callback 'success diagnostics))
   (t
    ;; buffer has become out-of-date
    (funcall callback 'cancelled "diagnostics obselete, buffer has changed"))))
Sarcasm commented 9 years ago

I don't think it's the same problem but someone else has an invalid-function error with flycheck, it was due to some configuration issue, see https://github.com/flycheck/flycheck/issues/594#issuecomment-86688488

Can you make sure that you have this issue with a minimal configuration of flycheck-irony?

ghost commented 9 years ago

Hi, I'm receiving the same error. I took my flycheck and irony configs out of use-package but the issue remains.

I added the message statement and captured the output. Diagnostics looked fine (it was a list of errors from clang) but the callback arg was binary data and I can't copy/paste. Please let me know what I can do to assist with this issue.

Here's a much as I could get from callback:

 callback: #[385 \303=\203 [irony #[128 \301\302\300#\207 [[cl-struct-flycheck-syntax-check main.c irony nil] apply flycheck-report-buffer-checker-status] 5 
Sarcasm commented 9 years ago

I'm not excluding an error in irony-mode but that would be helpful if you show the configuration file you are using, configuring only flycheck-irony and its dependencies.

 emacs -Q
 #installing the required packages via melpa
 #basic configuration
 #does it still happen?

Either I do not understand how to use lexical-let or there is some kind of configuration issue with flycheck, or maybe it's something else but to be honest I have not many clues right now.

ghost commented 9 years ago
(require 'package)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.milkbox.net/packages/"))
(package-initialize)

(require 'flycheck)
(global-flycheck-mode)

(require 'irony)
(defun my-irony-mode-hook ()
  (define-key irony-mode-map [remap completion-at-point]
    'irony-completion-at-point-async)
  (define-key irony-mode-map [remap complete-symbol]
    'irony-completion-at-point-async))
(add-hook 'c-mode-common-hook 'irony-mode)
(add-hook 'irony-mode-hook 'my-irony-mode-hook)
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)

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

The error:

Error while checking syntax automatically: (void-function lexical-let)

Err... that error is because I didn't require cl. After requiring cl I get the original error (invalid-function (cb callback))

krgn commented 9 years ago

Sorry for the late feedback. Basically, stripping my env down with emacs -Q then adding bits as demoed by @aport causes the same problem to occur. I'm using ArchLinux version of Emacs, which is at 24.4.1.

krgn commented 9 years ago

Here is a list of specific version of dependencies that got installed. Might be of help?

dash: 20150311.2355
epl: 201503262.1212
flycheck: 20150330.925 
flycheck-irony: 20150308.1230
irony: 20150329.1347
let-alist: 1.0.3
pkg-info: 20140610.630
Sarcasm commented 9 years ago

Okay, I get the issue now, it's due to lexical-let apparently. I guess now is a good time to drop Emacs 23 support.

ghost commented 9 years ago

A small update. If I delete irony-diagnostics.elc then the irony checker works. Let me know if I can provide any additional information. By the way, thank you for these packages! This works a lot better than using the clang checker directly.

Sarcasm commented 9 years ago

Okay, sorry for the delay, I understand a few things better now and it should be fixed without sacrifying Emacs 23 compatibility.

Updating irony-mode should fix your issue,

Thanks for reporting.

Sarcasm commented 9 years ago

If I delete irony-diagnostics.elc then the irony checker works

Yeah that's normal, cl is often loaded by some modules at some point so lexical-let is available at some point but that is just some luck, you cannot really rely on this.