Asan: Refine asan warning message for macOS.

PICK 7bdb7270cf
pull/3353/head
winlin 2 years ago
parent 3f7c4a7ff4
commit 6ad7787c14

@ -16,6 +16,6 @@ COPY . /srs
WORKDIR /srs/trunk
# Note that we must enable the gcc7 or link failed.
RUN ./configure --srt=on --gb28181=on --apm=on --h265=on --utest=on --gcov=on --sanitizer=off
RUN ./configure --srt=on --gb28181=on --apm=on --h265=on --utest=on --gcov=on --sanitizer=on
RUN make utest ${MAKEARGS}

@ -155,6 +155,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