[Scons-users] Ninja generator, compilation database issues
Jelic, Nikola
Nikola.Jelic at zuehlke.com
Fri Sep 6 04:08:27 EDT 2024
Greetings,
I have created a small project with the following folder structure
Source root
|- project1
| |-> main.cpp
|- include
|- SConstruct
SConsctruct contains:
env = Environment()
env.Tool('ninja')
env.Tool('compilation_db')
env.CompilationDatabase('project1/compile_commands.json')
env.Program('project1/main.cpp')
SCons is invoked both with and without ninja:
scons --experimental=ninja
scons -c
scons
The results are the same - the build is successful and the compile_commands.json file is created in the project1 subdirectory.
I don't have an explanation why the last step of building the compilation database hangs in our project.
________________________________
From: Bill Deegan <bill at baddogconsulting.com>
Sent: 30 August 2024 19:09
To: SCons users mailing list <scons-users at scons.org>
Cc: Jelic, Nikola <Nikola.Jelic at zuehlke.com>
Subject: Re: [Scons-users] Ninja generator, compilation database issues
Any chance you can create a simple reproducer?
As in 1 (or just a few dummy source files) and a SConstruct?
Thanks,
Bill
SCons Project Manager.
On Fri, Aug 30, 2024 at 6:39 AM Mats Wichmann <mats at wichmann.us<mailto:mats at wichmann.us>> wrote:
On 8/30/24 02:38, Jelic, Nikola wrote:
> Greetings,
>
> We are using SCons' Ninja generator to upgrade the existing project. We
> are also using the compilation database extension in SCons, but we have
> reached some interesting limitations when we try to use Ninja generator.
> In short, if "compile_commands.json" is requested to be anywhere except
> the root of the project (which is not our case), we face one or all of
> these issues:
>
> *
> Duplicate Ninja targets
> *
> A hanging task for generating the compilation database on a
> different location
>
> I have a small WIP patch that resolves some of these issues, but I
> wanted to start a discussion and see what the best approach would be.
Can continue discussion here, open an issue (or discussion) on GitHub,
or even discuss on the Discord channel.
> The location and the name of the compilation database file should be
> completely independent of the project structure
There shouldn't be, and I don't at a quick glance see any reason in the
code for why putting the database somewhere else would not work. I do
note that the test suite only checks names in the project topdir, and in
a variant directory (which "looks like" in the topdir although it's
relocated).
We don't have anything that tests the compilation DB and ninja together.
_______________________________________________
Scons-users mailing list
Scons-users at scons.org<mailto:Scons-users at scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20240906/aa89b197/attachment.htm>
More information about the Scons-users
mailing list