llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.33k stars 11.7k forks source link

libcxx compliation issue with clang-cl #110415

Open ShuangLiu1992 opened 1 week ago

ShuangLiu1992 commented 1 week ago

building with the latest msvc 1914 with clang tools,

configure as shown in the docs

cmake -G Ninja -S runtimes -B build -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DLLVM_ENABLE_RUNTIMES=libcxx

getting erros like these

E:\projects\llvm-project\build\include\c++\v1\string(2272,1): error: explicit instantiation of 'insert' does not refer to a function template, variable template, member function, member class, or static data member
E:\projects\llvm-project\build\include\c++\v1\__string/extern_template_lists.h(46,85): note: expanded from macro '_LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST'
   46 |   _Func(_LIBCPP_EXPORTED_FROM_ABI basic_string<_CharType>& basic_string<_CharType>::insert(size_type, value_type const*, size_type)) \
      |                                                                                     ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
35 warnings and 20 errors generated.
ldionne commented 3 days ago

@mstorsjo Any idea? We do the same thing in our CI setup and it works for us?

mstorsjo commented 3 days ago

The setup seems correct in general, and this is indeed what we do test in CI.

building with the latest msvc 1914 with clang tools,

Sorry, which version of MSVC is this, and more importantly, which version of Clang is that? From looking at https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B#Internal_version_numbering, "msvc 1914" looks like "Visual Studio 2017 version 15.7", which is quite old. Do you use a Clang version that shipped along with that as well, or what version of Clang are you using?