Re: [OE-core] [PATCH v2 4/5] meson: use absolute cross-compiler paths

Richard Purdie
2024-02-20T12:54:35Z

On Mon, 2024-02-19 at 17:55 +0100, Enguerrand de Ribaucourt wrote:
> Among the files generated by meson is compile_commands.json. It is not
> used by bitbake during the build. However, if the devtool workspace is
> opened inside an IDE, that IDE can use compile_commands.json to
> configure linting and code completion. This is notably relied on by the
> new devtool ide-sdk command.
>
> The problem is that the IDE using compile_commands.json does not know
> the $PATH set-up by bitbake, so it won't find the compiler. This results
> in linting errors, like missing headers. We can fix this by expliciting
> the absolute compiler paths in meson.cross.
>
> The compile_commands.json specification expressly states:
> "All paths specified in the command or file fields must be either
> absolute or relative to this directory."
> Link: https://clang.llvm.org/docs/JSONCompilationDatabase.html
>
> An alternative way to implement this is to directly change CXX inside
> bitbake.conf to make all recipes use absolute compiler paths.Since this
> would affect all recipes, so I would like to have the maintainers'
> opinion on this. It could make sense to use absolute compiler paths for
> all toolchain binaries, we already do so for the sysroot
> TOOLCHAIN_OPTIONS.

I'd prefer not to change CXX.

We have a lot of problems with overflows of command line lengths
already and adding extra paths to such variables will make the problem
much worse. It also does make logs harder to read with long paths added
to them.

I suspect the readability issues along are enough to make this a change
for the worse overall.

Cheers,

Richard