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

Bug: Bug: Cmake fail to build when find MATH_LIBRARY but GGML_SYCL=OFF on windows #9908

Closed
czheji opened this issue Oct 16, 2024 · 1 comment
Labels
bug-unconfirmed high severity Used to report high severity bugs in llama.cpp (Malfunctioning hinder important workflow) stale

Comments

@czheji
Copy link

czheji commented Oct 16, 2024

What happened?

Cmake fail to build on windows with Error:

cmake -B build
cmake --build build --config Release
......
FAILED: bin/ggml.dll ggml/src/ggml.lib
......
lld-link: error: could not open 'm.lib': no such file or directory

When GGML_SYCL=OFF by default and find_library(MATH_LIBRARY m) is true, the error of adding link flag -lm.lib causes compilation failure on windows.

build/build.ninja

......
#############################################
# Link the shared library bin\ggml.dll

build bin/ggml.dll ggml/src/ggml.lib: CXX_SHARED_LIBRARY_LINKER__ggml_Debug ggml/src/CMakeFiles/ggml.dir/ggml.c.obj ggml/src/CMakeFiles/ggml.dir/ggml-alloc.c.obj ggml/src/CMakeFiles/ggml.dir/ggml-backend.cpp.obj ggml/src/CMakeFiles/ggml.dir/ggml-quants.c.obj ggml/src/CMakeFiles/ggml.dir/llamafile/sgemm.cpp.obj ggml/src/CMakeFiles/ggml.dir/ggml-aarch64.c.obj
  LANGUAGE_COMPILE_FLAGS = -O0 -g -Xclang -gcodeview -D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd
  LINK_FLAGS = -Xlinker /DEF:ggml\src\CMakeFiles\ggml.dir\.\exports.def
  LINK_LIBRARIES = -lm.lib  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -loldnames
  OBJECT_DIR = ggml\src\CMakeFiles\ggml.dir
  POST_BUILD = cd .
  PRE_LINK = C:\Windows\system32\cmd.exe /C "C:\msys64\ucrt64\bin\cmake.exe -E __create_def C:\tools\ai_models\llama.cpp\build\ggml\src\CMakeFiles\ggml.dir\.\exports.def C:\tools\ai_models\llama.cpp\build\ggml\src\CMakeFiles\ggml.dir\.\exports.def.objs --nm=C:\msys64\ucrt64\bin\nm.exe && cd C:\tools\ai_models\llama.cpp\build"
  RESTAT = 1
  TARGET_COMPILE_PDB = ggml\src\CMakeFiles\ggml.dir\
  TARGET_FILE = bin\ggml.dll
  TARGET_IMPLIB = ggml\src\ggml.lib
  TARGET_PDB = bin\ggml.pdb


#############################################
......

Related problem code:

if (MATH_LIBRARY)
if (NOT WIN32 OR NOT GGML_SYCL)
list(APPEND GGML_EXTRA_LIBS_PRIVATE m)
endif()
endif()

Line 1361 should be correct: if (NOT WIN32 AND NOT GGML_SYCL)?

Name and Version

git show:
commit 1f66b69 (HEAD -> b3091)

What operating system are you seeing the problem on?

Windows

Relevant log output

No response

@czheji czheji added bug-unconfirmed high severity Used to report high severity bugs in llama.cpp (Malfunctioning hinder important workflow) labels Oct 16, 2024
@github-actions github-actions bot added the stale label Nov 16, 2024
Copy link
Contributor

github-actions bot commented Dec 1, 2024

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
bug-unconfirmed high severity Used to report high severity bugs in llama.cpp (Malfunctioning hinder important workflow) stale
Projects
None yet
Development

No branches or pull requests

1 participant