mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2024-12-28 04:14:35 +00:00
link to libdl on linux
This commit is contained in:
parent
ccd8df8a9d
commit
1605605b54
1
Makefile
1
Makefile
@ -290,6 +290,7 @@ endif
|
||||
# some memory allocation are available on Linux through GNU extensions in libc
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
MK_CPPFLAGS += -D_GNU_SOURCE
|
||||
MK_LDFLAGS += -ldl
|
||||
endif
|
||||
|
||||
# RLIMIT_MEMLOCK came in BSD, is not specified in POSIX.1,
|
||||
|
@ -230,6 +230,10 @@ add_library(ggml
|
||||
|
||||
target_link_libraries(ggml PUBLIC ggml-base)
|
||||
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
target_link_libraries(ggml PRIVATE dl)
|
||||
endif()
|
||||
|
||||
function(ggml_add_backend backend)
|
||||
string(TOUPPER "GGML_${backend}" backend_id)
|
||||
if (${backend_id})
|
||||
|
@ -250,9 +250,14 @@ ggml_backend_reg_t ggml_backend_load(const char * path) {
|
||||
ggml_backend_reg_t reg = backend_init();
|
||||
if (!reg) {
|
||||
GGML_LOG_ERROR("%s: failed to initialize backend from %s\n", __func__, path);
|
||||
#ifdef _WIN32
|
||||
FreeLibrary(handle);
|
||||
#else
|
||||
dlclose(handle);
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GGML_LOG_DEBUG("%s: loaded %s backend from %s\n", __func__, ggml_backend_reg_name(reg), path);
|
||||
get_reg().register_backend(reg, handle);
|
||||
return reg;
|
||||
|
Loading…
Reference in New Issue
Block a user