It’s worth mentioning, that compiling with verbose flag can give some insight 
on what libraries/options clang-cl passes to the linker:

clang-cl -v -fsanitize=address main.cpp

Иван Комиссаров

> 28 нояб. 2019 г., в 17:23, Иван Комиссаров <abba...@gmail.com> написал(а):
> 
> I did a small research and was able to compile a small example with clang-cl 
> and asan.
> Here are the flags I had to set manually:
> 
> cpp.optimization: "none"
>     cpp.cxxFlags: [
>         "/MT",
>         "-fsanitize=address",
>     ]
>     cpp.linkerFlags: [
>         
> "-wholearchive:C:\\Developer\\LLVM\\lib\\clang\\8.0.0\\lib\\windows\\clang_rt.asan-x86_64.lib",
>         
> "-wholearchive:C:\\Developer\\LLVM\\lib\\clang\\8.0.0\\lib\\windows\\clang_rt.asan_cxx-x86_64.lib",
>     ]
>     cpp.staticLibraries: [
>         
> "C:\\Developer\\LLVM\\lib\\clang\\8.0.0\\lib\\windows\\clang_rt.asan-x86_64.lib",
>         
> "C:\\Developer\\LLVM\\lib\\clang\\8.0.0\\lib\\windows\\clang_rt.asan_cxx-x86_64.lib",
>     ]
> 
> Probably, we should add some support for that in Qbs...
> The problem is that qbs calls the linker directly (which is not the same 
> clang-cl uses), maybe it’s worth using clang-cl for linking... or just add 
> support for the usual clang with msvc ABI (I have plans for that for 1.16)
> 
> Иван Комиссаров
> 
>>> 28 нояб. 2019 г., в 15:53, Christian Kandeler <christian.kande...@qt.io> 
>>> написал(а):
>>> 
>> On Thu, 28 Nov 2019 18:58:54 +0500
>> Dan Pat <danni...@gmail.com> wrote:
>> 
>>> Hello. I am trying to use Asan in my project (windows 10, clang-cl).
>>> There's a requirement for the Asan import library to appear first in the
>>> linker's list of import libraries. 
>> 
>> Who imposes that requirement and why?
>> 
>>> I cannot seem to find a way to achieve this with qbs. Any suggestions?
>> 
>> If you are sure it's really, really needed, you can use a Properties item in 
>> your product with e.g. cpp.dynamicLibraries 
>> (https://doc.qt.io/qbs/qml-qbslanguageitems-properties.html#overrideListProperties-prop),
>>  but then you will have to list *all* libraries there.
>> 
>> 
>> Christian
>> _______________________________________________
>> Qbs mailing list
>> Qbs@qt-project.org
>> https://lists.qt-project.org/listinfo/qbs
_______________________________________________
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs

Reply via email to