[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs + bear + compile_commands.json + clangd
From: |
Gerd Möllmann |
Subject: |
Re: Emacs + bear + compile_commands.json + clangd |
Date: |
Tue, 11 Oct 2022 07:39:47 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (darwin) |
Matt Armstrong <matt@rfc20.org> writes:
> Hey João, I had issues with Emacs source and clangd, especially with
> header files. The issue is that many of Emacs' C header files are not
> "self contained" so they can't be compiled alone. Also, `bear` will
> only generate compile commands for .c files, and clangd uses
> heuristics to guess a compile command for nearby .h files. It does a
> reasonable job in some projects, but not Emacs due to the "self
> contained" issue. Biggest issue: when editing an .h file clangd won't
> include <config.h> for you.
I'm wondering how you use clangd. Is this lsp-mode or eglot? I'm using
lsp-mode ATM, just because I tried it first, and it worked for me.
> I now do this:
>
> ./configure <whatever>
> bear --force-wrapper -- make -j$CPUS
> emacs-fixup-compile-commands.py
>
> where emacs-fixup-compile-commands.py is attached. Bonus to anyone
> rewrites it in elisp. ;-)
I've never had to use --force-wrapper or alter compile_commands.json.
My current version is bear 3.0.20, on macOS 12.6. What's your system?
P.S.
WRT to seamless, I have to add, for macOS: This was true for me with
Xcode 13, and is no longer with Xcode 14. Both clangd and lldb crash
pretty frequently :-(.