Linker 在Windows链接器上编译LLVM Kaleidoscope时出错

Linker 在Windows链接器上编译LLVM Kaleidoscope时出错,linker,clang,llvm,clang++,Linker,Clang,Llvm,Clang++,我最近使用vcpkg在我的Windows机器上安装了LLVM,并尝试使用Clang编译万花筒示例。这是我尝试在PowerShell上运行的命令: clang-cl toy.cpp -I "C:\src\vcpkg\installed\x86-windows\include" -I "C:\src\vcpkg\installed\x86-windows\lib\clang\11.0.0\include" -L "C:\src\vcpkg\insta

我最近使用vcpkg在我的Windows机器上安装了LLVM,并尝试使用Clang编译万花筒示例。这是我尝试在PowerShell上运行的命令:

clang-cl toy.cpp -I "C:\src\vcpkg\installed\x86-windows\include" -I "C:\src\vcpkg\installed\x86-windows\lib\clang\11.0.0\include" -L "C:\src\vcpkg\installed\x86-windows\lib\*.lib" "$(llvm-config --cxxflags --ldflags --system-libs --libs)" -O3 -o toy -v
但由于以下错误,它失败了:

    LLVMSupport.lib(raw_ostream.cpp.obj) : error LNK2019: unresolved external symbol __imp__lseek referenced in function "public: __thiscall llvm::raw_fd_ostream::raw_fd_ostream(int,bool,bool)" (??0raw_fd_ostream@llvm@@QAE@H_N0@Z)
oldnames.lib(lseek.obi) : error LNK2001: unresolved external symbol __imp__lseek
LLVMSupport.lib(raw_ostream.cpp.obj) : error LNK2019: unresolved external symbol __imp__write referenced in function "private: virtual void __thiscall llvm::raw_fd_ostream::write_impl(char const *,unsigned int)" (?write_impl@raw_fd_ostream@llvm@@EAEXPBDI@Z)
LLVMSupport.lib(ErrorHandling.cpp.obj) : error LNK2001: unresolved external symbol __imp__write
LLVMSupport.lib(Path.cpp.obj) : error LNK2001: unresolved external symbol __imp__write
oldnames.lib(write.obi) : error LNK2001: unresolved external symbol __imp__write
LLVMSupport.lib(APInt.cpp.obj) : error LNK2019: unresolved external symbol __imp__round referenced in function "public: class llvm::APInt __thiscall llvm::APInt::sqrt(void)const " (?sqrt@APInt@llvm@@QBE?AV12@XZ)
LLVMSupport.lib(Path.cpp.obj) : error LNK2019: unresolved external symbol __imp___chsize_s referenced in function "class std::error_code __cdecl llvm::sys::fs::resize_file(int,unsigned __int64)" (?resize_file@fs@sys@llvm@@YA?AVerror_code@std@@H_K@Z)
LLVMSupport.lib(Path.cpp.obj) : error LNK2019: unresolved external symbol __imp__close referenced in function "class std::error_code __cdecl llvm::sys::fs::copy_file(class llvm::Twine const &,class llvm::Twine const &)" (?copy_file@fs@sys@llvm@@YA?AVerror_code@std@@ABVTwine@3@0@Z)
LLVMSupport.lib(Process.cpp.obj) : error LNK2001: unresolved external symbol __imp__close
oldnames.lib(close.obi) : error LNK2001: unresolved external symbol __imp__close
LLVMSupport.lib(Path.cpp.obj) : error LNK2019: unresolved external symbol __imp__read referenced in function "class std::error_code __cdecl llvm::sys::fs::copy_file_internal(int,int)" (?copy_file_internal@fs@sys@llvm@@YA?AVerror_code@std@@HH@Z)
oldnames.lib(read.obi) : error LNK2001: unresolved external symbol __imp__read
LLVMSupport.lib(Chrono.cpp.obj) : error LNK2019: unresolved external symbol __imp___localtime64_s referenced in function "class llvm::raw_ostream & __cdecl llvm::operator<<(class llvm::raw_ostream &,class std::chrono::time_point<struct std::chrono::system_clock,class std::chrono::duration<__int64,struct std::ratio<1,1000000000> > >)" (??6llvm@@YAAAVraw_ostream@0@AAV10@V?$time_point@Usystem_clock@chrono@std@@V?$duration@_JU?$ratio@$00$0DLJKMKAA@@std@@@23@@chrono@std@@@Z)
LLVMSupport.lib(Threading.cpp.obj) : error LNK2019: unresolved external symbol __imp___beginthreadex referenced in function "void __cdecl llvm::llvm_execute_on_thread(void (__cdecl*)(void *),void *,class llvm::Optional<unsigned int>)" (?llvm_execute_on_thread@llvm@@YAXP6AXPAX@Z0V?$Optional@I@1@@Z)
LLVMSupport.lib(Process.cpp.obj) : error LNK2019: unresolved external symbol __imp__srand referenced in function "public: static unsigned int __cdecl llvm::sys::Process::GetRandomNumber(void)" (?GetRandomNumber@Process@sys@llvm@@SAIXZ)
LLVMSupport.lib(Process.cpp.obj) : error LNK2019: unresolved external symbol __imp__rand referenced in function "public: static unsigned int __cdecl llvm::sys::Process::GetRandomNumber(void)" (?GetRandomNumber@Process@sys@llvm@@SAIXZ)
LLVMSupport.lib(Process.cpp.obj) : error LNK2019: unresolved external symbol __imp___heapwalk referenced in function "public: static unsigned int __cdecl llvm::sys::Process::GetMallocUsage(void)" (?GetMallocUsage@Process@sys@llvm@@SAIXZ)
LLVMSupport.lib(JSON.cpp.obj) : error LNK2019: unresolved external symbol __imp__modf referenced in function "public: class llvm::Optional<__int64> __thiscall llvm::json::Value::getAsInteger(void)const " (?getAsInteger@Value@json@llvm@@QBE?AV?$Optional@_J@3@XZ)
MSVCRT.lib(chandler4gs.obj) : error LNK2019: unresolved external symbol __except_handler4_common referenced in function __except_handler4
LLVMAnalysis.lib(ConstantFolding.cpp.obj) : error LNK2019: unresolved external symbol __imp__log2 referenced in function "double __cdecl llvm::Log2(double)" (?Log2@llvm@@YANN@Z)
LLVMTransformUtils.lib(SimplifyLibCalls.cpp.obj) : error LNK2001: unresolved external symbol __imp__log2
LLVMAnalysis.lib(ConstantFolding.cpp.obj) : error LNK2019: unresolved external symbol __imp__feclearexcept referenced in function "class llvm::Constant * __cdecl `anonymous namespace'::ConstantFoldBinaryFP(double (__cdecl*)(double,double),double,double,class llvm::Type *)" (?ConstantFoldBinaryFP@?A0xa5c0da70@@YAPAVConstant@llvm@@P6ANNN@ZNNPAVType@3@@Z)
LLVMCodeGen.lib(MachineBasicBlock.cpp.obj) : error LNK2019: unresolved external symbol __imp__rint referenced in function "public: void __thiscall llvm::MachineBasicBlock::print(class llvm::raw_ostream &,class llvm::ModuleSlotTracker &,class llvm::SlotIndexes const *,bool)const " (?print@MachineBasicBlock@llvm@@QBEXAAVraw_ostream@2@AAVModuleSlotTracker@2@PBVSlotIndexes@2@_N@Z)
LLVMSupport.lib(BranchProbability.cpp.obj) : error LNK2001: unresolved external symbol __imp__rint
LLVMMC.lib(WinCOFFObjectWriter.cpp.obj) : error LNK2019: unresolved external symbol __imp___time64 referenced in function "public: virtual unsigned __int64 __thiscall `anonymous namespace'::WinCOFFObjectWriter::writeObject(class llvm::MCAssembler &,class llvm::MCAsmLayout const &)" (?writeObject@WinCOFFObjectWriter@?A0x49465420@@UAE_KAAVMCAssembler@llvm@@ABVMCAsmLayout@4@@Z)
LLVMMC.lib(XCOFFObjectWriter.cpp.obj) : error LNK2019: unresolved external symbol __imp__strncpy referenced in function "public: __thiscall `anonymous namespace'::Section::Section(char const *,enum llvm::XCOFF::SectionTypeFlags,bool,class std::deque<class std::deque<struct `anonymous namespace'::ControlSection,class std::allocator<struct `anonymous namespace'::ControlSection> > *,class std::allocator<class std::deque<struct `anonymous namespace'::ControlSection,class std::allocator<struct `anonymous namespace'::ControlSection> > *> >)" (??0Section@?A0x015d1cc9@@QAE@PBDW4SectionTypeFlags@XCOFF@llvm@@_NV?$deque@PAV?$deque@UControlSection@?A0x015d1cc9@@V?$allocator@UControlSection@?A0x015d1cc9@@@std@@@std@@V?$allocator@PAV?$deque@UControlSection@?A0x015d1cc9@@V?$allocator@UControlSection@?A0x015d1cc9@@@std@@@std@@@2@@std@@@Z)
LLVMProfileData.lib(InstrProf.cpp.obj) : error LNK2001: unresolved external symbol __imp__strncpy
LLVMTransformUtils.lib(SimplifyLibCalls.cpp.obj) : error LNK2019: unresolved external symbol __imp__log2f referenced in function "private: class llvm::Value * __thiscall llvm::LibCallSimplifier::replacePowWithExp(class llvm::CallInst *,class llvm::IRBuilderBase &)" (?replacePowWithExp@LibCallSimplifier@llvm@@AAEPAVValue@2@PAVCallInst@2@AAVIRBuilderBase@2@@Z)
toy.exe : fatal error LNK1120: 19 unresolved externals
LLVMSupport.lib(raw_ostream.cpp.obj):错误LNK2019:函数“public:u thiscall llvm::raw_fd_ostream::raw_fd_ostream(int,bool,bool)”中引用的未解析外部符号u imp_ulseek(??0raw_fd_ostream@llvm@@QAE@H_N0@Z)
oldnames.lib(lseek.obi):错误LNK2001:未解析的外部符号_imp__lseek
LLVMSupport.lib(raw_ostream.cpp.obj):错误LNK2019:函数“private:virtual void\u thiscall llvm::raw_fd\u ostream::write_impl(char const*,unsigned int)”中引用了未解析的外部符号(write)(?write_impl@raw_fd_ostream@llvm@@EAEXPBDI@Z)
LLVMSupport.lib(ErrorHandling.cpp.obj):错误LNK2001:未解析的外部符号
LLVMSupport.lib(Path.cpp.obj):错误LNK2001:未解析的外部符号
oldnames.lib(write.obi):错误LNK2001:未解析的外部符号\uuu imp\uu write
LLVMSupport.lib(APInt.cpp.obj):错误LNK2019:函数“public:class llvm::APInt u thiscall llvm::APInt::sqrt(void)const”中引用了未解析的外部符号\uuu imp\uu round”(?sqrt@APInt@llvm@@QBE?AV12@XZ)
LLVMSupport.lib(Path.cpp.obj):错误LNK2019:函数“class std::error\u code\uuu cdecl llvm::sys::fs::resize_file(int,unsigned u int64)”中引用的未解析外部符号(?resize)_file@fs@sys@llvm@@是吗?艾弗罗_code@std@@H_K@Z)
LLVMSupport.lib(Path.cpp.obj):错误LNK2019:函数“class std::error\u code\uu cdecl llvm::sys::fs::copy_file(class llvm::Twine const&,class llvm::Twine const&)”中引用了未解析的外部符号\uu imp\uu close(?复制_file@fs@sys@llvm@@是吗?艾弗罗_code@std@@ABVTwine@3@0@Z)
LLVMSupport.lib(Process.cpp.obj):错误LNK2001:未解析的外部符号\uuu imp\uu关闭
oldnames.lib(close.obi):错误LNK2001:未解析的外部符号\uuu imp\uu close
LLVMSupport.lib(Path.cpp.obj):错误LNK2019:函数“class std::error\u code\uu cdecl llvm::sys::fs::copy\u file\u internal(int,int)”中引用了未解析的外部符号\uuu imp\uu read)(?copy\u file_internal@fs@sys@llvm@@是吗?艾弗罗_code@std@@HH@Z)
oldnames.lib(read.obi):错误LNK2001:未解析的外部符号\uuu imp\uu read
LLVMSupport.lib(Chrono.cpp.obj):错误LNK2019:未解析的外部符号_imp___localtime64_在函数“class llvm::raw_ostream&__cdeclllvm::operator”中引用