Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Development: Address Sanitizer
Address sanitizer is a helpful tool built into gcc that detects memory errors such as buffer overflows and memory leaks. However, it is somewhat tricky to use with Open GEE due to the scons build system. Instructions for building Open GEE with address sanitizer are given below.
Edit earth_enterprise/src/SConstruct and find the if statement around line 165 that sets
optflagsfor the different build types. Find the statements that correspond to your build type and set the flags as follows (you can also specify
optflagsto partially optimize the code):
linkflags = ['-fsanitize=address'] optflags = ['-g', '-fsanitize=address']
The build will fail unless you tell address sanitizer that it should not exit when a leak is found via an environment variable. Scons does not use the environment variables from the shell it is run in, so this must be done directly in scons. In the same SConstruct file, add the line
env['ENV']['ASAN_OPTIONS'] = 'halt_on_error=0;detect_leaks=0'at some point after the
envvariable is created (around line 436). You can remove
;detect_leaks=0'to allow scons to detect memory leaks.
Build and run Open GEE. Address sanitizer will print out information about any memory problems it finds. This step works best if you run the fusion command line utitilities rather than the fusion UI.