[SERVER-45684] Ninja compiledb adds env vars to commands Created: 21/Jan/20 Updated: 06/Dec/22 Resolved: 19/Feb/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Ryan Timmons | Assignee: | [DO NOT ASSIGN] Backlog - Server Development Platform Team (SDP) (Inactive) |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Server Development Platform
|
| Operating System: | ALL |
| Participants: |
| Description |
|
Ninja compiledb adds env vars to commands Expected: compile_commands.json that looks like this (this is what scons produces):
Actual:
This causes at least CLion to not recognize the compiler correctly. I don't know if the spec allows for env vars to be specified like this (seems like maybe it should allow it). If so it's reasonable to say "wontfix" to this and say it's a bug in editors not parsing commands correctly or something. But it seems reasonable to want that scons and ninja produce similar files. For now it's not hard to use global-search-and-replace to remove the PATH= etc prefixes. |
| Comments |
| Comment by Daniel Moody [ 11/Nov/20 ] |
|
Possible we can strip the environments from the generated compile_commands.json? It would require a tricky regex, but I think adding a sed command in the ninja tool where the compile_commands.json is created could do it. |
| Comment by Andrew Morrow (Inactive) [ 19/Feb/20 ] |
|
This isn't a regression from the old ninja module, which had the same issue. There also isn't much we can do about it. In many cases, we must include these environment variables on the Ninja command line in order to enable features like ccache and icecream. Since the Ninja generated compiledb will reflect those commands, there isn't a way for us to avoid issuing them. Our recommendation will be that users generate their compilation database directly from SCons, which will not include the environment variables, since SCons manages the environment differently than Ninja. Generating the compilation database with SCons is very fast. |