Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[Bug] Windows build fails with Clang/MSVC due to missing #include <chrono>

Đang mở
#492 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
58/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
cmake, cpp
Lĩnh vực
build-system, compilers

Hướng nghiên cứu

Bắt đầu với bốn tệp được liệt kê trong 3rdparty/llama.cpp/common và examples, sau đó kiểm tra src/ggml-bitnet-mad.cpp quanh dòng 811. Tái hiện bản build CMake bằng clang-cl trên Windows và xác minh rằng các header chrono còn thiếu cùng lỗi const pointer đã được giải quyết mà không phát sinh thêm lỗi trình biên dịch nào khác.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Summary

Building on Windows with ClangCL fails due to missing #include header and const pointer type mismatch in bitnet-mad.cpp.

Steps to Reproduce

  1. Clone the repository on Windows 11
  2. Install Clang 19 via Visual Studio 2022 Build Tools + clang-cl
  3. Run CMake configuration and build
  4. Observe compilation errors

Expected Behavior

Code should compile on Windows with ClangCL without errors

Actual Behavior

Two compilation errors occur:

Error 1: Missing #include

The following files use std::chrono without explicitly including :

  • 3rdparty/llama.cpp/common/common.cpp
  • 3rdparty/llama.cpp/common/log.cpp
  • 3rdparty/llama.cpp/examples/imatrix/imatrix.cpp
  • 3rdparty/llama.cpp/examples/perplexity/perplexity.cpp

On Linux/GCC, is pulled in implicitly, but Clang on Windows is stricter.

Error 2: Const pointer mismatch (src/ggml-bitnet-mad.cpp line 811)

error: cannot initialize a variable of type 'int8_t *' with an rvalue of type 'const int8_t *'

Root Cause Analysis

The root cause is platform-specific header dependency and type constness:

  1. Header Issue: GCC on Linux transitively includes through other headers, but Clang/MSVC on Windows does not
  2. Type Issue: The code at line 811 declares int8_t * but receives a const int8_t *, which should be const int8_t *

Proposed Solution

  1. Add #include <chrono> to the four affected files
  2. Change line 811 from int8_t * to const int8_t *

Environment

  • OS: Windows 11
  • Compiler: Clang 19 (via Visual Studio 2022 Build Tools + clang-cl)
  • CMake: 3.x
Ngôn ngữ chính
C++
Star
40.3k
Fork
3.7k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/BitNet

Tất cả issue của microsoft/BitNet

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.