https://bugs.winehq.org/show_bug.cgi?id=42436
Kyle Auble kyle.auble@zoho.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |kyle.auble@zoho.com
--- Comment #1 from Kyle Auble kyle.auble@zoho.com --- (In reply to Wylda from comment #0)
I don't know, if anyone tried recently follow wiki link:
https://wiki.winehq.org/Building_Wine#Memory_.26_Address_Checkers
This link mentions "...you only need to pass the -fsanitize=address flag to the compiler when building"
../wine-source/configure CFLAGS="-g -O1 -fsanitize=address -other-flags"
But this fails soon in make_xftmpl.o: In function fatal_error':
..../tools/make_xftmpl.c:116: undefined reference to `__asan_option_detect_stack_use_after_return'
..../tools/make_xftmpl.c:116: undefined reference to `__asan_stack_malloc_1'
Passing LIBS="-lasan" to configure fixes this, but build fails anyway at cca 63%:
..../dlls/ntdll/loader.c:2979: undefined reference to `pthread_sigmask'
Passing LIBS="-lasan -lpthread" to configure fixes this issue, but anyway fails at the end:
../tools/sfnt2fon/sfnt2fon -o coue1255.fon ../../wine_git_src/fonts/courier.ttf -d 128 13,1255,8
==16755==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
Did anyone tried to follow that Wiki? I tried that on Debian Stretch. Gcc (Debian 6.3.0-6) 6.3.0 20170205
After looking into this, I think you've made a good catch. The wiki instructions weren't entirely correct. You should only need to use the -fsanitize=address flag, but you need to add it to both CFLAGS and LDFLAGS when you configure: https://stackoverflow.com/questions/37970758/how-to-use-addresssanitizer-in-...
I think that's why you were having the errors you did. The first problem was not having access to ASan's malloc, which you get when you add back in -lasan. Ditto for the second problem and -lpthread. Your final error probably came from still not linking to the full ASan library, just the two pieces you had specified. That you also need to link explicitly to ASan totally slipped by me when I was reading the documentation. I've corrected the wiki page now.
By the way, we can always use more help with documentation, especially fact-checking like this. If you want to edit the wiki, first create a wiki account (single sign-on across WineHQ is still on our wishlist), then you just need to email a wiki admin to ask for edit privileges. I think of all the admins, Rosanne DiMesio is most active on the wiki.
Otherwise, if the new instructions work for you, I think we can close this bug.