BitNet icon indicating copy to clipboard operation
BitNet copied to clipboard

It was impossible to build the sources of BitNet.cpp using the latest version of clang and clang++.

Open y-vectorfield opened this issue 1 year ago • 2 comments

We built the sources of BitNet.cpp using clang. Now, we could not build the sources of it using clan version > 18. According to the README, we can install clang using the following command.

bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"

However, this command cannot install clang version 18 and libomp. Threfore, I think we should use the following commands.

sudo apt install -y lsb-release wget software-properties-common gnupg
wget https://apt.llvm.org/llvm.sh
bash llvm.sh 18 all

We can install clang version 18 in this way.

In addition to this, if we build the sources of it on Linux systems, we should set the following env values.

export CC=/usr/bin/clang-18
export CXX=/usr/bin/clang++-18

If you agree with my proposal, would it be okay to add the above content to the README?

y-vectorfield avatar Feb 18 '25 10:02 y-vectorfield

I have the similar issues on MacOS - what would be the solution to properly build bitnet.cpp for MacOS as well? Right now, when I execute python setup_env.py -> task get stuck building bitnet.cpp with last entry on logs/compile.log focusing on "BitNet/src/ggml-bitnet-lut.cpp", but nothing seems to happen

salauioan avatar Apr 18 '25 16:04 salauioan

Probably the same problem. I have configured using clang-18 with CC and CXX, but llama-cli --version shows it's compiled with cc 13.3.0. (I previously have gcc-13, clang-14 and clang-18 installed, and removed clang-14)

export CC=/usr/bin/clang-18
export CXX=/usr/bin/clang++-18
rm -rf build/ && CC=/usr/bin/clang-18 CXX=/usr/bin/clang++-18 python setup_env.py -md models/BitNet-b1.58-2B-4T -q i2_s && build/bin/llama-cli --version

### OUTPUT:
INFO:root:Compiling the code using CMake.
INFO:root:Loading model from directory models/BitNet-b1.58-2B-4T.
INFO:root:GGUF model already exists at models/BitNet-b1.58-2B-4T/ggml-model-i2_s.gguf
version: 3957 (5eb47b72106e)
built with cc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0 for x86_64-linux-gnu

cupid5trick avatar May 06 '25 15:05 cupid5trick