Skip to content

Instantly share code, notes, and snippets.

@jdswinbank
Created July 19, 2019 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdswinbank/b49ae44c1c112cf07053d4f60a23198f to your computer and use it in GitHub Desktop.
Save jdswinbank/b49ae44c1c112cf07053d4f60a23198f to your computer and use it in GitHub Desktop.
diff --git a/python/lsst/sconsUtils/builders.py b/python/lsst/sconsUtils/builders.py
index a14e150..02ad96c 100644
--- a/python/lsst/sconsUtils/builders.py
+++ b/python/lsst/sconsUtils/builders.py
@@ -22,7 +22,7 @@ def SharedLibraryIncomplete(self, target, source, **keywords):
"""
myenv = self.Clone()
if myenv['PLATFORM'] == 'darwin':
- myenv['SHLINKFLAGS'] += ["-undefined", "suppress", "-flat_namespace", "-headerpad_max_install_names"]
+ myenv['SHLINKFLAGS'] += ["-undefined", "suppress", "-flat_namespace", "-headerpad_max_install_names", "-fsanitize=address", "-shared-libasan"]
return myenv.SharedLibrary(target, source, **keywords)
@@ -35,7 +35,9 @@ def Pybind11LoadableModule(self, target, source, **keywords):
myenv.Append(CCFLAGS=["-fvisibility=hidden"])
if myenv['PLATFORM'] == 'darwin':
myenv.Append(LDMODULEFLAGS=["-undefined", "suppress",
- "-flat_namespace", "-headerpad_max_install_names"])
+ "-flat_namespace",
+ "-headerpad_max_install_names",
+ "-fsanitize=address", "-shared-libasan"])
return myenv.LoadableModule(target, source, **keywords)
diff --git a/python/lsst/sconsUtils/state.py b/python/lsst/sconsUtils/state.py
index d60b380..09e3c06 100644
--- a/python/lsst/sconsUtils/state.py
+++ b/python/lsst/sconsUtils/state.py
@@ -184,6 +184,9 @@ def _initEnvironment():
env.Append(SHLINKFLAGS=["-install_name", "${TARGET.file}"])
if not re.search(r"-headerpad_max_install_names", str(env['SHLINKFLAGS'])):
env.Append(SHLINKFLAGS=["-Wl,-headerpad_max_install_names"])
+
+ env.Append(SHLINKFLAGS=["-fsanitize=address", "-shared-libasan"])
+
#
# We want to be explicit about the OS X version we're targeting
#
@@ -214,6 +217,8 @@ def _initEnvironment():
if env['debug']:
env.Append(CCFLAGS=['-g'])
+ env.Append(CCFLAGS=['-fsanitize=address'])
+ env.Append(CCFLAGS=['-shared-libasan'])
#
# determine if EUPS is present
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment