[SERVER-51754] Running `ninja compiledb` generates much smaller file than `scons compiledb` Created: 20/Oct/20 Updated: 27/Oct/23 Resolved: 26/Oct/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Build |
| Affects Version/s: | 4.8.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Kaloian Manassiev | Assignee: | [DO NOT ASSIGN] Backlog - Server Development Platform Team (SDP) (Inactive) |
| Resolution: | Works as Designed | 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 |
|
I use VisualStudio Code often and because of this I rely on compile_commands.json. When I run ninja compiledb, I get a file of 1.8M:
When I run scons compiledb, I get a file of 8.4M:
|
| Comments |
| Comment by Daniel Moody [ 26/Oct/20 ] | ||||||
|
Kal confirmed that updating to a newer version of ninja fixed the issue | ||||||
| Comment by Daniel Moody [ 23/Oct/20 ] | ||||||
|
Ninja should be expanding the response files which was fixed in this commit: https://github.com/mongodb/mongo/commit/5fe923a0aa312044062df044eb4eaa47951f70ec So I expect it to be working for you. | ||||||
| Comment by Kaloian Manassiev [ 23/Oct/20 ] | ||||||
|
Sorry for the late reply, Daniel. You are correct – the one generated by scons indeed expands the paths:
and the one from ninja doesn't:
Feel free to close this ticket then. | ||||||
| Comment by Daniel Moody [ 20/Oct/20 ] | ||||||
|
Testing on ubuntu18 workstation, I get ninja compledb at about 8.2 MB and the scons compiledb at 7.5 MB. The builds are not in absolute parity, and there are few options ninja adds to each compile command so I would expect ninja's compiledb to be a little bigger. In your case I would guess that ninja did not expand the response files, so if you look in your compile commands json, you should se the @filepath.rsp instead of the command line options. This ticket added support for expanding the ninja response files in the compiledb target, but only certain versions of ninja support that option. The build should do a configure check to see if it can use that option, so you should see it in the configure output. Which version of ninja are you running on your laptop? I tested on my macbook and which has ninja 1.10 installed and it generated a compiledb almost the same size as on the linux workstation. |