Skip to content

Linking error when compiled to arm64ec-pc-windows-msvc #138541

@Wyvern

Description

@Wyvern

On windows compiled to arm64ec-pc-windows-msvc target with -Zbuild-std got linking error:

error: linking with `link.exe` failed: exit code: 1120
  = note:    Creating library D:\a\Img\Img\build-dir\arm64ec-pc-windows-msvc\src\deps\Img.lib and object D:\a\Img\Img\build-dir\arm64ec-pc-windows-msvc\src\deps\Img.exp␍
          symbols.o : error LNK2001: unresolved external symbol #_RNxC3std12H7JG8fmF3Zv8 (EC Symbol)␍
          D:\a\Img\Img\build-dir\arm64ec-pc-windows-msvc\src\deps\Img.exe : fatal error LNK1120: 1 unresolved externals␍

Rust 1.87.0-nightly (ecade53 2025-03-14)

Activity

added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Mar 15, 2025
added
A-linkageArea: linking into static, shared libraries and binaries
-Zbuild-stdUnstable Cargo option: Compile the standard library yourself.
O-windowsOperating system: Windows
on Mar 15, 2025
Palkovsky

Palkovsky commented on Apr 16, 2025

@Palkovsky

I'm getting similar one, since 1.85, without even using -Zbuild-std:

PS C:\Code> cargo new hello-word
PS C:\Code> cd hello-world
PS C:\Code\hello-world> cargo build --target arm64ec-pc-windows-msvc
   Compiling hello-world v0.1.0 (C:\Code\hello-world)
error: linking with `link.exe` failed: exit code: 1120
  |
  = note: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\VC\\Tools\\MSVC\\14.43.34808\\bin\\HostX64\\arm64\\link.exe" "/NOLOGO" "C:\\Users\\damacek\\AppData\\Local\\Temp\\rustcvHVlMY\\symbols.o" "<7 object files omitted>" "<sysroot>\\lib\\rustlib\\arm64ec-pc-windows-msvc\\lib/{libstd-*,libpanic_unwind-*,libwindows_targets-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libunwind-*,libcfg_if-*,liballoc-*,librustc_std_workspace_core-*,libcore-*,libcompiler_builtins-*}.rlib" "kernel32.lib" "kernel32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "dbghelp.lib" "/defaultlib:msvcrt" "/machine:arm64ec" "softintrin.lib" "/NXCOMPAT" "/OUT:C:\\Code\\hello-world\\target\\arm64ec-pc-windows-msvc\\debug\\deps\\hello_world.exe" "/OPT:REF,NOICF" "/DEBUG" "/PDBALTPATH:%_PDB%" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\libstd.natvis"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: symbols.o : error LNK2001: unresolved external symbol #_ZN3std9panicking11EMPTY_PANIC17hc8d2b903527827f1E (EC Symbol)␍
          C:\Code\hello-world\target\arm64ec-pc-windows-msvc\debug\deps\hello_world.exe : fatal error LNK1120: 1 unresolved externals␍


error: could not compile `hello-world` (bin "hello-world") due to 1 previous error

@dpaoliello Any ideas?

dpaoliello

dpaoliello commented on Apr 21, 2025

@dpaoliello
Contributor

I can reproduce with 1.86, will investigate...

dpaoliello

dpaoliello commented on Apr 22, 2025

@dpaoliello
Contributor

I have a root cause and a fix: Rust is decorating all symbols with # for Arm64EC, when it should only be decorating functions. Running tests now and will have a PR out shortly.

removed
-Zbuild-stdUnstable Cargo option: Compile the standard library yourself.
on Apr 29, 2025
added a commit that references this issue on Apr 30, 2025

Rollup merge of rust-lang#140176 - dpaoliello:arm64ecdec, r=wesleywiser

ef6eb3e
added a commit that references this issue on Apr 30, 2025

Auto merge of rust-lang#140176 - dpaoliello:arm64ecdec, r=<try>

fcf787f
added
O-ArmTarget: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
and removed
O-windowsOperating system: Windows
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Apr 30, 2025

36 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.O-ArmTarget: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 stateO-windows-msvcToolchain: MSVC, Operating system: WindowsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @Wyvern@wesleywiser@Palkovsky@dpaoliello@lolbinarycat

      Issue actions

        Linking error when compiled to `arm64ec-pc-windows-msvc` · Issue #138541 · rust-lang/rust