Asan: Refine asan warning message for macOS.

pull/3349/head
winlin 2 years ago
parent 7750bdae10
commit 7bdb7270cf

@ -149,6 +149,11 @@ if [[ $SRS_GPERF_CP == YES ]]; then
else
srs_undefine_macro "SRS_GPERF_CP" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_SANITIZER == YES ]; then
srs_define_macro "SRS_SANITIZER" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_SANITIZER" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_SANITIZER_LOG == YES ]; then
srs_define_macro "SRS_SANITIZER_LOG" $SRS_AUTO_HEADERS_H
else

2
trunk/configure vendored

@ -586,6 +586,7 @@ ffmpeg:
END
# Generate Makefile entry for srs-server.
cat << END >> ${SRS_MAKEFILE}
server: _prepare_dir
@echo "Build the SRS server, JOBS=\${JOBS}, FORCE_MAKE_JOBS=${SRS_FORCE_MAKE_JOBS}"
@ -593,6 +594,7 @@ server: _prepare_dir
@bash objs/_srs_build_summary.sh
END
# generate all modules entry
for SRS_MODULE in ${SRS_MODULES[*]}; do
. $SRS_WORKDIR/auto/reset_module.sh && . $SRS_MODULE/config

@ -96,6 +96,13 @@ srs_error_t do_main(int argc, char** argv, char** envp)
// TODO: Might fail if change working directory.
_srs_binary = argv[0];
// For sanitizer on macOS, to avoid the warning on startup.
#if defined(SRS_OSX) && defined(SRS_SANITIZER)
if (!getenv("MallocNanoZone")) {
fprintf(stderr, "Asan: Please setup the env MallocNanoZone=0 to disable the warning, see https://stackoverflow.com/a/70209891/17679565\n");
}
#endif
// Initialize global and thread-local variables.
if ((err = srs_global_initialize()) != srs_success) {
return srs_error_wrap(err, "global init");

Loading…
Cancel
Save