Fix CPU-only build under Android Termux enviornment.
Update gpu.go initGPUHandles() to declare gpuHandles variable before reading it. This resolves an "invalid memory address or nil pointer dereference" error. Update dyn_ext_server.c to avoid setting the RTLD_DEEPBIND flag under __TERMUX__ (Android).
This commit is contained in:
parent
d017e3d0a6
commit
eb76f3e379
2 changed files with 2 additions and 2 deletions
|
@ -63,6 +63,7 @@ func initGPUHandles() {
|
||||||
|
|
||||||
// TODO - if the ollama build is CPU only, don't do these checks as they're irrelevant and confusing
|
// TODO - if the ollama build is CPU only, don't do these checks as they're irrelevant and confusing
|
||||||
|
|
||||||
|
gpuHandles = &handles{nil, nil}
|
||||||
var cudaMgmtName string
|
var cudaMgmtName string
|
||||||
var cudaMgmtPatterns []string
|
var cudaMgmtPatterns []string
|
||||||
var rocmMgmtName string
|
var rocmMgmtName string
|
||||||
|
@ -87,7 +88,6 @@ func initGPUHandles() {
|
||||||
}
|
}
|
||||||
|
|
||||||
slog.Info("Detecting GPU type")
|
slog.Info("Detecting GPU type")
|
||||||
gpuHandles = &handles{nil, nil}
|
|
||||||
cudaLibPaths := FindGPULibs(cudaMgmtName, cudaMgmtPatterns)
|
cudaLibPaths := FindGPULibs(cudaMgmtName, cudaMgmtPatterns)
|
||||||
if len(cudaLibPaths) > 0 {
|
if len(cudaLibPaths) > 0 {
|
||||||
cuda := LoadCUDAMgmt(cudaLibPaths)
|
cuda := LoadCUDAMgmt(cudaLibPaths)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef __linux__
|
#if defined(__linux__) && !defined(__TERMUX__)
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#define LOAD_LIBRARY(lib, flags) dlopen(lib, flags)
|
#define LOAD_LIBRARY(lib, flags) dlopen(lib, flags)
|
||||||
#define LOAD_SYMBOL(handle, sym) dlsym(handle, sym)
|
#define LOAD_SYMBOL(handle, sym) dlsym(handle, sym)
|
||||||
|
|
Loading…
Reference in a new issue