mirror of https://github.com/milvus-io/milvus.git
fix: make asan avaiable when building milvus image (#37804)
issue: #35854 pr: #37041 - USE_ASAN will not enable the Debug mode. - replace USE_ASAN by `ldd` to make generate right so in milvus image. Signed-off-by: chyezh <chyezh@outlook.com> Co-authored-by: yellow-shine <sammy.huang@zilliz.com>pull/37833/head
parent
a10f95d71c
commit
ebfd917bb6
4
Makefile
4
Makefile
|
@ -30,8 +30,8 @@ endif
|
|||
use_asan = OFF
|
||||
ifeq ($(USE_ASAN), ON)
|
||||
use_asan =${USE_ASAN}
|
||||
CGO_LDFLAGS := $(shell go env CGO_LDFLAGS) -fsanitize=address -fno-omit-frame-pointer
|
||||
CGO_CFLAGS := $(shell go env CGO_CFLAGS) -fsanitize=address -fno-omit-frame-pointer
|
||||
CGO_LDFLAGS := $(shell go env CGO_LDFLAGS) -fno-stack-protector -fno-omit-frame-pointer -fno-var-tracking -fsanitize=address
|
||||
CGO_CFLAGS := $(shell go env CGO_CFLAGS) -fno-stack-protector -fno-omit-frame-pointer -fno-var-tracking -fsanitize=address
|
||||
MILVUS_GO_BUILD_TAGS := $(MILVUS_GO_BUILD_TAGS),use_asan
|
||||
endif
|
||||
|
||||
|
|
|
@ -131,8 +131,8 @@ if (LINUX OR MSYS)
|
|||
)
|
||||
if (USE_ASAN STREQUAL "ON")
|
||||
message( STATUS "Building Milvus Core Using AddressSanitizer")
|
||||
add_compile_options(-fno-omit-frame-pointer -fsanitize=address)
|
||||
add_link_options(-fno-omit-frame-pointer -fsanitize=address)
|
||||
add_compile_options(-fno-stack-protector -fno-omit-frame-pointer -fno-var-tracking -fsanitize=address)
|
||||
add_link_options(-fno-stack-protector -fno-omit-frame-pointer -fno-var-tracking -fsanitize=address)
|
||||
endif()
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
append_flags( CMAKE_CXX_FLAGS
|
||||
|
|
|
@ -137,7 +137,6 @@ while getopts "p:d:t:s:f:n:i:y:a:x:o:ulrcghzmebZ" arg; do
|
|||
if [[ ${ENV_VAL} == 'ON' ]]; then
|
||||
echo "Set USE_ASAN to ON"
|
||||
USE_ASAN="ON"
|
||||
BUILD_TYPE=Debug
|
||||
fi
|
||||
;;
|
||||
y)
|
||||
|
|
|
@ -24,8 +24,6 @@ cp $PWD"/internal/core/output/lib/"*.dylib* "$LIBRARY_PATH" 2>/dev/null || true
|
|||
cp $PWD"/internal/core/output/lib/"*.so* "$LIBRARY_PATH" || true
|
||||
cp $PWD"/internal/core/output/lib64/"*.so* "$LIBRARY_PATH" 2>/dev/null || true
|
||||
|
||||
if [ "$USE_ASAN" == "ON" ]; then
|
||||
for LIB_PATH in $(ldconfig -p | grep -E '(asan|atomic)' | awk '{print $NF}'); do
|
||||
cp "$LIB_PATH" "$LIBRARY_PATH" 2>/dev/null
|
||||
done
|
||||
fi
|
||||
for LIB_PATH in $(ldd ./bin/milvus | grep -E '(asan|atomic)' | awk '{print $3}'); do
|
||||
cp "$LIB_PATH" "$LIBRARY_PATH" 2>/dev/null
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue