From 0f6eeacecff738a00ec1ecf1d17346ca23a44e91 Mon Sep 17 00:00:00 2001 From: Yogthos Date: Tue, 13 Oct 2026 17:26:15 -0400 Subject: [PATCH 1/2] Fix the release build: PIC llama.cpp, empty mlx archive when absent jolt build links the archives into a shared object, and GNU ld refuses llama-common's non-PIC objects there. It also links every :static archive, optional or not, so a tree without jolt mlx (CI, linux) failed on the missing liblev_mlx.a; an empty archive stands in and lev.mlx reports itself unavailable. --- deps.edn | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/deps.edn b/deps.edn index 8679647..e44c3be 100644 --- a/deps.edn +++ b/deps.edn @@ -125,7 +125,9 @@ (shell "git" "-C" dir "checkout" "--quiet" "FETCH_HEAD")) (when-not (fs/exists? (str dir "/build/common/libllama-common.a")) (apply shell "cmake" "-S" dir "-B" (str dir "/build") "-DCMAKE_BUILD_TYPE=Release" - "-DBUILD_SHARED_LIBS=OFF" "-DGGML_OPENMP=OFF" "-DGGML_NATIVE=OFF" "-DGGML_CPU_ALL_VARIANTS=OFF" + ;; position-independent: jolt build links the archives into a + ;; shared object, which GNU ld refuses non-PIC code for + "-DBUILD_SHARED_LIBS=OFF" "-DCMAKE_POSITION_INDEPENDENT_CODE=ON" "-DGGML_OPENMP=OFF" "-DGGML_NATIVE=OFF" "-DGGML_CPU_ALL_VARIANTS=OFF" "-DLLAMA_BUILD_TESTS=OFF" "-DLLAMA_BUILD_EXAMPLES=OFF" "-DLLAMA_BUILD_TOOLS=OFF" "-DLLAMA_BUILD_SERVER=OFF" "-DLLAMA_BUILD_APP=OFF" "-DLLAMA_CURL=OFF" ;; llama-common (the decision engine's tokenizer and batch @@ -173,9 +175,13 @@ "python" "bench/clef_golden.py" dir "golden/clef"))} binary - {:doc "build the standalone HTTP server ./lev-server (kernels and llama.cpp linked in, mlx too when native/liblev_mlx.a is built) and self-test it against golden/" + {:doc "build the standalone HTTP server ./lev-server (kernels and llama.cpp linked in; mlx when `jolt mlx` built it, else an empty archive stands in) and self-test it against golden/" :depends [kernels llama] - :task (do (shell "jolt" "build" "-m" "lev.server" "-o" "lev-server") + :task (do ;; jolt build links every :static archive, optional or not: without + ;; `jolt mlx` an empty one stands in, and lev.mlx/available? is false + (when-not (fs/exists? "native/liblev_mlx.a") + (spit "native/liblev_mlx.a" "!\n")) + (shell "jolt" "build" "-m" "lev.server" "-o" "lev-server") ;; the suite runs interpreted; the AOT build must prove itself (shell "./lev-server" "--self-test" "--data" "data" "--golden" "golden") (println "built: ./lev-server (run: ./lev-server --data data --port 8080)"))} From 1bd5f0da8bffde0602d3d4514cde271675bd40f1 Mon Sep 17 00:00:00 2001 From: Yogthos Date: Tue, 13 Oct 2026 17:43:24 -0400 Subject: [PATCH 2/2] build_llm.sh: the QuartzCore stub deps.edn links deps.edn links QuartzCore on mac, and only build_mlx.sh made its stub, so a tree without jolt mlx failed the binary's link. --- native/build_llm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native/build_llm.sh b/native/build_llm.sh index b1d369b..618d804 100755 --- a/native/build_llm.sh +++ b/native/build_llm.sh @@ -31,7 +31,7 @@ case "$(uname -s)" in # :static {:lib ...} entries can express sdk=$(xcrun --show-sdk-path) mkdir -p native/frameworks - for f in Metal Foundation MetalKit Accelerate; do + for f in Metal Foundation MetalKit Accelerate QuartzCore; do ln -sf "$sdk/System/Library/Frameworks/$f.framework/$f.tbd" "native/frameworks/lib$f.tbd" done ;;