1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-12 19:31:53 +00:00

Asan: Refine asan warning message for macOS.

PICK 7bdb7270cf
This commit is contained in:
winlin 2022-12-31 19:27:21 +08:00
parent 3f7c4a7ff4
commit 6ad7787c14
4 changed files with 15 additions and 1 deletions

View file

@ -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}

View file

@ -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
View file

@ -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

View file

@ -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");