Skip to content

it is usefull #1976

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
newjcj opened this issue Jun 23, 2023 · 4 comments
Closed

it is usefull #1976

newjcj opened this issue Jun 23, 2023 · 4 comments
Labels

Comments

@newjcj
Copy link

newjcj commented Jun 23, 2023

          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 #103 (comment)

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

@SlyEcho
Copy link
Collaborator

SlyEcho commented Jun 26, 2023

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

@CoderRC
Copy link

CoderRC commented Jun 26, 2023

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.

@SlyEcho
Copy link
Collaborator

SlyEcho commented Jun 26, 2023

There is no warning for UCRT64, only Mingw64.

@github-actions github-actions bot added the stale label Mar 25, 2024
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants