ld.exe: cannot find -lasan ld.exe: cannot find -lubsan

  address-sanitizer, c++, clion

I am using Clion and I want to use ASAN address Sanitizer, when I compile the file with ASAN here I get the following errors:

c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: cannot find -lasan
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: cannot find -lubsan

Here is my CMakeLists.txt content:

cmake_minimum_required(VERSION 3.17)
project(untitled3)


set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "-Wall -Werror -Wsign-compare")

set(CMAKE_CXX_FLAGS_ASAN "-g -fsanitize=address,undefined -fno-sanitize-recover=all"
        CACHE STRING "Compiler flags in asan build"
        FORCE)

add_executable(untitled3 BinarySearchEasy.cpp)

Source: Windows Questions C++

LEAVE A COMMENT