[SERVER-72147] Figure out correct flags for clang-tidy module Created: 15/Dec/22  Updated: 29/Oct/23  Resolved: 13/Feb/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.0.0-rc0

Type: Task Priority: Major - P3
Reporter: Daniel Moody Assignee: Daniel Moody
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Participants:

 Description   

when building the clang tidy check module, some of the flags result in a different ABI causing the name mangling of certain symbols to not line up. Using the flags that the toolchain used results in the correct symbol resolution. 

Also the z, defs flag can not be used as the module will be loaded into a binary where the symbols are static and will be resolved at load time.



 Comments   
Comment by Githook User [ 13/Feb/23 ]

Author:

{'name': 'Daniel Moody', 'email': 'daniel.moody@mongodb.com', 'username': 'dmoody256'}

Message: SERVER-72147 defer switching hard coded clang tidy module flags.
Branch: master
https://github.com/mongodb/mongo/commit/2d8b897ec7e8753e6be42cd90e00a19b09c5aca7

Comment by Daniel Moody [ 09/Feb/23 ]

created https://jira.mongodb.org/browse/SERVER-73825 to prevent ninja breakages like this in the future

Comment by Githook User [ 09/Feb/23 ]

Author:

{'name': 'Kaloian Manassiev', 'email': 'kaloian.manassiev@mongodb.com', 'username': 'kaloianm'}

Message: Revert "SERVER-72147 defer switching hard coded clang tidy module flags."

This reverts commit 8181de8a415a6198731a7cabe8e04ca014722aa0.
Branch: master
https://github.com/mongodb/mongo/commit/7be8b2f04f5d2e487015c4fcb92b7ff6aa81dc57

Comment by Kaloian Manassiev [ 09/Feb/23 ]

This change results in failed compilation at least on the local machines, so I am going to revert it since it will be some time before NYC wakes up:

ubuntu@kal-virtual-workstation:~/workspace/mongo$ buildscripts/scons.py -j 256 --ssl --build-tools=next --variables-files=etc/scons/developer_versions.vars --variables-files=etc/scons/mongodbtoolchain_stable_clang.vars CCACHE=ccache ICECC=icecc --link-model=dynamic --dbg=on --opt=off --ninja VARIANT_DIR=ninja generate-ninja
...
scons: Building targets ...
scons: *** [build/ninja/mongo/tools/mongo_tidy_checks/MongoTestCheck.dyn.o] Exception : Could not find tool /opt/mongodbtoolchain/v4/bin/clang++ in ['/opt/mongodbtoolchain/v4/bin/ccache', '/opt/mongodbtoolchain/v4/bin/g++', '-o', 'build/ninja/mongo/tools/mongo_tidy_checks/MongoTestCheck.dyn.o', '-c', '-DGTEST_HAS_RTTI=0', '-D_GNU_SOURCE', '-D__STDC_CONSTANT_MACROS', '-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS', '-fPIC', '-fvisibility-inlines-hidden', '-Werror=date-time', '-Wall', '-Wextra', '-Wno-unused-parameter', '-Wwrite-strings', '-Wcast-qual', '-Wno-missing-field-initializers', '-pedantic', '-Wno-long-long', '-Wimplicit-fallthrough', '-Wno-maybe-uninitialized', '-Wno-class-memaccess', '-Wno-redundant-move', '-Wno-noexcept-type', '-Wdelete-non-virtual-dtor', '-Wsuggest-override', '-Wno-comment', '-fdiagnostics-color', '-ffunction-sections', '-fdata-sections', '-fno-common', '-Woverloaded-virtual', '-fno-strict-aliasing', '-O3', '-g2', '-DNDEBUG', '-fPIC', '-fno-exceptions', '-fno-rtti', '-std=c++17', '-fPIC', '-DSAFEINT_USE_INTRINSICS=0', '-DPCRE2_STATIC', '-DMONGO_USE_VISIBILITY', '-D_XOPEN_SOURCE=700', '-D_GNU_SOURCE', '-DABSL_FORCE_ALIGNED_ACCESS', '-DBOOST_ENABLE_ASSERT_DEBUG_HANDLER', '-DBOOST_FILESYSTEM_NO_CXX20_ATOMIC_REF', '-DBOOST_LOG_NO_SHORTHAND_NAMES', '-DBOOST_LOG_USE_NATIVE_SYSLOG', '-DBOOST_LOG_WITHOUT_THREAD_ATTR', '-DBOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS', '-DBOOST_SYSTEM_NO_DEPRECATED', '-DBOOST_THREAD_USES_DATETIME', '-DBOOST_THREAD_VERSION=5', '-DBOOST_LOG_DYN_LINK', '-I/opt/mongodbtoolchain/revisions/11316f1e7b36f08dcdd2ad0640af18f9287876f4/stow/llvm-v4.hhG/include', 'src/mongo/tools/mongo_tidy_checks/MongoTestCheck.cpp'] generated from ${SHCXXCOM}
scons: building terminated because of errors.
build/ninja/mongo/tools/mongo_tidy_checks/MongoTestCheck.dyn.o failed: Exception : Could not find tool /opt/mongodbtoolchain/v4/bin/clang++ in ['/opt/mongodbtoolchain/v4/bin/ccache', '/opt/mongodbtoolchain/v4/bin/g++', '-o', 'build/ninja/mongo/tools/mongo_tidy_checks/MongoTestCheck.dyn.o', '-c', '-DGTEST_HAS_RTTI=0', '-D_GNU_SOURCE', '-D__STDC_CONSTANT_MACROS', '-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS', '-fPIC', '-fvisibility-inlines-hidden', '-Werror=date-time', '-Wall', '-Wextra', '-Wno-unused-parameter', '-Wwrite-strings', '-Wcast-qual', '-Wno-missing-field-initializers', '-pedantic', '-Wno-long-long', '-Wimplicit-fallthrough', '-Wno-maybe-uninitialized', '-Wno-class-memaccess', '-Wno-redundant-move', '-Wno-noexcept-type', '-Wdelete-non-virtual-dtor', '-Wsuggest-override', '-Wno-comment', '-fdiagnostics-color', '-ffunction-sections', '-fdata-sections', '-fno-common', '-Woverloaded-virtual', '-fno-strict-aliasing', '-O3', '-g2', '-DNDEBUG', '-fPIC', '-fno-exceptions', '-fno-rtti', '-std=c++17', '-fPIC', '-DSAFEINT_USE_INTRINSICS=0', '-DPCRE2_STATIC', '-DMONGO_USE_VISIBILITY', '-D_XOPEN_SOURCE=700', '-D_GNU_SOURCE', '-DABSL_FORCE_ALIGNED_ACCESS', '-DBOOST_ENABLE_ASSERT_DEBUG_HANDLER', '-DBOOST_FILESYSTEM_NO_CXX20_ATOMIC_REF', '-DBOOST_LOG_NO_SHORTHAND_NAMES', '-DBOOST_LOG_USE_NATIVE_SYSLOG', '-DBOOST_LOG_WITHOUT_THREAD_ATTR', '-DBOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS', '-DBOOST_SYSTEM_NO_DEPRECATED', '-DBOOST_THREAD_USES_DATETIME', '-DBOOST_THREAD_VERSION=5', '-DBOOST_LOG_DYN_LINK', '-I/opt/mongodbtoolchain/revisions/11316f1e7b36f08dcdd2ad0640af18f9287876f4/stow/llvm-v4.hhG/include', 'src/mongo/tools/mongo_tidy_checks/MongoTestCheck.cpp'] generated from ${SHCXXCOM}

Despite the error that clang++ cannot be found, it is actually there:

ubuntu@kal-virtual-workstation:~/workspace/mongo$ /opt/mongodbtoolchain/v4/bin/clang++ --version
MongoDB clang version 12.0.1 (git@github.com:10gen/toolchain-builder.git 11316f1e7b36f08dcdd2ad0640af18f9287876f4)
Target: x86_64-mongodb-linux
Thread model: posix
InstalledDir: /opt/mongodbtoolchain/v4/bin

Comment by Githook User [ 09/Feb/23 ]

Author:

{'name': 'Daniel Moody', 'email': 'daniel.moody@mongodb.com', 'username': 'dmoody256'}

Message: SERVER-72147 defer switching hard coded clang tidy module flags.
Branch: master
https://github.com/mongodb/mongo/commit/8181de8a415a6198731a7cabe8e04ca014722aa0

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