Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot compile rustc stage 2 for target "thumbv7a-pc-windows-msvc" because of unresolved symbol __udivsi3, __divsi3, etc.. #292

Closed
chandde opened this issue May 15, 2019 · 10 comments

Comments

@chandde
Copy link

chandde commented May 15, 2019

Please find the full output below, I came across (read: googled) this PR #290 that appears to be fixing similar issue, what does it take to fix this for thumbv7a-pc-windows-msvc? After I fix "something" in compiler-builtins, how do I get rustc compiling to take my fixes, is there a way I can try my local fix for compiler-builtins and have it utilized by my local rustc compiling?

Building stage2 std artifacts (x86_64-pc-windows-msvc -> thumbv7a-pc-windows-msvc)
running: "E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage0\\bin\\cargo.exe" "build" "--target" "thumbv7a-pc-windows-msvc" "-j" "12" "--release" "--features" "panic-unwind backtrace" "--manifest-path" "E:\\git\\rust\\src/libstd/Cargo.toml" "--message-format" "json"
   Compiling cc v1.0.35
   Compiling core v0.0.0 (E:\git\rust\src\libcore)
   Compiling libc v0.2.54
   Compiling unwind v0.0.0 (E:\git\rust\src\libunwind)
   Compiling compiler_builtins v0.1.12
   Compiling backtrace-sys v0.1.27
   Compiling std v0.0.0 (E:\git\rust\src\libstd)
   Compiling rustc-std-workspace-core v1.0.0 (E:\git\rust\src\tools\rustc-std-workspace-core)
   Compiling alloc v0.0.0 (E:\git\rust\src\liballoc)
   Compiling rustc-demangle v0.1.10
   Compiling panic_abort v0.0.0 (E:\git\rust\src\libpanic_abort)
   Compiling rustc-std-workspace-alloc v1.0.0 (E:\git\rust\src\tools\rustc-std-workspace-alloc)
   Compiling panic_unwind v0.0.0 (E:\git\rust\src\libpanic_unwind)
   Compiling hashbrown v0.3.0
error: linking with `link.exe` failed: exit code: 1120=============>   ] 23/24: std
  |
  = note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX64\\arm\\link.exe" "/NOLOGO" "/NXCOMPAT" "/OPT:NOLBR" "/LIBPATH:E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage2\\lib\\rustlib\\thumbv7a-pc-windows-msvc\\lib" "E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage2-std\\thumbv7a-pc-windows-msvc\\release\\deps\\std-98cf5a568f42e09b.std.63tu9e3h-cgu.0.rcgu.o" "E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage2-std\\thumbv7a-pc-windows-msvc\\release\\deps\\std-98cf5a568f42e09b.std.63tu9e3h-cgu.1.rcgu.o" "E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage2-std\\thumbv7a-pc-windows-msvc\\release\\deps\\std-98cf5a568f42e09b.std.63tu9e3h-cgu.10.rcgu.o" "E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage2-std\\thumbv7a-pc-windows-msvc\\release\\deps\\std-98cf5a568f42e09b.std.63tu9e3h-cgu.11.rcgu.o" "E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage2-std\\thumbv7a-pc-windows-msvc\\release\\deps\\std-98cf5a568f42e09b.std.63tu9e3h-cgu.12.rcgu.o" "E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage2-std\\thumbv7a-pc-windows-msvc\\release\\deps\\std-98cf5a568f42e09b.std.63tu9e3h-cgu.13.rcgu.o" "E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage2-std\\thumbv7a-pc-windows-msvc\\release\\deps\\std-98cf5a568f42e09b.std.63tu9e3h-cgu.14.rcgu.o" "E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage2-std\\thumbv7a-pc-windows-msvc\\release\\deps\\std-98cf5a568f42e09b.std.63tu9e3h-cgu.15.rcgu.o" "E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage2-std\\thumbv7a-pc-windows-msvc\\release\\deps\\std-98cf5a568f42e09b.std.63tu9e3h-cgu.2.rcgu.o" "E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage2-std\\thumbv7a-pc-windows-msvc\\release\\deps\\std-98cf5a568f42e09b.std.63tu9e3h-cgu.3.rcgu.o" "E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage2-std\\thumbv7a-pc-windows-msvc\\release\\deps\\std-98cf5a568f42e09b.std.63tu9e3h-cgu.4.rcgu.o" "E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage2-std\\thumbv7a-pc-windows-msvc\\release\\deps\\std-98cf5a568f42e09b.std.63tu9e3h-cgu.5.rcgu.o" "E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage2-std\\thumbv7a-pc-windows-msvc\\release\\deps\\std-98cf5a568f42e09b.std.63tu9e3h-cgu.6.rcgu.o" "E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage2-std\\thumbv7a-pc-windows-msvc\\release\\deps\\std-98cf5a568f42e09b.std.63tu9e3h-cgu.7.rcgu.o" "E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage2-std\\thumbv7a-pc-windows-msvc\\release\\deps\\std-98cf5a568f42e09b.std.63tu9e3h-cgu.8.rcgu.o" "E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage2-std\\thumbv7a-pc-windows-msvc\\release\\deps\\std-98cf5a568f42e09b.std.63tu9e3h-cgu.9.rcgu.o" "/OUT:E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage2-std\\thumbv7a-pc-windows-msvc\\release\\deps\\std-98cf5a568f42e09b.dll" "/DEF:C:\\Users\\chandde\\AppData\\Local\\Temp\\rustc2TshG4\\lib.def" "E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage2-std\\thumbv7a-pc-windows-msvc\\release\\deps\\std-98cf5a568f42e09b.4c8p4onoho3gaq17.rcgu.o" "E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage2-std\\thumbv7a-pc-windows-msvc\\release\\deps\\std-98cf5a568f42e09b.22bbzhvufvxtdxaz.rcgu.o" "/OPT:REF,ICF" "/DEBUG" "/LIBPATH:E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage2-std\\thumbv7a-pc-windows-msvc\\release\\deps" "/LIBPATH:E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage2-std\\release\\deps" "/LIBPATH:E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage2-std\\thumbv7a-pc-windows-msvc\\release\\build\\compiler_builtins-94ee60edc05b50e1\\out" "/LIBPATH:E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage2\\lib\\rustlib\\thumbv7a-pc-windows-msvc\\lib" "advapi32.lib" "ws2_32.lib" "userenv.lib" "C:\\Users\\chandde\\AppData\\Local\\Temp\\rustc2TshG4\\libpanic_abort-3bbb503bf9fc906d.rlib" "C:\\Users\\chandde\\AppData\\Local\\Temp\\rustc2TshG4\\librustc_demangle-0dea9c528c084e89.rlib" "C:\\Users\\chandde\\AppData\\Local\\Temp\\rustc2TshG4\\libhashbrown-275e9c5a775d785f.rlib" "C:\\Users\\chandde\\AppData\\Local\\Temp\\rustc2TshG4\\librustc_std_workspace_alloc-32756c8d481be72a.rlib" "C:\\Users\\chandde\\AppData\\Local\\Temp\\rustc2TshG4\\libunwind-29b92202c2e0c997.rlib" "C:\\Users\\chandde\\AppData\\Local\\Temp\\rustc2TshG4\\liblibc-1287bf1fe4191b4b.rlib" "C:\\Users\\chandde\\AppData\\Local\\Temp\\rustc2TshG4\\liballoc-e7f63641ff3fc065.rlib" "C:\\Users\\chandde\\AppData\\Local\\Temp\\rustc2TshG4\\librustc_std_workspace_core-d51e26897332c0c9.rlib" "C:\\Users\\chandde\\AppData\\Local\\Temp\\rustc2TshG4\\libcore-1fdb51d4e6dfea00.rlib" "C:\\Users\\chandde\\AppData\\Local\\Temp\\rustc2TshG4\\libcompiler_builtins-31e7c799d68743b0.rlib" "libcmt.lib" "/DLL" "/IMPLIB:E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage2-std\\thumbv7a-pc-windows-msvc\\release\\deps\\std-98cf5a568f42e09b.dll.lib"
  = note:    Creating library E:\git\rust\build\x86_64-pc-windows-msvc\stage2-std\thumbv7a-pc-windows-msvc\release\deps\std-98cf5a568f42e09b.dll.lib and object E:\git\rust\build\x86_64-pc-windows-msvc\stage2-std\thumbv7a-pc-windows-msvc\release\deps\std-98cf5a568f42e09b.dll.exp
          std-98cf5a568f42e09b.std.63tu9e3h-cgu.0.rcgu.o : warning LNK4217: locally defined symbol _ZN5alloc11collections5btree4node15EMPTY_ROOT_NODE17h0978fabf400f3c0cE imported in function _ZN5alloc11collections5btree4node17Root$LT$K$C$V$GT$14is_shared_root17hded44afd70accee1E
          std-98cf5a568f42e09b.std.63tu9e3h-cgu.12.rcgu.o : warning LNK4049: locally defined symbol _ZN5alloc11collections5btree4node15EMPTY_ROOT_NODE17h0978fabf400f3c0cE imported
          std-98cf5a568f42e09b.std.63tu9e3h-cgu.14.rcgu.o : warning LNK4049: locally defined symbol _ZN5alloc11collections5btree4node15EMPTY_ROOT_NODE17h0978fabf400f3c0cE imported
          std-98cf5a568f42e09b.std.63tu9e3h-cgu.5.rcgu.o : warning LNK4049: locally defined symbol _ZN5alloc11collections5btree4node15EMPTY_ROOT_NODE17h0978fabf400f3c0cE imported
          libcompiler_builtins-31e7c799d68743b0.rlib(compiler_builtins-31e7c799d68743b0.compiler_builtins.2ffsj1ku-cgu.5.rcgu.o) : error LNK2019: unresolved external symbol __udivsi3 referenced in function _ZN17compiler_builtins3int4udiv9__udivsi317h2dba38b685a8a914E
          libcompiler_builtins-31e7c799d68743b0.rlib(compiler_builtins-31e7c799d68743b0.compiler_builtins.2ffsj1ku-cgu.9.rcgu.o) : error LNK2019: unresolved external symbol __divsi3 referenced in function _ZN17compiler_builtins3int4sdiv8__divsi317h9f84833021b820fcE
          libcompiler_builtins-31e7c799d68743b0.rlib(compiler_builtins-31e7c799d68743b0.compiler_builtins.2ffsj1ku-cgu.13.rcgu.o) : error LNK2019: unresolved external symbol __aeabi_idiv referenced in function __aeabi_idivmod
          E:\git\rust\build\x86_64-pc-windows-msvc\stage2-std\thumbv7a-pc-windows-msvc\release\deps\std-98cf5a568f42e09b.dll : fatal error LNK1120: 3 unresolved externals


error: aborting due to previous error

error: Could not compile `std`.

To learn more, run the command again with --verbose.
command did not execute successfully: "E:\\git\\rust\\build\\x86_64-pc-windows-msvc\\stage0\\bin\\cargo.exe" "build" "--target" "thumbv7a-pc-windows-msvc" "-j" "12" "--release" "--features" "panic-unwind backtrace" "--manifest-path" "E:\\git\\rust\\src/libstd/Cargo.toml" "--message-format" "json"
expected success, got: exit code: 101
Traceback (most recent call last):
  File "x.py", line 11, in <module>
    bootstrap.main()
  File "E:\git\rust\src\bootstrap\bootstrap.py", line 848, in main
    bootstrap(help_triggered)
  File "E:\git\rust\src\bootstrap\bootstrap.py", line 834, in bootstrap
    run(args, env=env, verbose=build.verbose)
  File "E:\git\rust\src\bootstrap\bootstrap.py", line 141, in run
    raise RuntimeError(err)
RuntimeError: failed to run: E:\git\rust\build\bootstrap\debug\bootstrap build --host x86_64-pc-windows-msvc --build x86_64-pc-windows-msvc --target thumbv7a-pc-windows-msvc --verbose

@chandde
Copy link
Author

chandde commented May 15, 2019

@alexcrichton

@alexcrichton
Copy link
Member

The definitions for these intrinsics are instructed to use optimized routines written in assembly from compiler-rt where possible, but they're specifically skipped on MSVC. I think that the condition in the source will need to be updated to indicate that the Rust intrinsic should be used on MSVC instead of the C intrinsic.

@alexcrichton
Copy link
Member

I think that #293 should probably fix this, although I haven't tested this issue directly.

@chandde
Copy link
Author

chandde commented May 15, 2019

let me merge the change and try it locally

@chandde
Copy link
Author

chandde commented May 15, 2019

@alexcrichton I can confirm with that PR, I was able to build thumv7a-pc-windows-msvc successfully with this command c:\python27\python.exe x.py build --host x86_64-pc-windows-msvc --build x86_64-pc-windows-msvc --target thumbv7a-pc-windows-msvc, with compiler_builtins patched to a local enlistment from master and had your PR commit cherry-picked.

I'm in the middle testing the toolchain would actually work with azure/iotedge master branch

Since rust currently uses compiler_builtins 0.1.12, do you know when rust master will update to 0.1.13 and after, which would have the change from your PR?

@alexcrichton
Copy link
Member

Ok great! I've actually already published 0.1.13 with other fixes so this'll be in 0.1.14. I'm updating to 0.1.13 in rust-lang/rust#60841 but I'll go ahead and publish this change then update to 0.1.14

@chandde
Copy link
Author

chandde commented May 15, 2019

On a side note, when are you gonna push a new tag for backtrace to have the ARM changes merged yesterday?

@alexcrichton
Copy link
Member

Oh sure, I can do that too

@chandde
Copy link
Author

chandde commented May 15, 2019

You're awesome

@chandde
Copy link
Author

chandde commented May 16, 2019

@alexcrichton , sorry for abusing this issue

Do you have any insights for this issue, or any pointers which area in rust that I should look into, make sure also take a look at my own comment in the post, that libstd.rlib and liballoc.rlib have different symbols
https://internals.rust-lang.org/t/liballoc-rlib-has-imp-three-underscores-but-rustc-is-looking-for-imp-2-underscores/10191/2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants