8000 ggml : fix run-time on FreeBSD in get_executable_path() (#10948) · mglambda/llama.cpp@99bb723 · GitHub
[go: up one dir, main page]

Skip to content

Commit 99bb723

Browse files
yurivictmglambda
authored andcommitted
ggml : fix run-time on FreeBSD in get_executable_path() (ggml-org#10948)
1 parent 160d44a commit 99bb723

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ggml/src/ggml-backend-reg.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,12 +402,16 @@ static std::string get_executable_path() {
402402
base_path = base_path.substr(0, last_slash);
403403
}
404404
return base_path + "/";
405-
#elif defined(__linux__)
405+
#elif defined(__linux__) || defined(__FreeBSD__)
406406
std::string base_path = ".";
407407
std::vector<char> path(1024);
408408
while (true) {
409409
// get executable path
410+
# if defined(__linux__)
410411
ssize_t len = readlink("/proc/self/exe", path.data(), path.size());
412+
# elif defined(__FreeBSD__)
413+
ssize_t len = readlink("/proc/curproc/file", path.data(), path.size());
414+
# endif
411415
if (len == -1) {
412416
break;
413417
}

0 commit comments

Comments
 (0)
0