Skip to content

Commit

Permalink
add asan build support #151 (PR #167)
Browse files Browse the repository at this point in the history
build with `npm i --asan=true`.  This will use a build that links in
asan at runtime.

The odd split in .gyp files exists because we want to compile nanomsg
with asan instrumentation, but when we link our node_namomsg.node shared
object we want to remind gyp to link asan's runtime library.

This can likely also be done for Linux, but I haven't tested.

Also, we segfault off the bat with this.  I don't have time to look into
it, but at least it builds correctly.
  • Loading branch information
nickdesaulniers authored and reqshark committed Nov 26, 2016
1 parent cfa6ca7 commit a271345
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -420,3 +420,7 @@ WIP
## license

MIT

## memory leak hunting
`npm i --asan=true`

8 changes: 8 additions & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
'variables': {
'use_system_libnanomsg%': 'false',
'asan': 'false',
},
'targets': [
{
Expand Down Expand Up @@ -33,6 +34,13 @@
'<!@(pkg-config nanomsg --libs || echo "")',
],
}],
['OS=="mac" and asan=="true"', {
'xcode_settings': {
'OTHER_LDFLAGS': [
'-fsanitize=address'
]
}
}],
['OS=="win"', {
'cflags': [ '-Wall -Werror -Wno-unused' ],
'cflags_cc': ['-fexceptions'],
Expand Down
9 changes: 9 additions & 0 deletions deps/macosx.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
'-Wno-unused',
],
},
'conditions': [
['asan=="true"', {
'xcode_settings': {
'OTHER_CFLAGS': [
'-fsanitize=address'
]
}
}]
],
'defines': [
'NN_HAVE_SOCKETPAIR',
'NN_HAVE_SEMAPHORE',
Expand Down

0 comments on commit a271345

Please sign in to comment.