[SERVER-81600] Investigate if its possible to avoid including llvm headers while compiling with clang Created: 29/Sep/23  Updated: 02/Feb/24

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Zack Winter Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Build
Participants:

 Description   

Currently scons is including "stow/llvm-v4/lib/clang/12.0.1/include" when compiling with clang:

"
/opt/mongodbtoolchain/v4/bin/clang++ -c src/mongo/platform/visibility_test_libcommon.cpp -v

… omitted …

#include "..." search starts here:
#include <...> search starts here:

/opt/mongodbtoolchain/revisions/4048f1b01b94379afc988a4fdec21a5081ef7489/stow/gcc-v4.tbv/lib/gcc/aarch64-mongodb-linux/11.3.0/../../../../include/c++/11.3.0
/opt/mongodbtoolchain/revisions/4048f1b01b94379afc988a4fdec21a5081ef7489/stow/gcc-v4.tbv/lib/gcc/aarch64-mongodb-linux/11.3.0/../../../../include/c++/11.3.0/aarch64-mongodb-linux
/opt/mongodbtoolchain/revisions/4048f1b01b94379afc988a4fdec21a5081ef7489/stow/gcc-v4.tbv/lib/gcc/aarch64-mongodb-linux/11.3.0/../../../../include/c++/11.3.0/backward
/usr/local/include
/opt/mongodbtoolchain/revisions/4048f1b01b94379afc988a4fdec21a5081ef7489/stow/llvm-v4.zLY/lib/clang/12.0.1/include
/usr/include/aarch64-linux-gnu
/usr/include

End of search list.
"

We're porting this functionality over to bazel to make migration easier by keeping the includes as close to scons as possible. However, it's awkward that we're including llvm headers on top of gcc headers. The break that motivated including this originally was that gcc's stdatomic.h doesn't compile on clang.

This isn't a required change to migrate to bazel, but figuring this out may prevent future headaches caused by this strange list of header includes.

See https://github.com/10gen/mongo/pull/15952 for more context.


Generated at Thu Feb 08 06:46:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.