<div dir="ltr">I think "legacy" is the answer to most of your questions.<div><br></div><div>1. I think clang still uses ld by default, so clang-cl is similar. Besides, every build system we encountered migrating from MSVC calls `link` directly, and needed to be updated to call `lld-link`.</div><div><br></div><div>2. I think we should probably configure lld to find the clang resource directory. At the very least, clang-cl -fuse-ld=lld should add it.</div><div><br></div><div>3. I think this is because there is no clang spelling for the /MD & /MT flags, so we have to pick some CRT so that hello world links. You can work around it with -nodefaultlib and passing your own.</div><div><br></div><div>4. That's true, but that's been the case for every build system we've encountered.</div><div><br></div><div>So, I think there is room for improvement and better defaults.</div><div><br></div><div>Most options in clang are controlled by flags, not configure-time cmake options. From the clang developer perspective, this is good, clang is always a cross compiler and can do anything anywhere at runtime. But from a user or packager perspective, this is often painful. Users often write compiler wrapper scripts to fill in their preferred default options: default target, default include paths, default library paths, etc.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Feb 23, 2020 at 12:37 PM Максим Власов via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I'm getting trouble using clang with compiled libc++ on MSVC.<div>1. why clang chooses `link` over `lld-link` by default? I don't really wish to write `-fuse-ld=lld-link` every single time I build something.<br><div>2. why `lld-link` doesn't search inside default `lib` directory? I need to manually show him where it is although I put that binary in `<LLVM root>\lib\`</div><div>3. why clang invokes linker with `-defaultlib:libcmt`? I mean libc++ build guide under MSVC produces -MD version of either `libc++.lib` or `c++.lib`</div><div>4. Since (3), it's not possible to build anything without splitting compiler and linker calls - `clang` by default produces -MT versions of objects and linker fails to compose it with -MD library. No, `-dynamic` flag does not help either.</div></div><div>Any fixes to these? Can I config clang somehow except `--config` option?</div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>