mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2024-12-29 04:44:34 +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
|
# some memory allocation are available on Linux through GNU extensions in libc
|
||||||
ifeq ($(UNAME_S),Linux)
|
ifeq ($(UNAME_S),Linux)
|
||||||
MK_CPPFLAGS += -D_GNU_SOURCE
|
MK_CPPFLAGS += -D_GNU_SOURCE
|
||||||
|
MK_LDFLAGS += -ldl
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# RLIMIT_MEMLOCK came in BSD, is not specified in POSIX.1,
|
# 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)
|
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)
|
function(ggml_add_backend backend)
|
||||||
string(TOUPPER "GGML_${backend}" backend_id)
|
string(TOUPPER "GGML_${backend}" backend_id)
|
||||||
if (${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();
|
ggml_backend_reg_t reg = backend_init();
|
||||||
if (!reg) {
|
if (!reg) {
|
||||||
GGML_LOG_ERROR("%s: failed to initialize backend from %s\n", __func__, path);
|
GGML_LOG_ERROR("%s: failed to initialize backend from %s\n", __func__, path);
|
||||||
|
#ifdef _WIN32
|
||||||
|
FreeLibrary(handle);
|
||||||
|
#else
|
||||||
dlclose(handle);
|
dlclose(handle);
|
||||||
|
#endif
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
GGML_LOG_DEBUG("%s: loaded %s backend from %s\n", __func__, ggml_backend_reg_name(reg), path);
|
GGML_LOG_DEBUG("%s: loaded %s backend from %s\n", __func__, ggml_backend_reg_name(reg), path);
|
||||||
get_reg().register_backend(reg, handle);
|
get_reg().register_backend(reg, handle);
|
||||||
return reg;
|
return reg;
|
||||||
|
Loading…
Reference in New Issue
Block a user