Skip to content

Windows MSVC: v8 + llama-cpp-sys-2 linker conflict (LNK2005/LNK4098/LNK1169) #940

Description

@lifeizhou-ap

We’re hitting a Windows MSVC linker conflict when llama-cpp-sys-2 is linked in the same binary graph as v8 (via deno_core in our
project).

Environment

  • Target: x86_64-pc-windows-msvc
  • Toolchain: Rust stable MSVC
  • llama-cpp-2: 0.1.136 (also reproduced on 0.1.133)
  • llama-cpp-sys-2: 0.1.136 (also reproduced on 0.1.133)
  • Linker: MSVC link.exe

Error (key lines)

  • libv8-...rlib(exception.obj) : error LNK2005 ... std::exception_ptr ... already defined in libllama_cpp_sys_2-...rlib(llama-
    model-loader.obj)
  • LINK : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs
  • fatal error LNK1169: one or more multiply defined symbols found

This happens across multiple binaries in the same build (e.g. generate_acp_schema, build_canonical_models, goosed).

What we already tried

  • Force dynamic CRT on Windows build:
    • RUSTFLAGS=-C target-feature=-crt-static
    • CMAKE_POLICY_DEFAULT_CMP0091=NEW
    • CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL
    • LLAMA_STATIC_CRT=0
  • Upgraded from 0.1.133 to 0.1.136

Result: still reproduces with the same v8 vs llama-model-loader duplicate symbols.

PR and build to attempt fixing this issue in our code base

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions