Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ function(llama_cpp_python_install_target target)
INSTALL_RPATH "$ORIGIN"
BUILD_WITH_INSTALL_RPATH TRUE
)
set_target_properties(${target} PROPERTIES
NO_SONAME TRUE
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
Comment on lines +46 to +47
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these two settings were not configured, an issue arose where the library referenced files under the bin/ folder that did not exist.

❯ readelf -d dist/llama_cpp_python-0.3.20-py3-none-linux_x86_64/llama_cpp/lib/libggml.so

Dynamic section at offset 0xbd98 contains 29 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [bin/libggml-cpu.so]
 0x0000000000000001 (NEEDED)             Shared library: [bin/libggml-base.so]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN]


❯ readelf -d dist/llama_cpp_python-0.3.20-py3-none-linux_x86_64/llama_cpp/lib/libllama.so

Dynamic section at offset 0x2dc128 contains 31 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [bin/libggml.so]
 0x0000000000000001 (NEEDED)             Shared library: [bin/libggml-base.so]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [ld-linux-x86-64.so.2]
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN]

https://github.com/ggml-org/llama.cpp/blob/d6f3030047f85a98b009189e76f441fe818ea44d/CMakeLists.txt#L20-L21

So I overrode the settings in llama-cpp.

)
endif()
endif()
endfunction()
Expand Down