Closed cbourjau closed 7 years ago
Can you please run M-x flycheck-verify-setup
and post the output when you have this buffer open?
Oh, that looks promising:
Syntax checkers for buffer AliAnalysisTaskC2.cxx in c++-mode:
irony
- may enable: yes
- predicate: t
- Irony Mode: enabled
- irony-server: Found at /home/hehi/cbourjau/.emacs.d/irony/bin/irony-server
c/c++-clang
- may enable: Automatically disabled!
- executable: Not found
c/c++-gcc
- may enable: yes
- executable: Found at /usr/bin/gcc
c/c++-cppcheck
- may enable: Automatically disabled!
- executable: Not found
clang-analyzer (disabled)
- may enable: yes
- predicate: t
- executable: Found at /usr/bin/clang-3.8
- Backend: irony
Flycheck Mode is enabled. Use C-u C-c ! x to enable disabled
checkers.
--------------------
Flycheck version: 31snapshot (package: 20170601.608)
Emacs version: 26.0.50.2
System: x86_64-pc-linux-gnu
Window system: x
Any ideas how I would get the clang part to be enabled? And many thanks fro the fastest reply in githubs history :D
I have not seen (disabled) in flycheck before... I see that the docs (http://www.flycheck.org/en/latest/user/syntax-checkers.html#select-syntax-checkers-automatically) say you can manually enable a disabled checker by doing C-u C-c ! x
- can you try this?
Important Under some circumstances—for instance if the syntax checker is not installed— Flycheck automatically disables syntax checkers in the current buffer and will thus not even consider them in any future checks in the current buffer.
In the verification buffer these syntax checkers are marked as “disabled” just as if you had disabled them manually with C-c ! x
, and likewise you can re-enable automatically disabled syntax checkers with C-u C-c ! x
.
Also can you post your setup / config for flycheck-clang-analyzer
and flycheck
?
Ok, this is strange: The flycheck status is still identical to the one above and trying to enable any of the checkers with C-u C-c ! x
, as you suggested just yields "No syntax checkers disable in this buffer".
HOWEVER: After a lot of opening and closing of the buffers it started to work! I think the culprit is with flycheck-clang-analyzer-executable
. After setting this to clang-3.8
(only clang
is not a valid alias on Ubuntu, by the looks of it) and closing and re-opening the same file it started to work! Maybe this could be mentioned in the README, or an error could be printed to the message buffer if the executable is not found?
Flycheck is meant to look for the executable at loading of the checker - and if it is not present then it disables the checker. Can you share your configuration for flycheck-clang-analyzer
?
I use the following via use-package
to set it to use clang-4.0
instead of just clang
:
(use-package flycheck-clang-analyzer
:load-path "/path/to/flycheck-clang-analyzer"
:commands flycheck-clang-analyzer-setup
:after flycheck-irony
:config (progn
(setq flycheck-clang-analyzer-executable "clang-4.0")
;; automatically sets itself up as next checker after irony
(flycheck-clang-analyzer-setup)))
Or if you don't use use-package
perhaps you could just do:
(require 'flycheck-clang-analyzer)
(setq flycheck-clang-analyzer-executable "clang-3.8")
(flycheck-clang-analyzer-setup)
Also I am planning on submitting this to MELPA to make installation easier - any feedback you have would be great to get it as good as it can be for the initial release.
My setup looks (now) very similar to yours. I might just copy yours actually, since it looks cleaner, but here it goes:
(use-package flycheck-clang-analyzer
:load-path "~/repos/flycheck-clang-analyzer/"
:after flycheck
:config (flycheck-clang-analyzer-setup)
(setq flycheck-clang-analyzer-executable "clang-3.8"))
So its just the setting from the readme plus the executable setting.
Having this package available via MELPA would be great! I think configuration cannot get much easier that what it is now, except maybe a mentioning of the executable setting ;) All in all, this already seems to be a very solid project! Thanks for all your hard work! Let me know if I can assist with any more information!
Great - thanks for the feedback - time to submit to @melpa :)
Clarified README.md in bd90049f3cc4b3c65342f682b02f21ea1650632b
Hello,
Everything works as expected in a minimal example of
But when I try it on an actual project, it is not working. I am using irony and rtags on the same codebase and a
.clang_completion
and acompile_commands.json
file is at the root of the source tree.If I navigate to a
.cxx
of this project and runflycheck-compile
withclang-analyzer
I merely get "Cannot use syntax checker clang-analyzer in this buffer" in the message-buffer. I know this is very sparse information, but am unsure about how to debug this problem further. Any hints would be greatly appreciated!