llama.cpp icon indicating copy to clipboard operation
llama.cpp copied to clipboard

it is usefull

Open newjcj opened this issue 2 years ago • 1 comments

          There is an very easy way to build on windows using mingw32 compilation in msys2.
  1. Download msys2-x86_64-20230318 from https://www.msys2.org/
  2. Open the file click next, next, wait for install to complete, then press finish
  3. Run C:\msys64\mingw64.exe
  4. Write the commands to install the appropriate files: pacman -S git pacman -S mingw-w64-x86_64-gcc pacman -S make
  5. Clone library for POSIX functions that llama.cpp needs: git clone https://github.com/CoderRC/libmingw32_extended.git cd libmingw32_extended
  6. Build the library: mkdir build cd build ../configure make
  7. Install the library: make install
  8. Change directory: cd ~
  9. Clone llama.cpp: git clone https://github.com/ggerganov/llama.cpp cd llama.cpp
  10. 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

newjcj avatar Jun 23 '23 15:06 newjcj

It seems way too complex. Why is libmingw32_extended needed? It seems to be building fine with MSYS2 UCRT64 libc and CMake.

SlyEcho avatar Jun 26 '23 09:06 SlyEcho

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.

CoderRC avatar Jun 26 '23 21:06 CoderRC

There is no warning for UCRT64, only Mingw64.

SlyEcho avatar Jun 26 '23 21:06 SlyEcho

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Apr 10 '24 01:04 github-actions[bot]