glusterfs icon indicating copy to clipboard operation
glusterfs copied to clipboard

build: enforce library order required by the sanitizers

Open dmantipov opened this issue 4 years ago • 4 comments

If sanitizer (e.g. ASan) is enabled, using AC_CHECK_LIB(...) to detect TCmalloc causes configure to construct compiler invocations like gcc -o conftest -g -O2 conftest.c -ltcmalloc -lasan, which is wrong because sanitizer library should come first in the library list. Therefore all execution tests fails with the following error:

...
configure:13496: checking size of short
configure:13501: gcc -o conftest -g -O2 conftest.c -ltcmalloc -lasan >&5
configure:13501: $? = 0
configure:13501: ./conftest
==117080==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.
configure:13501: $? = 1
configure: program exited with status 1
...

Zeroing LIBS before running AC_CHECK_LIB([tcmalloc], ...) and appending (not prepending) -ltcmalloc to GF_LDFLAGS enforces an expected order of the libraries.

Signed-off-by: Dmitry Antipov [email protected] Updates: #1000

dmantipov avatar Nov 25 '21 13:11 dmantipov

interesting. Looks like @pranithk had some issues with tcmalloc. Hope this is resolving his issues.

amarts avatar Nov 25 '21 14:11 amarts

/run regression

amarts avatar Nov 25 '21 14:11 amarts

Is this still required? If yes, please rebase, will merge.

amarts avatar Dec 30 '21 08:12 amarts

Thank you for your contributions. Noticed that this issue is not having any activity in last ~6 months! We are marking this issue as stale because it has not had recent activity. It will be closed in 2 weeks if no one responds with a comment here.

stale[bot] avatar Jul 30 '22 17:07 stale[bot]

Closing this issue as there was no update since my last update on issue. If this is an issue which is still valid, feel free to open it.

stale[bot] avatar Sep 21 '22 00:09 stale[bot]