Build linux using ubuntu 20.04

This changes the container-based linux build to use an older Ubuntu
distro to improve our compatibility matrix for older user machines
This commit is contained in:
Daniel Hiltgen
2023-12-18 12:05:59 -08:00
parent 35934b2e05
commit 89bbaafa64
3 changed files with 47 additions and 17 deletions

View File

@@ -15,13 +15,20 @@ init_vars() {
}
git_module_setup() {
# TODO add flags to skip the init/patch logic to make it easier to mod llama.cpp code in-repo
if [ -n "${OLLAMA_SKIP_PATCHING}" ] ; then
echo "Skipping submodule initialization"
return
fi
git submodule init
git submodule update --force gguf
}
apply_patches() {
if [ -n "${OLLAMA_SKIP_PATCHING}" ] ; then
echo "Skipping submodule patching"
return
fi
# Workaround git apply not handling creation well for iteration
rm -f gguf/examples/server/server.h
for patch in ${PATCHES} ; do

View File

@@ -3,13 +3,13 @@
#include <stdio.h>
#include <string.h>
#ifndef _WIN32
#ifdef __linux__
#include <dlfcn.h>
#define LOAD_LIBRARY(lib, flags) dlopen(lib, flags)
#define LOAD_LIBRARY(lib, flags) dlopen(lib, flags | RTLD_DEEPBIND)
#define LOAD_SYMBOL(handle, sym) dlsym(handle, sym)
#define LOAD_ERR() dlerror()
#define UNLOAD_LIBRARY(handle) dlclose(handle)
#else
#elif _WIN32
#include <windows.h>
#define LOAD_LIBRARY(lib, flags) LoadLibrary(lib)
#define LOAD_SYMBOL(handle, sym) GetProcAddress(handle, sym)
@@ -20,6 +20,12 @@ inline static char *LOAD_ERR() {
snprintf(errbuf, 8, "0x%lx", GetLastError());
return errbuf;
}
#else
#include <dlfcn.h>
#define LOAD_LIBRARY(lib, flags) dlopen(lib, flags)
#define LOAD_SYMBOL(handle, sym) dlsym(handle, sym)
#define LOAD_ERR() dlerror()
#define UNLOAD_LIBRARY(handle) dlclose(handle)
#endif
void rocm_shim_init(const char *libPath, struct rocm_llama_server *s,
@@ -48,7 +54,7 @@ void rocm_shim_init(const char *libPath, struct rocm_llama_server *s,
};
printf("Lazy loading %s library\n", libPath);
s->handle = LOAD_LIBRARY(libPath, RTLD_LAZY);
s->handle = LOAD_LIBRARY(libPath, RTLD_NOW);
if (!s->handle) {
err->id = -1;
snprintf(