[SERVER-57498] Unable to build with ASAN using gcc Created: 07/Jun/21  Updated: 29/Oct/23  Resolved: 16/Jun/21

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

Type: Bug Priority: Major - P3
Reporter: George Wangensteen Assignee: Andrew Morrow (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-57499 Unable to build with ASAN using gcc Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Dev Platform 2021-06-28
Participants:

 Description   

Following the instructions here, I attempted to build the server with the address/leak sanitizers using gcc with the following invocation:

./buildscripts/scons.py --modules= --dbg=off --opt=on --link-model=dynamic --variables-files=etc/scons/mongodbtoolchain_stable_gcc.vars --allocator=system --sanitize=address

And got the following error from SCONS:

Checking if C compiler supports -fsanitize=address... yes
KeyError: 'LLVM_SYMBOLIZER':
  File "/home/ubuntu/mongo/SConstruct", line 4544:
    env = doConfigure( env )
  File "/home/ubuntu/mongo/SConstruct", line 3618:
    if env['LLVM_SYMBOLIZER']:
  File "/home/ubuntu/mongo/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Environment.py", line 405:
    return self._dict[key]

This issue persisted after trying to set a shell env var for LLVM_SYMBOLIZER:

export LLVM_SYMBOLIZER='/opt/mongodbtoolchain/v3/bin/llvm-symbolizer'

Ultimately I got around this by building with ASAN using Clang (thanks acm!), using an identical SCONS invocation to the one above except with the Clang variables instead of the GCC ones. But there appears to be an issue with building with ASAN and gcc.



 Comments   
Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Githook User [ 16/Jun/21 ]

Author:

{'name': 'Andrew Morrow', 'email': 'acm@mongodb.com', 'username': 'acmorrow'}

Message: SERVER-57498 Fix incorrect dictionary access when looking for LLVM_SYMBOLIZER
Branch: SERVER-34632
https://github.com/mongodb/mongo/commit/2c63d9bb562aaaf72e11233e5efcd42f5dfd4085

Comment by Andrew Morrow (Inactive) [ 16/Jun/21 ]

The error in the SConstruct file has been fixed - I was able to build ASAN enabled binaries with GCC. However, the resulting binaries don't really seem to work. Still, I'm resolving this ticket: the aim was to make the build not fail, rather than to make GCC ASAN work.

Comment by Githook User [ 15/Jun/21 ]

Author:

{'name': 'Andrew Morrow', 'email': 'acm@mongodb.com', 'username': 'acmorrow'}

Message: SERVER-57498 Fix incorrect dictionary access when looking for LLVM_SYMBOLIZER
Branch: master
https://github.com/mongodb/mongo/commit/2c63d9bb562aaaf72e11233e5efcd42f5dfd4085

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