[pulseaudio-discuss] `LDFLAGS` are not passed down preventing usage of AddressSanitizer (ASan)
Paul Menzel
paulepanter at users.sourceforge.net
Fri May 15 03:25:08 PDT 2015
Am Freitag, den 15.05.2015, 12:42 +0300 schrieb Tanu Kaskinen:
> On Sat, 2015-05-02 at 22:25 +0200, Paul Menzel wrote:
> > my goal is to build PulseAudio with the “fast memory error detector”
> > AddressSanitizer (ASan) [1].
> >
> > $ CFLAGS="-O1 -g -fsanitize=address -fno-omit-frame-pointer" LDFLAGS="-fsanitize=address" ./autogen.sh
> > $ CFLAGS="-O1 -g -fsanitize=address -fno-omit-frame-pointer" LDFLAGS="-fsanitize=address" make V=1
> > […]
> > $ cd src/
> > $ gcc -std=gnu99 -shared -fPIC -DPIC modules/.libs/module_console_kit_la-module-console-kit.o -Wl,-rpath -Wl,/src/pulseaudio/src/.libs -Wl,-rpath -Wl,/usr/local/lib/pulseaudio ./.libs/libpulsecore-6.0.so ./.libs/libpulsecommon-6.0.so ./.libs/libpulse.so -ldbus-1 -lcap -lpthread -lrt -ldl -lm -pthread -O1 -Wl,-z -Wl,nodelete -Wl,--no-undefined -pthread -Wl,-soname -Wl,module-console-kit.so -o .libs/module-console-kit.so
> > modules/.libs/module_console_kit_la-module-console-kit.o: In function `add_session':
> > /src/pulseaudio/src/modules/module-console-kit.c:64: undefined reference to `__asan_option_detect_stack_use_after_return'
> > /src/pulseaudio/src/modules/module-console-kit.c:64: undefined reference to `__asan_stack_malloc_2'
> > /src/pulseaudio/src/modules/module-console-kit.c:73: undefined reference to `__asan_report_load4'
> > /src/pulseaudio/src/modules/module-console-kit.c:83: undefined reference to `__asan_report_load4'
> > /src/pulseaudio/src/modules/module-console-kit.c:103: undefined reference to `__asan_report_store4'
> > /src/pulseaudio/src/modules/module-console-kit.c:106: undefined reference to `__asan_report_load4'
> > /src/pulseaudio/src/modules/module-console-kit.c:110: undefined reference to `__asan_report_load4'
> > /src/pulseaudio/src/modules/module-console-kit.c:110: undefined reference to `__asan_report_store4'
> > /src/pulseaudio/src/modules/module-console-kit.c:113: undefined reference to `__asan_report_load4'
> > /src/pulseaudio/src/modules/module-console-kit.c:114: undefined reference to `__asan_report_load4'
> > /src/pulseaudio/src/modules/module-console-kit.c:119: undefined reference to `__asan_report_load4'
> > /src/pulseaudio/src/modules/module-console-kit.c:119: undefined reference to `__asan_report_load4'
> >
> > So it looks like `LDFLAGS` has gone missing here. Adding
> > `-fsanitize=address` manually results in successful linking.
> >
> > $ gcc -std=gnu99 -shared -fsanitize=address -fPIC -DPIC modules/.libs/module_console_kit_la-module-console-kit.o -Wl,-rpath -Wl,/src/pulseaudio/src/.libs -Wl,-rpath -Wl,/usr/local/lib/pulseaudio ./.libs/libpulsecore-6.0.so ./.libs/libpulsecommon-6.0.so ./.libs/libpulse.so -ldbus-1 -lcap -lpthread -lrt -ldl -lm -pthread -O1 -Wl,-z -Wl,nodelete -Wl,--no-undefined -pthread -Wl,-soname -Wl,module-console-kit.so -o .libs/module-console-kit.so
> > $ ls .libs/module-console-kit.so
> > .libs/module-console-kit.so
> >
> > Am I using the build system incorrectly or is this a bug?
>
> I'm not sure, but I would guess that it is a bug. My understanding is
> that when configure is run, CFLAGS and LDFLAGS should be picked up from
> the environment. You set the same variables to the same values also when
> running make, which is redundant, but of course doing so shouldn't be
> harmful either.
Ah, thank you for the hint. I just wanted to be sure and passed them to
Make too.
> As a workaround, you could try setting the variables as make parameters
> instead of as environment variables:
>
> make CFLAGS="..." LDFLAGS="..."
Thank you. Unfortunately, that failed with the same error.
$ make V=1 CFLAGS="-O1 -g -fsanitize=address -fno-omit-frame-pointer" LDFLAGS="-fsanitize=address"
make all-recursive
make[1]: Entering directory '/mnt/pa-upstream'
Making all in src
make[2]: Entering directory '/mnt/pa-upstream/src'
/bin/mkdir -p daemon modules
make all-am
make[3]: Entering directory '/mnt/pa-upstream/src'
/bin/sh ../libtool --tag=CC --mode=link gcc -std=gnu99 -pthread -I/usr/include/dbus-1.0 -I/usr/lib/i386-linux-gnu/dbus-1.0/include -O1 -g -fsanitize=address -fno-omit-frame-pointer -Wl,-z,nodelete -module -disable-static -avoid-version -Wl,--no-undefined -fsanitize=address -o module-console-kit.la -rpath /usr/local/lib/pulse-6.0/modules modules/module_console_kit_la-module-console-kit.lo libpulsecore-6.0.la libpulsecommon-6.0.la libpulse.la -ldbus-1 -lcap -lpthread -lrt -ldl -lm
libtool: link: gcc -std=gnu99 -shared -fPIC -DPIC modules/.libs/module_console_kit_la-module-console-kit.o -Wl,-rpath -Wl,/mnt/pa-upstream/src/.libs -Wl,-rpath -Wl,/usr/local/lib/pulseaudio ./.libs/libpulsecore-6.0.so ./.libs/libpulsecommon-6.0.so ./.libs/libpulse.so -ldbus-1 -lcap -lpthread -lrt -ldl -lm -pthread -O1 -Wl,-z -Wl,nodelete -Wl,--no-undefined -pthread -Wl,-soname -Wl,module-console-kit.so -o .libs/module-console-kit.so
modules/.libs/module_console_kit_la-module-console-kit.o: In function `add_session':
/mnt/pa-upstream/src/modules/module-console-kit.c:64: undefined reference to `__asan_option_detect_stack_use_after_return'
/mnt/pa-upstream/src/modules/module-console-kit.c:64: undefined reference to `__asan_stack_malloc_2'
/mnt/pa-upstream/src/modules/module-console-kit.c:73: undefined reference to `__asan_report_load4'
/mnt/pa-upstream/src/modules/module-console-kit.c:83: undefined reference to `__asan_report_load4'
/mnt/pa-upstream/src/modules/module-console-kit.c:103: undefined reference to `__asan_report_store4'
/mnt/pa-upstream/src/modules/module-console-kit.c:106: undefined reference to `__asan_report_load4'
/mnt/pa-upstream/src/modules/module-console-kit.c:110: undefined reference to `__asan_report_load4'
/mnt/pa-upstream/src/modules/module-console-kit.c:110: undefined reference to `__asan_report_store4'
/mnt/pa-upstream/src/modules/module-console-kit.c:113: undefined reference to `__asan_report_load4'
/mnt/pa-upstream/src/modules/module-console-kit.c:114: undefined reference to `__asan_report_load4'
/mnt/pa-upstream/src/modules/module-console-kit.c:119: undefined reference to `__asan_report_load4'
/mnt/pa-upstream/src/modules/module-console-kit.c:119: undefined reference to `__asan_report_load4'
modules/.libs/module_console_kit_la-module-console-kit.o: In function `filter_cb':
/mnt/pa-upstream/src/modules/module-console-kit.c:151: undefined reference to `__asan_option_detect_stack_use_after_return'
/mnt/pa-upstream/src/modules/module-console-kit.c:151: undefined reference to `__asan_stack_malloc_2'
/mnt/pa-upstream/src/modules/module-console-kit.c:156: undefined reference to `__asan_handle_no_return'
/mnt/pa-upstream/src/modules/module-console-kit.c:157: undefined reference to `__asan_handle_no_return'
/mnt/pa-upstream/src/modules/module-console-kit.c:158: undefined reference to `__asan_handle_no_return'
modules/.libs/module_console_kit_la-module-console-kit.o: In function `remove_session':
/mnt/pa-upstream/src/modules/module-console-kit.c:146: undefined reference to `__asan_handle_no_return'
/mnt/pa-upstream/src/modules/module-console-kit.c:148: undefined reference to `__asan_report_load4'
modules/.libs/module_console_kit_la-module-console-kit.o: In function `free_session':
/mnt/pa-upstream/src/modules/module-console-kit.c:135: undefined reference to `__asan_handle_no_return'
/mnt/pa-upstream/src/modules/module-console-kit.c:137: undefined reference to `__asan_report_load4'
/mnt/pa-upstream/src/modules/module-console-kit.c:139: undefined reference to `__asan_report_load4'
/mnt/pa-upstream/src/modules/module-console-kit.c:140: undefined reference to `__asan_report_load4'
modules/.libs/module_console_kit_la-module-console-kit.o: In function `module_console_kit_LTX_pa__done':
/mnt/pa-upstream/src/modules/module-console-kit.c:334: undefined reference to `__asan_handle_no_return'
/mnt/pa-upstream/src/modules/module-console-kit.c:336: undefined reference to `__asan_report_load4'
/mnt/pa-upstream/src/modules/module-console-kit.c:339: undefined reference to `__asan_report_load4'
/mnt/pa-upstream/src/modules/module-console-kit.c:342: undefined reference to `__asan_report_load4'
/mnt/pa-upstream/src/modules/module-console-kit.c:348: undefined reference to `__asan_report_load1'
/mnt/pa-upstream/src/modules/module-console-kit.c:349: undefined reference to `__asan_report_load4'
/mnt/pa-upstream/src/modules/module-console-kit.c:351: undefined reference to `__asan_report_load4'
modules/.libs/module_console_kit_la-module-console-kit.o: In function `module_console_kit_LTX_pa__init':
/mnt/pa-upstream/src/modules/module-console-kit.c:264: undefined reference to `__asan_option_detect_stack_use_after_return'
/mnt/pa-upstream/src/modules/module-console-kit.c:264: undefined reference to `__asan_stack_malloc_3'
/mnt/pa-upstream/src/modules/module-console-kit.c:270: undefined reference to `__asan_handle_no_return'
/mnt/pa-upstream/src/modules/module-console-kit.c:279: undefined reference to `__asan_report_load4'
/mnt/pa-upstream/src/modules/module-console-kit.c:284: undefined reference to `__asan_report_load4'
/mnt/pa-upstream/src/modules/module-console-kit.c:293: undefined reference to `__asan_report_store4'
/mnt/pa-upstream/src/modules/module-console-kit.c:294: undefined reference to `__asan_report_load4'
/mnt/pa-upstream/src/modules/module-console-kit.c:294: undefined reference to `__asan_report_store4'
/mnt/pa-upstream/src/modules/module-console-kit.c:295: undefined reference to `__asan_report_store4'
/mnt/pa-upstream/src/modules/module-console-kit.c:296: undefined reference to `__asan_report_store4'
/mnt/pa-upstream/src/modules/module-console-kit.c:297: undefined reference to `__asan_report_store4'
/mnt/pa-upstream/src/modules/module-console-kit.c:304: undefined reference to `__asan_report_store1'
modules/.libs/module_console_kit_la-module-console-kit.o: In function `get_session_list':
/mnt/pa-upstream/src/modules/module-console-kit.c:204: undefined reference to `__asan_handle_no_return'
/mnt/pa-upstream/src/modules/module-console-kit.c:219: undefined reference to `__asan_report_load4'
/mnt/pa-upstream/src/modules/module-console-kit.c:241: undefined reference to `__asan_handle_no_return'
modules/.libs/module_console_kit_la-module-console-kit.o: In function `_GLOBAL__sub_D_00099_0_module_console_kit.c':
/mnt/pa-upstream/src/modules/module-console-kit.c:355: undefined reference to `__asan_unregister_globals'
modules/.libs/module_console_kit_la-module-console-kit.o: In function `_GLOBAL__sub_I_00099_1_module_console_kit.c':
/mnt/pa-upstream/src/modules/module-console-kit.c:355: undefined reference to `__asan_init_v3'
/mnt/pa-upstream/src/modules/module-console-kit.c:355: undefined reference to `__asan_register_globals'
collect2: error: ld returned 1 exit status
Makefile:5730: recipe for target 'module-console-kit.la' failed
make[3]: *** [module-console-kit.la] Error 1
make[3]: Leaving directory '/mnt/pa-upstream/src'
Makefile:4827: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/mnt/pa-upstream/src'
Makefile:791: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/mnt/pa-upstream'
Makefile:605: recipe for target 'all' failed
make: *** [all] Error 2
I am using GNU Make 4.0.
$ make --version
GNU Make 4.0
[…]
Thanks,
Paul
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20150515/4e256db2/attachment.sig>
More information about the pulseaudio-discuss
mailing list