Skip to content

CMake build fails due to missing bitnet-lut-kernels.h #378

@lost-clouds

Description

@lost-clouds

Hi,

I am trying to build BitNet from a clean clone using CMake, but the native C++ build fails due to a missing header file.

Steps to reproduce

git clone --recursive https://github.com/microsoft/BitNet.git
cd BitNet
git submodule update --init --recursive
cmake -B build

Observed behavior

CMake fails while configuring the project in:

3rdparty/llama.cpp/ggml/src/CMakeLists.txt

with the following error:

CMake Error at 3rdparty/llama.cpp/ggml/src/CMakeLists.txt:1324 (add_library):
  Cannot find source file:

    ../../../../include/bitnet-lut-kernels.h

  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm
  .ccm .cxxm .c++m .h .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90
  .f95 .f03 .hip .ispc

CMake Error at 3rdparty/llama.cpp/ggml/src/CMakeLists.txt:1324 (add_library):
  No SOURCES given to target: ggml

CMake Generate step failed. Build files cannot be regenerated correctly.

Analysis

The file:

include/bitnet-lut-kernels.h

does not exist in the repository, and I could not find any script or build step that generates this header automatically.

For reference, I am able to build llama.cpp successfully using the same toolchain and a similar CMake workflow, so I am unsure whether this is:

  • a missing generated file,
  • an incomplete submodule,
  • or a build step that I am overlooking.

Environment

  • Platform: Android / Termux (aarch64)
  • Compiler: Clang 21.1.8
  • CMake: invoked directly via cmake -B build

I am still a beginner, so apologies if this is a trivial question. Any guidance would be greatly appreciated.

Thank you for your time.

and all the log

~/BitNet $ cmake -B build
-- The C compiler identification is Clang 21.1.8
-- The CXX compiler identification is Clang 21.1.8
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /data/data/com.termux/files/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /data/data/com.termux/files/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
-- Found Git: /data/data/com.termux/files/usr/bin/git (found version "2.52.0")
-- Found OpenMP_C: -fopenmp=libomp (found version "5.1")
-- Found OpenMP_CXX: -fopenmp=libomp (found version "5.1")
-- Found OpenMP: TRUE (found version "5.1")
-- OpenMP found
-- Using llamafile
-- ccache found, compilation results will be cached. Disable with GGML_CCACHE=OFF.
-- CMAKE_SYSTEM_PROCESSOR: aarch64
-- ARM detected
-- Performing Test COMPILER_SUPPORTS_FP16_FORMAT_I3E
-- Performing Test COMPILER_SUPPORTS_FP16_FORMAT_I3E - Failed
-- Configuring done (3.4s)
CMake Error at 3rdparty/llama.cpp/ggml/src/CMakeLists.txt:1324 (add_library):
  Cannot find source file:

    ../../../../include/bitnet-lut-kernels.h

  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm
  .ccm .cxxm .c++m .h .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90
  .f95 .f03 .hip .ispc


CMake Error at 3rdparty/llama.cpp/ggml/src/CMakeLists.txt:1324 (add_library):
  No SOURCES given to target: ggml


CMake Generate step failed.  Build files cannot be regenerated correctly.

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