[SERVER-27628] The compile commands database doesn't always write the actual commands used to build Created: 10/Jan/17  Updated: 05/Apr/17  Resolved: 13/Jan/17

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: None
Fix Version/s: 3.5.2

Type: Bug Priority: Minor - P4
Reporter: Kasper Laudrup Assignee: Gabriel Russell (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Platforms 2017-01-23
Participants:

 Description   

If building a target with eg.:

env.Library("foo", ["foo.cpp"], CXXFLAGS=["-Dfoo"])

The compile command written to the compilation command database (compile_commands.json) will not use the updated flags in CXXFLAGS, but always use the environment in "env".

This means that the compilation database will not always match the actual command line required to build the target.



 Comments   
Comment by Githook User [ 13/Jan/17 ]

Author:

{u'username': u'laudrup', u'name': u'Kasper Laudrup', u'email': u'laudrup@stacktrace.dk'}

Message: SERVER-27628 Use the overrided environment when generating compile_command.json

When the compilation_db scons emitter saved compilation database
entried it always used the "global" environment which might not match
the compilation command line actually used to build the target.

That meant that using eg.:

env.Library("foo", ["foo.cpp"], CXXFLAGS=["-Dfoo"])

Would not write the extra "-Dfoo" flag actually used to build the foo
library to the compile_commands.json file.

Instead save the environment used to generate the target and use that
when writing the compile_command.json entry.
Branch: master
https://github.com/mongodb/mongo/commit/de7e3c74f156248545f3148b79c5c4fc874696f7

Generated at Thu Feb 08 04:15:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.