it is usefull
There is an very easy way to build on windows using mingw32 compilation in msys2.
- Download msys2-x86_64-20230318 from https://www.msys2.org/
- Open the file click next, next, wait for install to complete, then press finish
- Run C:\msys64\mingw64.exe
- Write the commands to install the appropriate files: pacman -S git pacman -S mingw-w64-x86_64-gcc pacman -S make
- Clone library for POSIX functions that llama.cpp needs: git clone https://github.com/CoderRC/libmingw32_extended.git cd libmingw32_extended
- Build the library: mkdir build cd build ../configure make
- Install the library: make install
- Change directory: cd ~
- Clone llama.cpp: git clone https://github.com/ggerganov/llama.cpp cd llama.cpp
- Build llama.cpp: make LDFLAGS='-D_POSIX_MAPPED_FILES -lmingw32_extended' CFLAGS='-D_POSIX_MAPPED_FILES -I. -O3 -DNDEBUG -std=c11 -fPIC -Wall -Wextra -Wpedantic -Wcast-qual -Wdouble-promotion -Wshadow -Wstrict-prototypes -Wpointer-arith -Wno-unused-function -mfma -mf16c -mavx -mavx2' CXXFLAGS='-D_POSIX_MAPPED_FILES -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function'
Originally posted by @CoderRC in https://github.com/ggerganov/llama.cpp/issues/103#issuecomment-1487784446
every thing is right but the last make is waring and i solved it to pacman install cmake and use cmake -S . -B build/ -D CMAKE_BUILD_TYPE=Release then make success! congratual
It seems way too complex. Why is libmingw32_extended needed? It seems to be building fine with MSYS2 UCRT64 libc and CMake.
libmingw32_extended is needed because the POSIX translation code for windows will be outdated in llama.cpp eventually, and right now there is a warning when compiling #pragma message("warning: You are building for pre-Windows 8; prefetch not supported") which libmingw32_extended has better code for prefetching and llama.cpp absolutely does not for pre-Windows 8. libmingw32_extended also contains code that can be used in llama.cpp in the future.
There is no warning for UCRT64, only Mingw64.
This issue was closed because it has been inactive for 14 days since being marked as stale.