From 47ff151dea9ba469a39753943e0aa472c668f5b0 Mon Sep 17 00:00:00 2001 From: Michael Rash Date: Tue, 18 Aug 2015 20:37:56 -0400 Subject: [PATCH] [build] add convenience script for ASan builds Sometimes when ASan support is wanted for fwknop, the following compile error can be generated. This script provides a means to solve this. fwknop-spa_comm.o: In function `send_spa_packet_http': /home/mbr/git/fwknop.git/client/spa_comm.c:516: undefined reference to `rpl_malloc' ../lib/.libs/libfko.so: undefined reference to `rpl_realloc' --- Makefile.am | 1 + extras/sanitizer/asan-build.sh | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100755 extras/sanitizer/asan-build.sh diff --git a/Makefile.am b/Makefile.am index 306e3b09..6ed2e9b1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -74,6 +74,7 @@ EXTRA_DIST = \ extras/ramdisk/ramdisk-create.sh \ extras/ramdisk/ramdisk-create-osx.sh \ extras/console-qr/console-qr.sh \ + extras/sanitizer/asan-build.sh \ fwknop.spec \ iphone/main.m \ iphone/Fwknop.xcodeproj \ diff --git a/extras/sanitizer/asan-build.sh b/extras/sanitizer/asan-build.sh new file mode 100755 index 00000000..ed42691b --- /dev/null +++ b/extras/sanitizer/asan-build.sh @@ -0,0 +1,21 @@ +#!/bin/sh -x + +# +# In some cases when enabling Google's Address Sanitizer, errors like the +# following can be generated. This script provides a workaround. +# +# fwknop-spa_comm.o: In function `send_spa_packet_http': +# /home/mbr/git/fwknop.git/client/spa_comm.c:516: undefined reference to `rpl_malloc' +# ../lib/.libs/libfko.so: undefined reference to `rpl_realloc' +# + +if [ -x ./configure ]; then + export ac_cv_func_malloc_0_nonnull=yes + export ac_cv_func_realloc_0_nonnull=yes + ./autogen.sh + ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/run --enable-asan-support $@ + make clean + make +else + echo "[*] Execute from the fwknop top level sources directory" +fi