Stream: t-compiler/help

Topic: stage0 windows build failure


Quy Nguyen (Jul 24 2020 at 21:10, on Zulip):

Hello, first cloned the rust repo to try and get a build working. Backtrace says the error is cmake::fail, so it might be the unresolved symbols? I'm on windows 10 with VS 2019 and the cmake tools installed.

stack backtrace:
   0: backtrace::backtrace::trace_unsynchronized
             at C:\Users\VssAdministrator\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-0.3.46\src\backtrace\mod.rs:66
   1: std::sys_common::backtrace::_print_fmt
             at /rustc/e51b714db8ff82ac38ea7c6742d6f5480e2e77bd\/src\libstd\sys_common\backtrace.rs:78
   2: std::sys_common::backtrace::_print::{{impl}}::fmt
             at /rustc/e51b714db8ff82ac38ea7c6742d6f5480e2e77bd\/src\libstd\sys_common\backtrace.rs:59
   3: core::fmt::write
             at /rustc/e51b714db8ff82ac38ea7c6742d6f5480e2e77bd\/src\libcore\fmt\mod.rs:1076
   4: std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
             at /rustc/e51b714db8ff82ac38ea7c6742d6f5480e2e77bd\/src\libstd\io\mod.rs:1537
   5: std::sys_common::backtrace::_print
             at /rustc/e51b714db8ff82ac38ea7c6742d6f5480e2e77bd\/src\libstd\sys_common\backtrace.rs:62
   6: std::sys_common::backtrace::print
             at /rustc/e51b714db8ff82ac38ea7c6742d6f5480e2e77bd\/src\libstd\sys_common\backtrace.rs:49
   7: std::panicking::default_hook::{{closure}}
             at /rustc/e51b714db8ff82ac38ea7c6742d6f5480e2e77bd\/src\libstd\panicking.rs:198
   8: std::panicking::default_hook
             at /rustc/e51b714db8ff82ac38ea7c6742d6f5480e2e77bd\/src\libstd\panicking.rs:217
   9: std::panicking::rust_panic_with_hook
             at /rustc/e51b714db8ff82ac38ea7c6742d6f5480e2e77bd\/src\libstd\panicking.rs:526
  10: std::panicking::begin_panic_handler
             at /rustc/e51b714db8ff82ac38ea7c6742d6f5480e2e77bd\/src\libstd\panicking.rs:437
  11: std::panicking::begin_panic_fmt
             at /rustc/e51b714db8ff82ac38ea7c6742d6f5480e2e77bd\/src\libstd\panicking.rs:391
  12: cmake::fail
             at C:\Users\quydx\.cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.42\src\lib.rs:861
  13: cmake::run
             at C:\Users\quydx\.cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.42\src\lib.rs:839
  14: cmake::Config::build
             at C:\Users\quydx\.cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.42\src\lib.rs:745
  15: bootstrap::native::{{impl}}::run
             at .\src\bootstrap\native.rs:333
  16: bootstrap::builder::Builder::ensure<bootstrap::native::Llvm>
             at .\src\bootstrap\builder.rs:1379
  17: bootstrap::compile::rustc_cargo_env
             at .\src\bootstrap\compile.rs:576
  18: bootstrap::compile::rustc_cargo
             at .\src\bootstrap\compile.rs:528
  19: bootstrap::compile::{{impl}}::run
             at .\src\bootstrap\compile.rs:499
  20: bootstrap::builder::Builder::ensure<bootstrap::compile::Rustc>
             at .\src\bootstrap\builder.rs:1379
  21: bootstrap::compile::{{impl}}::run
             at .\src\bootstrap\compile.rs:780
  22: bootstrap::builder::Builder::ensure<bootstrap::compile::Assemble>
             at .\src\bootstrap\builder.rs:1379
  23: bootstrap::builder::Builder::compiler
             at .\src\bootstrap\builder.rs:582
  24: bootstrap::compile::{{impl}}::run
             at .\src\bootstrap\compile.rs:773
  25: bootstrap::builder::Builder::ensure<bootstrap::compile::Assemble>
             at .\src\bootstrap\builder.rs:1379
  26: bootstrap::builder::Builder::compiler
             at .\src\bootstrap\builder.rs:582
  27: bootstrap::compile::{{impl}}::make_run
             at .\src\bootstrap\compile.rs:48
  28: bootstrap::builder::StepDescription::maybe_run
             at .\src\bootstrap\builder.rs:189
  29: bootstrap::builder::StepDescription::run
             at .\src\bootstrap\builder.rs:211
  30: bootstrap::builder::Builder::run_step_descriptions
             at .\src\bootstrap\builder.rs:574
  31: bootstrap::builder::Builder::execute_cli
             at .\src\bootstrap\builder.rs:565
  32: bootstrap::Build::build
             at .\src\bootstrap\lib.rs:491
  33: bootstrap::main
             at .\src\bootstrap\bin\main.rs:15
  34: std::rt::lang_start::{{closure}}<tuple<>>
             at /rustc/e51b714db8ff82ac38ea7c6742d6f5480e2e77bd\src\libstd\rt.rs:67
  35: std::rt::lang_start_internal::{{closure}}
             at /rustc/e51b714db8ff82ac38ea7c6742d6f5480e2e77bd\/src\libstd\rt.rs:52
  36: std::panicking::try::do_call
             at /rustc/e51b714db8ff82ac38ea7c6742d6f5480e2e77bd\/src\libstd\panicking.rs:348
  37: std::panicking::try
             at /rustc/e51b714db8ff82ac38ea7c6742d6f5480e2e77bd\/src\libstd\panicking.rs:325
  38: std::panic::catch_unwind
             at /rustc/e51b714db8ff82ac38ea7c6742d6f5480e2e77bd\/src\libstd\panic.rs:394
  39: std::rt::lang_start_internal
             at /rustc/e51b714db8ff82ac38ea7c6742d6f5480e2e77bd\/src\libstd\rt.rs:51
  40: std::rt::lang_start<tuple<>>
             at /rustc/e51b714db8ff82ac38ea7c6742d6f5480e2e77bd\src\libstd\rt.rs:67
  41: main
  42: invoke_main
             at d:\A01\_work\6\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  43: __scrt_common_main_seh
             at d:\A01\_work\6\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  44: BaseThreadInitThunk
  45: RtlUserThreadStart
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

https://hastebin.com/yilokumeqa.coffeescript

Joshua Nelson (Jul 24 2020 at 21:26, on Zulip):

This is an error building llvm from source. Have you considered using a system llvm instead? Not sure how hard that is on windows: https://rustc-dev-guide.rust-lang.org/building/suggested.html#building-with-system-llvm

Joshua Nelson (Jul 24 2020 at 21:27, on Zulip):

the relevant error message looks like https://hastebin.com/cagireyafu.rb

Quy Nguyen (Jul 24 2020 at 21:35, on Zulip):

Can I just grab llvm 10 from their website?

Joshua Nelson (Jul 24 2020 at 21:36, on Zulip):

possibly, as long as you can get llvm-config in your environment I _think_ things will just work

Quy Nguyen (Jul 25 2020 at 01:08, on Zulip):

Had to do some stuff with vcpkg, but it works now, thanks! LLVM doesn't ship the config in the precompiled bins sadly.

Joshua Nelson (Jul 25 2020 at 01:10, on Zulip):

yay! glad it's working :)

Quy Nguyen (Jul 25 2020 at 01:37, on Zulip):

I lied :(
Actually linking it gives me a bunch of notes

  = note: librustc_llvm-1e5f6b2d41c05068.rlib(X86Disassembler.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in librustc_llvm-1e5f6b2d41c05068.rlib(Linker.o)
          librustc_llvm-1e5f6b2d41c05068.rlib(X86AsmParser.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in librustc_llvm-1e5f6b2d41c05068.rlib(Linker.o)
          librustc_llvm-1e5f6b2d41c05068.rlib(X86WinEHState.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in librustc_llvm-1e5f6b2d41c05068.rlib(Linker.o)

And errors

          librustc_llvm-1e5f6b2d41c05068.rlib(MachineBasicBlock.cpp.obj) : error LNK2019: unresolved external symbol __imp_rint referenced in function "public: void __cdecl llvm::MachineBasicBlock::print(class llvm::raw_ostream &,class llvm::ModuleSlotTracker &,class llvm::SlotIndexes const *,bool)const " (?print@MachineBasicBlock@llvm@@QEBAXAEAVraw_ostream@2@AEAVModuleSlotTracker@2@PEBVSlotIndexes@2@_N@Z)
          librustc_llvm-1e5f6b2d41c05068.rlib(BranchProbability.cpp.obj) : error LNK2001: unresolved external symbol __imp_rint
          librustc_llvm-1e5f6b2d41c05068.rlib(SimplifyLibCalls.cpp.obj) : error LNK2019: unresolved external symbol __imp_log2 referenced in function "private: class llvm::Value * __cdecl llvm::LibCallSimplifier::replacePowWithExp(class llvm::CallInst *,class llvm::IRBuilder<class llvm::ConstantFolder,class llvm::IRBuilderDefaultInserter> &)" (?replacePowWithExp@LibCallSimplifier@llvm@@AEAAPEAVValue@2@PEAVCallInst@2@AEAV?$IRBuilder@VConstantFolder@llvm@@VIRBuilderDefaultInserter@2@@2@@Z)
          librustc_llvm-1e5f6b2d41c05068.rlib(ConstantFolding.cpp.obj) : error LNK2001: unresolved external symbol __imp_log2
          librustc_llvm-1e5f6b2d41c05068.rlib(SimplifyLibCalls.cpp.obj) : error LNK2019: unresolved external symbol __imp_log2f referenced in function "private: class llvm::Value * __cdecl llvm::LibCallSimplifier::replacePowWithExp(class llvm::CallInst *,class llvm::IRBuilder<class llvm::ConstantFolder,class llvm::IRBuilderDefaultInserter> &)" (?replacePowWithExp@LibCallSimplifier@llvm@@AEAAPEAVValue@2@PEAVCallInst@2@AEAV?$IRBuilder@VConstantFolder@llvm@@VIRBuilderDefaultInserter@2@@2@@Z)
          librustc_llvm-1e5f6b2d41c05068.rlib(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@?A0xa3245e41@@YAPEAVConstant@llvm@@P6ANNN@ZNNPEAVType@3@@Z)
          librustc_llvm-1e5f6b2d41c05068.rlib(InstrProf.cpp.obj) : error LNK2019: unresolved external symbol __imp_strncpy referenced in function "public: void __cdecl llvm::OverlapStats::dump(class llvm::raw_fd_ostream &)const " (?dump@OverlapStats@llvm@@QEBAXAEAVraw_fd_ostream@2@@Z)
          librustc_llvm-1e5f6b2d41c05068.rlib(WindowsResource.cpp.obj) : error LNK2001: unresolved external symbol __imp_strncpy
          librustc_llvm-1e5f6b2d41c05068.rlib(XCOFFObjectWriter.cpp.obj) : error LNK2001: unresolved external symbol __imp_strncpy
          librustc_llvm-1e5f6b2d41c05068.rlib(WinCOFFObjectWriter.cpp.obj) : error LNK2019: unresolved external symbol __imp__time64 referenced in function "public: virtual unsigned __int64 __cdecl `anonymous namespace'::WinCOFFObjectWriter::writeObject(class llvm::MCAssembler &,class llvm::MCAsmLayout const &)" (?writeObject@WinCOFFObjectWriter@?A0x108a2793@@UEAA_KAEAVMCAssembler@llvm@@AEBVMCAsmLayout@4@@Z)
          librustc_llvm-1e5f6b2d41c05068.rlib(Program.cpp.obj) : error LNK2019: unresolved external symbol __imp__setmode referenced in function "class std::error_code __cdecl llvm::sys::ChangeStdinToBinary(void)" (?ChangeStdinToBinary@sys@llvm@@YA?AVerror_code@std@@XZ)
          librustc_llvm-1e5f6b2d41c05068.rlib(Process.cpp.obj) : error LNK2019: unresolved external symbol __imp__heapwalk referenced in function "public: static unsigned __int64 __cdecl llvm::sys::Process::GetMallocUsage(void)" (?GetMallocUsage@Process@sys@llvm@@SA_KXZ)
          librustc_llvm-1e5f6b2d41c05068.rlib(Process.cpp.obj) : error LNK2019: unresolved external symbol __imp_close referenced in function "public: static class std::error_code __cdecl llvm::sys::Process::SafelyCloseFileDescriptor(int)" (?SafelyCloseFileDescriptor@Process@sys@llvm@@SA?AVerror_code@std@@H@Z)
          librustc_llvm-1e5f6b2d41c05068.rlib(Path.cpp.obj) : error LNK2001: unresolved external symbol __imp_close
          OLDNAMES.lib(close.obi) : error LNK2001: unresolved external symbol __imp_close
          librustc_llvm-1e5f6b2d41c05068.rlib(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)
          librustc_llvm-1e5f6b2d41c05068.rlib(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
          librustc_llvm-1e5f6b2d41c05068.rlib(Path.cpp.obj) : error LNK2019: unresolved external symbol __imp_write 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)
          librustc_llvm-1e5f6b2d41c05068.rlib(raw_ostream.cpp.obj) : error LNK2001: unresolved external symbol __imp_write
          librustc_llvm-1e5f6b2d41c05068.rlib(ErrorHandling.cpp.obj) : error LNK2001: unresolved external symbol __imp_write
          OLDNAMES.lib(write.obi) : error LNK2001: unresolved external symbol __imp_write
          librustc_llvm-1e5f6b2d41c05068.rlib(Errno.cpp.obj) : error LNK2019: unresolved external symbol __imp_strerror_s referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl llvm::sys::StrError(int)" (?StrError@sys@llvm@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z)
          librustc_llvm-1e5f6b2d41c05068.rlib(raw_ostream.cpp.obj) : error LNK2019: unresolved external symbol __imp_lseek referenced in function "public: __cdecl llvm::raw_fd_ostream::raw_fd_ostream(int,bool,bool)" (??0raw_fd_ostream@llvm@@QEAA@H_N0@Z)
          OLDNAMES.lib(lseek.obi) : error LNK2001: unresolved external symbol __imp_lseek
          librustc_llvm-1e5f6b2d41c05068.rlib(NativeFormatting.cpp.obj) : error LNK2019: unresolved external symbol __imp__fpclass referenced in function "void __cdecl llvm::write_double(class llvm::raw_ostream &,double,enum llvm::FloatStyle,class llvm::Optional<unsigned __int64>)" (?write_double@llvm@@YAXAEAVraw_ostream@1@NW4FloatStyle@1@V?$Optional@_K@1@@Z)
          librustc_llvm-1e5f6b2d41c05068.rlib(JSON.cpp.obj) : error LNK2019: unresolved external symbol __imp_modf referenced in function "public: class llvm::Optional<__int64> __cdecl llvm::json::Value::getAsInteger(void)const " (?getAsInteger@Value@json@llvm@@QEBA?AV?$Optional@_J@3@XZ)
          librustc_llvm-1e5f6b2d41c05068.rlib(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@@YAAEAVraw_ostream@0@AEAV10@V?$time_point@Usystem_clock@chrono@std@@V?$duration@_JU?$ratio@$00$0DLJKMKAA@@std@@@23@@chrono@std@@@Z)
          C:\Users\quydx\Documents\Code\rust\build\x86_64-pc-windows-msvc\stage0-rustc\x86_64-pc-windows-msvc\release\deps\rustc_driver-f94565c51c798522.dll : fatal error LNK1120: 17 unresolved externals
Joshua Nelson (Jul 25 2020 at 01:41, on Zulip):

that looks like the same error as before :thinking:

Joshua Nelson (Jul 25 2020 at 01:43, on Zulip):

I don't use windows so I'm not sure how much I can help :/ can you compile normal C programs?

lzutao (Jul 25 2020 at 02:45, on Zulip):

it seems like the llvm build is success but installation step is not

Quy Nguyen (Jul 25 2020 at 03:18, on Zulip):

So it looks like the vcpkg install doesn't support shared libs for LLVM, and they provide this link, which just confuses me hmm.

Quy Nguyen (Jul 25 2020 at 18:07, on Zulip):

Ok, I got it to work on wsl, but python3 x.py test gives me a bunch of tidy errors.

tidy error: binary checked into source: /mnt/c/Users/quydx/rust/src/doc/guide-ffi.md
tidy error: binary checked into source: /mnt/c/Users/quydx/rust/src/doc/guide-macros.md
tidy error: binary checked into source: /mnt/c/Users/quydx/rust/src/doc/guide-ownership.md
tidy error: binary checked into source: /mnt/c/Users/quydx/rust/src/doc/guide-plugins.md
tidy error: binary checked into source: /mnt/c/Users/quydx/rust/src/doc/guide-pointers.md
tidy error: binary checked into source: /mnt/c/Users/quydx/rust/src/doc/guide-strings.md
tidy error: binary checked into source: /mnt/c/Users/quydx/rust/src/doc/guide-tasks.md
tidy error: binary checked into source: /mnt/c/Users/quydx/rust/src/doc/guide-testing.md
tidy error: binary checked into source: /mnt/c/Users/quydx/rust/src/doc/guide-unsafe.md
tidy error: binary checked into source: /mnt/c/Users/quydx/rust/src/doc/guide.md
tidy error: binary checked into source: /mnt/c/Users/quydx/rust/src/doc/index.md
tidy error: binary checked into source: /mnt/c/Users/quydx/rust/src/doc/intro.md
tidy error: binary checked into source: /mnt/c/Users/quydx/rust/src/doc/man/rustc.1
tidy error: binary checked into source: /mnt/c/Users/quydx/rust/src/doc/man/rustdoc.1
tidy error: binary checked into source: /mnt/c/Users/quydx/rust/src/doc/not_found.md
tidy error: binary checked into source: /mnt/c/Users/quydx/rust/src/doc/redirect.inc
tidy error: binary checked into source: /mnt/c/Users/quydx/rust/src/doc/reference.md
Quy Nguyen (Jul 25 2020 at 18:15, on Zulip):

Hmm ok found the bug and made a PR. Seems like Windows is not used often around here :P

Last update: Sep 28 2020 at 16:00UTC