Fix missing ggml link in cmake for executables in examples on w64-mingw32#542
Merged
anzz1 merged 1 commit intoggml-org:masterfrom Mar 27, 2023
Merged
Conversation
Without this I get linking errors on x86_64-w64-mingw32 (on linux I don't need this patch): ``` [01:33:38] [ 50%] Linking CXX executable ../../bin/main.exe [01:33:38] cd /workspace/srcdir/llama.cpp/build/examples/main && /usr/bin/cmake -E cmake_link_script CMakeFiles/main.dir/link.txt --verbose=true [01:33:38] /usr/bin/cmake -E rm -f CMakeFiles/main.dir/objects.a [01:33:38] /opt/bin/x86_64-w64-mingw32-libgfortran5-cxx11/x86_64-w64-mingw32-ar qc CMakeFiles/main.dir/objects.a @CMakeFiles/main.dir/objects1.rsp [01:33:38] /opt/bin/x86_64-w64-mingw32-libgfortran5-cxx11/x86_64-w64-mingw32-g++ --sysroot=/opt/x86_64-w64-mingw32/x86_64-w64-mingw32/sys-root/ -O3 -DNDEBUG -Wl,--whole-archive CMakeFiles/main.dir/objects.a -Wl,--no-whole-archive -o ../../bin/main.exe -Wl,--out-implib,libmain.dll.a -Wl,--major-image-version,0,--minor-image-version,0 @CMakeFiles/main.dir/linklibs.rsp [01:33:38] /opt/x86_64-w64-mingw32/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld: CMakeFiles/main.dir/objects.a(common.cpp.obj):common.cpp:(.text+0x4c8): undefined reference to `ggml_mlock_supported' [01:33:38] collect2: error: ld returned 1 exit status ```
Contributor
|
FYI, conventional wisdom says you lose speed with mingw since gcc on windows isn't particularly awesome and msvc and clang generally produce better optimized code. then again, the codebase on this project is lean so I'm not sure to which extent the choice of compiler matters and it hasn't been thoroughly tested yet so ymmv. but just something to keep in mind . |
Contributor
Author
|
Agreed. In this case though, I am trying to get llama.cpp to build in Julia's BinaryBuilder cross-compiling environment and have to use this setup for the Windows targets. |
anzz1
approved these changes
Mar 27, 2023
2 tasks
ggerganov
pushed a commit
that referenced
this pull request
Mar 28, 2023
SamuelOliveirads
pushed a commit
to SamuelOliveirads/llama.cpp
that referenced
this pull request
Dec 29, 2025
Co-authored-by: Iwan Kawrakow <iwan.kawrakow@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Without this I get linking errors on x86_64-w64-mingw32 (on linux I don't need this patch):