Skip to content
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

[User] Failed to build with "make" on Windows 11 #1511

Closed
Valikzant opened this issue May 18, 2023 · 6 comments
Closed

[User] Failed to build with "make" on Windows 11 #1511

Valikzant opened this issue May 18, 2023 · 6 comments

Comments

@Valikzant
Copy link

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • [V] I am running the latest code. Development is very rapid so there are no tagged versions as of now.
  • [V] I carefully followed the README.md.
  • [V] I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
  • [V] I reviewed the Discussions, and have a new bug or useful enhancement to share.

Expected Behavior

I followed this step after cloning git:
On Windows:

Download the latest fortran version of [w64devkit](https://github.com/skeeto/w64devkit/releases).
Extract w64devkit on your pc.
Run w64devkit.exe.
Use the cd command to reach the llama.cpp folder.
From here you can run:
make

and expected a successful build of files i installed

Current Behavior

Instead of successful build i got an error while using 'make'. I provided full log in lower "Failure Logs" section

Environment and Context

Environment info:

E:/TextAIModels/LLama/llama.cpp $ git log | head -1
commit dc271c52ed65e7c8dfcbaaf84dabb1f788e4f3d0

CPU: АМD Ryzen 5 5600G with Radeon Graphics (12 CPUs) ~3.9GHz

E:/TextAIModels/LLama/llama.cpp $ python -V
Python 3.8.0

E:/TextAIModels/LLama/llama.cpp $ pip list | egrep "torch|numpy|sentencepiece"
numpy                1.24.2
sentencepiece        0.1.97
torch                1.13.1
torchaudio           0.13.1
torchvision          0.14.1

E:/TextAIModels/LLama/llama.cpp $ make --version | head -1
GNU Make 4.4
  • Physical (or virtual) hardware you are using

I am using Windows 11

Failure Information (for bugs)

llama.cpp did not build by using 'make'

Steps to Reproduce

  1. I used git clone https://github.com/ggerganov/llama.cpp in Windows powershell in a directory where i wanted llama.cpp to be installed
  2. I installed the latest fortran version of w64devkit and lauched it
  3. i reached directory where llama.cpp is located
  4. i typed "make" and hit enter

Failure Logs

E:/TextAIModels/LLama/llama.cpp $ make
I llama.cpp build info:
I UNAME_S:  Windows_NT
I UNAME_P:  unknown
I UNAME_M:  i686
I CFLAGS:   -I.              -O3 -std=c11   -fPIC -DNDEBUG -Wall -Wextra -Wpedantic -Wcast-qual -Wdouble-promotion -Wshadow -Wstrict-prototypes -Wpointer-arith -march=native -mtune=native
I CXXFLAGS: -I. -I./examples -O3 -std=c++11 -fPIC -DNDEBUG -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wno-multichar -march=native -mtune=native
I LDFLAGS:
I CC:       cc (GCC) 13.1.0
I CXX:      g++ (GCC) 13.1.0

cc  -I.              -O3 -std=c11   -fPIC -DNDEBUG -Wall -Wextra -Wpedantic -Wcast-qual -Wdouble-promotion -Wshadow -Wstrict-prototypes -Wpointer-arith -march=native -mtune=native   -c ggml.c -o ggml.o
g++ -I. -I./examples -O3 -std=c++11 -fPIC -DNDEBUG -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wno-multichar -march=native -mtune=native -c llama.cpp -o llama.o
In file included from llama.cpp:8:
llama-util.h: In constructor 'llama_mmap::llama_mmap(llama_file*, bool)':
llama-util.h:234:94: note: '#pragma message: warning: You are building for pre-Windows 8; prefetch not supported'
  234 |         #pragma message("warning: You are building for pre-Windows 8; prefetch not supported")
      |                                                                                              ^
llama-util.h:202:47: warning: unused parameter 'prefetch' [-Wunused-parameter]
  202 |     llama_mmap(struct llama_file * file, bool prefetch = true) {
      |                                          ~~~~~^~~~~~~~~~~~~~~
llama.cpp: In function 'size_t llama_set_state_data(llama_context*, const uint8_t*)':
llama.cpp:2685:27: warning: cast from type 'const uint8_t*' {aka 'const unsigned char*'} to type 'void*' casts away qualifiers [-Wcast-qual]
 2685 |             kin3d->data = (void *) inp;
      |                           ^~~~~~~~~~~~
llama.cpp:2689:27: warning: cast from type 'const uint8_t*' {aka 'const unsigned char*'} to type 'void*' casts away qualifiers [-Wcast-qual]
 2689 |             vin3d->data = (void *) inp;
      |                           ^~~~~~~~~~~~
g++ -I. -I./examples -O3 -std=c++11 -fPIC -DNDEBUG -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wno-multichar -march=native -mtune=native -c examples/common.cpp -o common.o
examples/common.cpp:20: warning: "NOMINMAX" redefined
   20 | #define NOMINMAX
      |
In file included from E:/Progs/Fortran/w64devkit/lib/gcc/i686-w64-mingw32/13.1.0/include/c++/i686-w64-mingw32/bits/c++config.h:679,
                 from E:/Progs/Fortran/w64devkit/lib/gcc/i686-w64-mingw32/13.1.0/include/c++/bits/requires_hosted.h:31,
                 from E:/Progs/Fortran/w64devkit/lib/gcc/i686-w64-mingw32/13.1.0/include/c++/string:38,
                 from examples/common.h:7,
                 from examples/common.cpp:1:
E:/Progs/Fortran/w64devkit/lib/gcc/i686-w64-mingw32/13.1.0/include/c++/i686-w64-mingw32/bits/os_defines.h:45: note: this is the location of the previous definition
   45 | #define NOMINMAX 1
      |
examples/common.cpp: In function 'int estimateWidth(char32_t)':
examples/common.cpp:622:28: warning: unused parameter 'codepoint' [-Wunused-parameter]
  622 | int estimateWidth(char32_t codepoint) {
      |                   ~~~~~~~~~^~~~~~~~~
g++ -I. -I./examples -O3 -std=c++11 -fPIC -DNDEBUG -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wno-multichar -march=native -mtune=native examples/main/main.cpp ggml.o llama.o common.o -o main
examples/main/main.cpp:26: warning: "NOMINMAX" redefined
   26 | #define NOMINMAX
      |
In file included from E:/Progs/Fortran/w64devkit/lib/gcc/i686-w64-mingw32/13.1.0/include/c++/i686-w64-mingw32/bits/c++config.h:679,
                 from E:/Progs/Fortran/w64devkit/lib/gcc/i686-w64-mingw32/13.1.0/include/c++/bits/requires_hosted.h:31,
                 from E:/Progs/Fortran/w64devkit/lib/gcc/i686-w64-mingw32/13.1.0/include/c++/string:38,
                 from ./examples/common.h:7,
                 from examples/main/main.cpp:6:
E:/Progs/Fortran/w64devkit/lib/gcc/i686-w64-mingw32/13.1.0/include/c++/i686-w64-mingw32/bits/os_defines.h:45: note: this is the location of the previous definition
   45 | #define NOMINMAX 1
      |
examples/main/main.cpp: In function 'int main(int, char**)':
examples/main/main.cpp:247:31: error: invalid 'static_cast' from type 'main(int, char**)::<lambda(DWORD)>' to type 'PHANDLER_ROUTINE' {aka 'int (__attribute__((stdcall)) *)(long unsigned int)'}
  247 |         SetConsoleCtrlHandler(static_cast<PHANDLER_ROUTINE>(console_ctrl_handler), true);
      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:205: main] Error 1
@DannyDaemonic
Copy link
Collaborator

Others have used w64devkit without compilation issues. I do wonder why the fortran version causes this issue. Unless it's not the fortran version that's the problem but the build version. Are you using an older release?

The obvious fix is just to pull the lambda function out. I can make a PR but you'll need to test it.

@Valikzant
Copy link
Author

Valikzant commented May 18, 2023

Others have used w64devkit without compilation issues. I do wonder why the fortran version causes this issue. Unless it's not the fortran version that's the problem but the build version. Are you using an older release?

The obvious fix is just to pull the lambda function out. I can make a PR but you'll need to test it.

Hi @DannyDaemonic. I used "w64devkit-i686-fortran-1.19.0.zip" to try build it. It is a latest version i found. If i did something wrong or i need to use another version, please correct me ':D

@DannyDaemonic
Copy link
Collaborator

I don't think it's you. It's just a mingw thing. Can you try out the patch in #1513 and reply in that pull request if it fixes this or not? If you don't know how to check it out you can download it from here and apply it like this: patch -p1 < 1513.patch

@Valikzant
Copy link
Author

Valikzant commented May 18, 2023

@DannyDaemonic. I took the time to test and tried to build the original llama.cpp, choosing a different version of fortran. It looks like I wasn't too careful when choosing the version, looking for the first 'fortran' word I could find and installing -686, which I looked on the website is the version for older computers. Using the version without -686 I encountered the following result at the end of the command line:
==== Run ./main -h for help. ====
which I understood to be a successful installation, without errors.
I apologize for my inattention, because the installation guide did not tell me which fortan to install and I chose the first one I saw. ':D
My problem solved by using w64devkit-fortran-1.19.0.zip
but w64devkit-i686-fortran-1.19.0.zip does not work for me with patch and without patch, so it is was my mistake by choosing this verison.

@Green-Sky
Copy link
Collaborator

i686

Oh yea, that's 32bit x86

@DannyDaemonic
Copy link
Collaborator

I guess i686 probably just isn't maintained as well. If you're going to use mingw you will need #1462 (patch) that is verified to fix an input issue.

Green-Sky pushed a commit that referenced this issue May 18, 2023
ggerganov pushed a commit to JohannesGaessler/llama.cpp that referenced this issue May 20, 2023
ggerganov added a commit that referenced this issue May 20, 2023
…oadcasting for ggml_mul (#1483)

* Broadcasting for ggml_mul

* CUDA kernel for ggml_mul, norms in VRAM

* GPU weights not in RAM, direct loading with cuFile

* fixup! GPU weights not in RAM, direct loading with cuFile

* fixup! GPU weights not in RAM, direct loading with cuFile

* define default model path once, sync path with readme (#1366)

* ~7% faster Q5_1 AVX2 code (#1477)

* convert.py: Support models which are stored in a single pytorch_model.bin (#1469)

* Support models in a single pytorch_model.bin

* Remove spurious line with typo

* benchmark-matmul: Print the average of the test results (#1490)

* Remove unused n_parts parameter (#1509)

* Fixes #1511 lambda issue for w64devkit (mingw) (#1513)

* Fix for w64devkit and mingw

* make kv_f16 the default for api users (#1517)

* minor : fix compile warnings

* readme : adds WizardLM to the list of supported models (#1485)

* main : make reverse prompt option act as a stop token in non-interactive mode (#1032)

* Make reverse prompt option act as a stop token in non-interactive scenarios

* Making requested review changes

* Update gpt_params_parse and fix a merge error

* Revert "Update gpt_params_parse and fix a merge error"

This reverts commit 2bb2ff1.

* Update gpt_params_parse and fix a merge error take 2

* examples : add persistent chat (#1495)

* examples : add persistent chat

* examples : fix whitespace

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>

* tests : add missing header

* ggml : use F16 instead of F32 in Q4_0, Q4_1, Q8_0 (#1508)

* ggml : use F16 instead of F32 in Q4_0, Q4_1 and Q8_0

* llama : bump LLAMA_FILE_VERSION to 3

* cuda : update Q4 and Q8 dequantize kernels

* ggml : fix AVX dot products

* readme : update performance table + hot topics

* ggml : fix scalar implementation of Q4_1 dot

* llama : fix compile warnings in llama_set_state_data()

* llama : fix name shadowing and C4146 (#1526)

* Fix name shadowing and C4146

* Fix if macros not using defined when required

* Update llama-util.h

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update llama-util.h

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Code style

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>

* Fix for mingw (#1462)

* llama : add llama_init_backend() API (close #1527)

* feature : add blis and other BLAS implementation support (#1502)

* feature: add blis support

* feature: allow all BLA_VENDOR to be assigned in cmake arguments. align with whisper.cpp pr 927

* fix: version detection for BLA_SIZEOF_INTEGER, recover min version of cmake

* Fix typo in INTEGER

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>

* Revert "feature : add blis and other BLAS implementation support (#1502)"

This reverts commit 07e9ace.

* GPU weights not in RAM, direct loading with cuFile

* llama : code style fixes + progress print fix

* ggml : ggml_mul better broadcast support

* cmake : workarounds for cufile when CMake version < 3.25

* gg rebase fixup

* Loop in llama.cpp, fixed progress callback

* Attempt clang-tidy fix

* llama : fix vram size computation

* Add forgotten fclose()

---------

Co-authored-by: András Salamon <ott2@users.noreply.github.com>
Co-authored-by: Ilya Kurdyukov <59548320+ilyakurdyukov@users.noreply.github.com>
Co-authored-by: Tom Jobbins <784313+TheBloke@users.noreply.github.com>
Co-authored-by: rankaiyx <rankaiyx@rankaiyx.com>
Co-authored-by: Stephan Walter <stephan@walter.name>
Co-authored-by: DannyDaemonic <DannyDaemonic@gmail.com>
Co-authored-by: Erik Scholz <Green-Sky@users.noreply.github.com>
Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
Co-authored-by: David Kennedy <dakennedyd@gmail.com>
Co-authored-by: Jason McCartney <jmac@theroot.org>
Co-authored-by: Evan Jones <evan.q.jones@gmail.com>
Co-authored-by: Maxime <672982+maximegmd@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Zenix <zenixls2@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants