Skip to content

Linker error "undefined symbol: quantize_i2_s" when building with -q i2_s or -q tl2 on Windows 11 #595

Description

@Jimmy-sheep

When attempting to build the project on Windows at 16da220 using python setup_env.py -md models/BitNet-b1.58-2B-4T -q tl2(or -q i2_s), the build fails during the CMake linking phase.

The linker (lld-link) reports undefined symbol errors for quantize_i2_s and dequantize_row_i2_s inside ggml-base.vcxproj.

It appears that recent updates in the 3rdparty/llama.cpp submodule (specifically ggml.c) reference the i2_s quantization symbols, but the source files implementing these i2_s functions are not included in the compilation target, causing a linker failure.

Terminal Output:

(.venv) PS D:\Projects\BitNet> python setup_env.py -md models/BitNet-b1.58-2B-4T -q tl2
INFO:root:Compiling the code using CMake.
ERROR:root:Error occurred while running command: Command '['cmake', '--build', 'build', '--config', 'Release']' returned non-zero exit status 1., check details in logs\compile.log

Relevant Section from logs/compile.log:

lld-link : error : undefined symbol: quantize_i2_s [D:\Projects\BitNet\build\3rdparty\llama.cpp\ggml\src\ggml-base.vcxproj]
  >>> referenced by ggml-base.dir\Release\ggml.c.obj:(ggml_quantize_chunk)
  
lld-link : error : undefined symbol: dequantize_row_i2_s [D:\Projects\BitNet\build\3rdparty\llama.cpp\ggml\src\ggml-base.vcxproj]
  >>> referenced by ggml-base.dir\Release\ggml.c.obj:(type_traits)
  Building Custom Rule D:/Projects/BitNet/3rdparty/llama.cpp/common/CMakeLists.txt
  llama-common-base.vcxproj -> D:\Projects\BitNet\build\3rdparty\llama.cpp\common\Release\llama-common-base.lib
  Building Custom Rule D:/Projects/BitNet/3rdparty/llama.cpp/tools/mtmd/CMakeLists.txt
  llama-gemma3-cli.vcxproj -> D:\Projects\BitNet\build\bin\Release\llama-gemma3-cli.exe
  Building Custom Rule D:/Projects/BitNet/3rdparty/llama.cpp/tools/mtmd/CMakeLists.txt
  llama-llava-cli.vcxproj -> D:\Projects\BitNet\build\bin\Release\llama-llava-cli.exe
  Building Custom Rule D:/Projects/BitNet/3rdparty/llama.cpp/tools/mtmd/CMakeLists.txt
  llama-minicpmv-cli.vcxproj -> D:\Projects\BitNet\build\bin\Release\llama-minicpmv-cli.exe
  Building Custom Rule D:/Projects/BitNet/3rdparty/llama.cpp/tools/mtmd/CMakeLists.txt
  llama-qwen2vl-cli.vcxproj -> D:\Projects\BitNet\build\bin\Release\llama-qwen2vl-cli.exe
  Building Custom Rule D:/Projects/BitNet/3rdparty/llama.cpp/tools/ui/CMakeLists.txt
  llama-ui.vcxproj -> D:\Projects\BitNet\build\3rdparty\llama.cpp\tools\ui\Release\llama-ui.lib

Environment:

  • OS: Windows 11 Home (Build 10.0.26200)
  • Compiler / Toolchain: Visual Studio 2026 + Clang 22.1.3 (x86_64-pc-windows-msvc)
  • CMake Version: 4.3.1-msvc1
  • Python Version: 3.10.11

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