Skip to content

Conversation

@Xarbirus
Copy link
Contributor

@Xarbirus Xarbirus commented Jan 20, 2025

I encountered some problems when building llama.cpp on windows (for x64 and arm64) on a system where MSVC (with clang) and mingw are installed at the same time.

It seems to me that the condition for adding MATH_LIBRARY to the build is not quite correct. MATH_LIBRARY should not be added if

  • Intel oneAPI is already used (since these libraries include optimized math libraries and tools)
  • or the MSVC compiler is used

An important addition - in case clang is used in the MSVC pipeline, we should not add the library (condition CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC" was added for this). At the same time, when building with mingw, the library can be added.

I think this would also be a solution to this issue (if it hadn't closed).

@github-actions github-actions bot added the ggml changes relating to the ggml tensor library for machine learning label Jan 20, 2025
@slaren
Copy link
Member

slaren commented Jan 28, 2025

I encountered some problems when building llama.cpp on windows (for x64 and arm64) on a system where MSVC (with clang) and mingw are installed at the same time.

Can you suggest a way to reproduce the issue that you are seeing? Does it happen with a specific version of mingw? I have mingw installed alongside MSVC, and the github runners do as well, so at least it doesn't happen in every case.

@Xarbirus
Copy link
Contributor Author

Hi @slaren in my case, the problem occurs when 3 compilers are installed on the system at once: msvc, mingw and clang.
I use vcvarsall.bat to set environment variables, and compile the project with the clang compiler.
The problem looks like this:

[51/134] Linking CXX executable bin\Release\llama-gguf.exe
FAILED: bin/Release/llama-gguf.exe
cmd.exe /C "cd . && C:\PROGRA~1\LLVM\bin\CLANG_~1.EXE --target=x86_64-pc-windows-msvc -fuse-ld=lld-link -nostartfiles -nostdlib -fms-compatibility  -fvectorize -ffp-model=fast -fno-finite-math-only -Wno-format -Wno-unused-variable -Wno-unused-function -Wno-gnu-zero-variadic-macro-arguments -O3 -DNDEBUG -fms-runtime-lib=static -Xlinker /subsystem:console examples/gguf/CMakeFiles/llama-gguf.dir/Release/gguf.cpp.obj -o bin\Release\llama-gguf.exe -Xlinker /implib:examples\gguf\Release\llama-gguf.lib -Xlinker /pdb:bin\Release\llama-gguf.pdb -Xlinker /version:0.0   ggml/src/Release/ggml.lib  ggml/src/Release/ggml-cpu.lib  ggml/src/Release/ggml-base.lib  -lm.lib  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -loldnames && cd ."
lld-link: error: could not open 'm.lib': no such file or directory

In my understanding the problem occurs because cmake finds libraries related to mingw (m.lib) because the path to mingw is in the path environment variable.

@Xarbirus
Copy link
Contributor Author

Xarbirus commented May 5, 2025

Hi @slaren! I would like to clarify if there are any plans to merge this pr?

@slaren
Copy link
Member

slaren commented May 5, 2025

I was not able to reproduce the issue that you mentioned. I have all 3 compilers installed, and so does the github CI. I am not comfortable merging something that I don't understand.

@Xarbirus
Copy link
Contributor Author

Xarbirus commented May 7, 2025

Okay, thanks, I'll try to dig deeper into our CI.

@Xarbirus Xarbirus closed this May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ggml changes relating to the ggml tensor library for machine learning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants