Skip to content

fix: change y_col to const int8_t* for Windows Clang build compatibility - #491

Closed
RoomWithOutRoof (Jah-yee) wants to merge 2 commits into
microsoft:mainfrom
Jah-yee:fix/windows-const-pointer
Closed

fix: change y_col to const int8_t* for Windows Clang build compatibility#491
RoomWithOutRoof (Jah-yee) wants to merge 2 commits into
microsoft:mainfrom
Jah-yee:fix/windows-const-pointer

Conversation

@Jah-yee

Copy link
Copy Markdown

Summary

  • Changed int8_t * y_col to const int8_t * y_col at line 811 in src/ggml-bitnet-mad.cpp

Problem

When building on Windows with ClangCL (Clang via Visual Studio 2022 Build Tools), the build fails with:

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

Solution

The variable y_col is used with const int8_t * py in the subsequent code, so it should also be declared as const int8_t *.

This matches the pattern at line 906 where the same variable is correctly declared as const int8_t *.

Fixes issue #489

On Windows with ClangCL, the code at line 811 declares int8_t * but receives a const int8_t *, causing compilation error:
  cannot initialize a variable of type 'int8_t *' with an rvalue of type 'const int8_t *'

This fix adds the const qualifier to match the actual pointer type being assigned.
On Windows, using -T ClangCL toolset flag conflicts with explicitly
setting -DCMAKE_C_COMPILER=clang and -DCMAKE_CXX_COMPILER=clang++.
This causes CMake configuration to fail with 'The C compiler
identification is unknown'.

This fix conditionally passes the compiler flags only on non-Windows
platforms, matching the suggestion in issue microsoft#493.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant