Skip to content

Conversation

@marcom
Copy link
Contributor

@marcom marcom commented Mar 26, 2023

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

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
```
@anzz1
Copy link
Contributor

anzz1 commented Mar 26, 2023

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 .

@marcom
Copy link
Contributor Author

marcom commented Mar 27, 2023

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 anzz1 merged commit 7e53955 into ggml-org:master Mar 27, 2023
anzz1 added a commit that referenced this pull request Mar 27, 2023
Link 'common' to 'ggml' and not to examples as instructed
anzz1 added a commit that referenced this pull request Mar 27, 2023
Still needs to be fixed properly
@anzz1 anzz1 mentioned this pull request Mar 27, 2023
2 tasks
ggerganov pushed a commit that referenced this pull request Mar 28, 2023
* Revert 7e53955 (#542)

Still needs to be fixed properly

* Fix linking on mingw32
@marcom marcom deleted the cmake-windows-examples branch March 30, 2023 13:57
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

Successfully merging this pull request may close these issues.

2 participants