Skip to content

Windows compilation issues when libuv turned on #234

@strottos

Description

@strottos

Have an MRE in this repository: https://github.com/strottos/nvim_oxi_template

If I try to compile that in Windows I get the compilation errors below at linking stage. NB: This is on an ARM64 Windows machine if that makes a difference, I will test on a Windows x86 machine later.

Wonder if I need some specific windows .cargo options as per Mac OS, if a simple fix like this works I'll link a PR later to update documentation:

[target.aarch64-apple-darwin]
rustflags = [
  "-C", "link-arg=-undefined",
  "-C", "link-arg=dynamic_lookup",
]

Error:

   Compiling nvim-oxi-template-rs v0.1.0 (C:\Users\<snip>\nvim-oxi-template)
error: linking with `link.exe` failed: exit code: 1120
  |
  = note: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.41.34120\\bin\\HostARM64\\arm64\\link.exe" "/DEF:C:\\Users\\<snip>\\AppData\\Local\\Temp\\rustcSf2UxR\\lib.def" "/NOLOGO" "C:\\Users\\<snip>\\AppData\\Local\\Temp\\rustcSf2UxR\\symbols.o" "<41 object files omitted>" "C:\\Users\\<snip>\\code\\strottos\\nvim-oxi-template\\target\\debug\\deps/{libnvim_oxi-81b49a657d1a6f47.rlib,libminiserde-104ade4f8f1be532.rlib,libryu-5a16a061826cb8cb.rlib,libitoa-edb3f5d395226c35.rlib,libnvim_oxi_libuv-69f4e2c2dfce86ea.rlib,libnvim_oxi_api-c00bc0db67835e4b.rlib,libnvim_oxi_types-dfbc12196ccd9a57.rlib,libserde-3b78ee9b54f54088.rlib,liblibc-8945ef6d6ce8681d.rlib,libnvim_oxi_luajit-abc0bd0b923f9347.rlib,libthiserror-e6887f23152a5da5.rlib}.rlib" "<sysroot>\\lib\\rustlib\\aarch64-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" "legacy_stdio_definitions.lib" "kernel32.lib" "kernel32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "dbghelp.lib" "/defaultlib:msvcrt" "/NXCOMPAT" "/OUT:C:\\Users\\<snip>\\nvim-oxi-template\\target\\debug\\deps\\nvim_oxi_template_rs.dll" "/OPT:REF,NOICF" "/DLL" "/IMPLIB:C:\\Users\\<snip>\\nvim-oxi-template\\target\\debug\\deps\\nvim_oxi_template_rs.dll.lib" "/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:    Creating library C:\Users\<snip>\nvim-oxi-template\target\debug\deps\nvim_oxi_template_rs.dll.lib and object C:\Users\<snip>\nvim-oxi-template\target\debug\deps\nvim_oxi_template_rs.dll.exp␍
          libnvim_oxi_libuv-69f4e2c2dfce86ea.rlib(nvim_oxi_libuv-69f4e2c2dfce86ea.nvim_oxi_libuv.201ae522ecd0adab-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol uv_async_send referenced in function _ZN14nvim_oxi_libuv5async11AsyncHandle4send17hac3028b83925c69eE␍
          libnvim_oxi_libuv-69f4e2c2dfce86ea.rlib(nvim_oxi_libuv-69f4e2c2dfce86ea.nvim_oxi_libuv.201ae522ecd0adab-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol uv_handle_get_data referenced in function _ZN14nvim_oxi_libuv6handle19Handle$LT$T$C$D$GT$8get_data17h0214f49d2b30f04fE␍
          libnvim_oxi_libuv-69f4e2c2dfce86ea.rlib(nvim_oxi_libuv-69f4e2c2dfce86ea.nvim_oxi_libuv.201ae522ecd0adab-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol luv_loop referenced in function _ZN14nvim_oxi_libuv4loop4init28_$u7b$$u7b$closure$u7d$$u7d$17hbe1d9adefea60aaaE␍
          libnvim_oxi_libuv-69f4e2c2dfce86ea.rlib(nvim_oxi_libuv-69f4e2c2dfce86ea.nvim_oxi_libuv.201ae522ecd0adab-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol uv_timer_init referenced in function _ZN14nvim_oxi_libuv5timer11TimerHandle3new28_$u7b$$u7b$closure$u7d$$u7d$17hdae99cde109dff02E␍
          libnvim_oxi_libuv-69f4e2c2dfce86ea.rlib(nvim_oxi_libuv-69f4e2c2dfce86ea.nvim_oxi_libuv.201ae522ecd0adab-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol uv_timer_stop referenced in function _ZN14nvim_oxi_libuv5timer11TimerHandle4stop17h21d2c6325a248af4E␍
          C:\Users\<snip>\nvim-oxi-template\target\debug\deps\nvim_oxi_template_rs.dll : fatal error LNK1120: 5 unresolved externals␍


error: could not compile `nvim-oxi-template-rs` (lib) due to 1 previous error

Full details, here's the Cargo.toml:

name = "nvim-oxi-template-rs"
version = "0.1.0"
edition = "2024"

[lib]
crate-type = ["cdylib"]

[dependencies]
nvim-oxi = { version = "0.5.1", features = ["neovim-0-10", "neovim-nightly", "test", "libuv"] }

and here's the lib.rs:

use nvim_oxi::{Dictionary, Function};

#[nvim_oxi::plugin]
fn nvim_oxi_template_rs() -> nvim_oxi::Result<Dictionary> {
    let example = Function::from_fn(|_args: Dictionary| {
        nvim_oxi::print!("Hello from oxi template!");
    });

    Ok(Dictionary::from_iter([("example", example)]))
}

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions