[PATCH] gnu: llama-cpp: Update configure flags for shared library build.

  • Open
  • quality assurance status badge
Details
2 participants
  • Andy Tai
  • Christopher Baines
Owner
unassigned
Submitted by
Andy Tai
Severity
normal
A
A
Andy Tai wrote on 27 May 07:16 +0200
(address . guix-patches@gnu.org)(name . Andy Tai)(address . atai@atai.org)
6c6fc91b2febb791d50aac5e9a16a220090eb31d.1716786995.git.atai@atai.org
* gnu/packages/machine-learning.scm (lama-cpp):
[arguments](configure-flags): add cmake configure flag
to force position independent code generation from C
compiler for shared library build.

Change-Id: I7c4bc219a22aa9a949e811b340c7cf745b176d14
---
gnu/packages/machine-learning.scm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Toggle diff (18 lines)
diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index a385ddc18c..398b42f203 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -541,7 +541,8 @@ (define-public llama-cpp
(build-system cmake-build-system)
(arguments
(list
- #:configure-flags #~'("-DLLAMA_BLAS=ON"
+ #:configure-flags #~'("-DCMAKE_POSITION_INDEPENDENT_CODE=TRUE"
+ "-DLLAMA_BLAS=ON"
"-DLLAMA_BLAS_VENDOR=OpenBLAS"
"-DLLAMA_NATIVE=OFF" ;no '-march=native'

base-commit: 0f3a25a25e212bfa8ab9db37d267fb260a087e5d
--
2.34.1
A
A
Andy Tai wrote on 28 May 03:57 +0200
[PATCH v2] gnu: llama-cpp: Update configure flags for shared library build.
(address . 71219@debbugs.gnu.org)(name . Andy Tai)(address . atai@atai.org)
b2a196560fbe78b0d9bd4e52a69c73eabaa9a331.1716861417.git.atai@atai.org
* gnu/packages/machine-learning.scm (lama-cpp):
[arguments](configure-flags): add cmake configure flag
for shared library build.

Change-Id: I7c4bc219a22aa9a949e811b340c7cf745b176d14
---
gnu/packages/machine-learning.scm | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

Toggle diff (29 lines)
diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index a385ddc18c..8a332a8b6f 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -541,7 +541,8 @@ (define-public llama-cpp
(build-system cmake-build-system)
(arguments
(list
- #:configure-flags #~'("-DLLAMA_BLAS=ON"
+ #:configure-flags #~'("-DBUILD_SHARED_LIBS=ON"
+ "-DLLAMA_BLAS=ON"
"-DLLAMA_BLAS_VENDOR=OpenBLAS"
"-DLLAMA_NATIVE=OFF" ;no '-march=native'
@@ -591,7 +592,9 @@ (define-public llama-cpp
(assoc-ref python:%standard-phases 'wrap))
(add-after 'install 'install-main
(lambda _
- (copy-file "bin/main" (string-append #$output "/bin/llama")))))))
+ (with-directory-excursion (string-append #$output "/bin")
+ (symlink "main" "llama"))))
+ )))
(inputs (list python))
(native-inputs (list pkg-config))
(propagated-inputs

base-commit: 0f3a25a25e212bfa8ab9db37d267fb260a087e5d
--
2.34.1
A
A
Andy Tai wrote on 3 Jun 17:43 +0200
[PATCH v3] gnu: llama-cpp: Update commit and update configure flags for shared library build.
(address . 71219@debbugs.gnu.org)(name . Andy Tai)(address . atai@atai.org)
eae7af5ced66a701650277bf2b43ba25dd0e5031.1717429389.git.atai@atai.org
* gnu/packages/machine-learning.scm (lama-cpp): Update to commit a5735e with
pkf-config support.
[arguments](configure-flags): add cmake configure flag
for shared library build.
(phases) 'install-python-scripts: Remove references to deleted scripts
and add new ones upsteeam.

Change-Id: I7c4bc219a22aa9a949e811b340c7cf745b176d14
---
gnu/packages/machine-learning.scm | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

Toggle diff (51 lines)
diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index a385ddc18c..52966bd8bc 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -524,7 +524,7 @@ (define-public guile-aiscm-next
(deprecated-package "guile-aiscm-next" guile-aiscm))
(define-public llama-cpp
- (let ((commit "fed0108491a3a3cbec6c6480dc8667ffff9d7659")
+ (let ((commit "a5735e4426b19a3ebd0c653ad8ac01420458ee95")
(revision "2"))
(package
(name "llama-cpp")
@@ -537,11 +537,12 @@ (define-public llama-cpp
(commit commit)))
(file-name (git-file-name name version))
(sha256
- (base32 "16rm9gy0chd6k07crm8rkl2j3hg7y7h0km7k6c8q7bmm2jrd64la"))))
+ (base32 "0nx55wchwf204ld6jygfn37cjrzc4lspwn5v0qk8i6p92499bv0h"))))
(build-system cmake-build-system)
(arguments
(list
- #:configure-flags #~'("-DLLAMA_BLAS=ON"
+ #:configure-flags #~'("-DBUILD_SHARED_LIBS=ON"
+ "-DLLAMA_BLAS=ON"
"-DLLAMA_BLAS_VENDOR=OpenBLAS"
"-DLLAMA_NATIVE=OFF" ;no '-march=native'
@@ -584,14 +585,14 @@ (define-public llama-cpp
(mkdir-p bin)
(make-script "convert-hf-to-gguf")
(make-script "convert-llama-ggml-to-gguf")
- (make-script "convert-lora-to-ggml")
- (make-script "convert-persimmon-to-gguf")
- (make-script "convert"))))
+ (make-script "convert-hf-to-gguf-update.py"))))
(add-after 'install-python-scripts 'wrap-python-scripts
(assoc-ref python:%standard-phases 'wrap))
(add-after 'install 'install-main
(lambda _
- (copy-file "bin/main" (string-append #$output "/bin/llama")))))))
+ (with-directory-excursion (string-append #$output "/bin")
+ (symlink "main" "llama"))))
+ )))
(inputs (list python))
(native-inputs (list pkg-config))
(propagated-inputs

base-commit: 879fc9b3f0c2e58c6232da03b94eba98c78e2d99
--
2.34.1
A
C
C
Christopher Baines wrote on 6 Jun 20:12 +0200
(name . Andy Tai)(address . atai@atai.org)(address . 71219@debbugs.gnu.org)
87plsuc54k.fsf@cbaines.net
Andy Tai <atai@atai.org> writes:

Toggle quote (3 lines)
> patch passes Guix QA
> https://qa.guix.gnu.org/issue/71219

It does, but the build is still failing.

The status is "Succeeding" overall because the package was failing to
build before, so the situation isn't worse.
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmZh/AxfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9XcAyQ//SlFUlodB6hJg6fluaRfi1aqXZcq+hE28
tPc3eswcmzTNW5N/lGOHDzxRcd5XBQxTHhOAlyCJzvnKcsuVNI7oGELU3i6jiq2W
KJzA1+nb/sSxffZxw6Pza03r5W+Ye2FJLwiyCKNx32r2RtWEbmtEdPlsHBppC8x6
jZt3jTj7txoKqz+COMbG3s0HE36nvxZzzk9jMpDGuUiA0x9Itr3IxKd2Q4mWWzKq
aAcfz7tkCrhSmN0soJelFs4Iu/6DPh2RGf00FmaiCLwGoUa225RIHU7QEK8ayOiI
nfEftWfM7p20NVJq1Mn2v8z+T4Q89fJhuKXmC5yF15tslxrz19iu2VqOWqmtq6eV
G/jDM4b0e/hSbXkmiJfhrKTVkx6IEW2k0WAebjo634+tapnRuESGC8HCLxCsv8CD
0jfH5+LJReZSdav2bpMY3T02PzcGDD6E0W4CCt6W9ronuuE7G0VpkqdDAmInpJA1
KdAEf5FVSwtBWhJGcXIsmu9BY5GehFH6A70tAsTe4wTbJeqePRdYhMa4xd2H7mr9
skRdVNE3MBzDgrDAh3JMEBI8xyZCoxbrpMxm03/CP8wBd3N4RM6m6ebb5d0Uwf6m
emH+LxZzIMb0Rko19offRMgTyzOkGaijd2fc0IUSCtTxbK8I7ex7B4WUmaOCmSps
aTixpnnu35I=
=FNPb
-----END PGP SIGNATURE-----

A
A
Andy Tai wrote on 11 Jun 13:41 +0200
[PATCH v4] gnu: llama-cpp: Update commit and update configure flags for shared library build.
(address . 71219@debbugs.gnu.org)(name . Andy Tai)(address . atai@atai.org)
6757d7bf6c980f67a9dbae7af763ac1eeb0d34b6.1718090954.git.atai@atai.org
* gnu/packages/machine-learning.scm (lama-cpp): Update to commit a5735e with
pkf-config support.
[arguments](configure-flags): add cmake configure flag
for shared library build and adjust arguments to make openblas
found by cmake.
(phases) 'install-python-scripts: Remove references to deleted scripts
and add new ones upsteeam.

Change-Id: I7c4bc219a22aa9a949e811b340c7cf745b176d14
---
gnu/packages/machine-learning.scm | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)

Toggle diff (55 lines)
diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index a385ddc18c..f433f8cd65 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -524,7 +524,7 @@ (define-public guile-aiscm-next
(deprecated-package "guile-aiscm-next" guile-aiscm))
(define-public llama-cpp
- (let ((commit "fed0108491a3a3cbec6c6480dc8667ffff9d7659")
+ (let ((commit "a5735e4426b19a3ebd0c653ad8ac01420458ee95")
(revision "2"))
(package
(name "llama-cpp")
@@ -537,12 +537,16 @@ (define-public llama-cpp
(commit commit)))
(file-name (git-file-name name version))
(sha256
- (base32 "16rm9gy0chd6k07crm8rkl2j3hg7y7h0km7k6c8q7bmm2jrd64la"))))
+ (base32 "0nx55wchwf204ld6jygfn37cjrzc4lspwn5v0qk8i6p92499bv0h"))))
(build-system cmake-build-system)
(arguments
(list
- #:configure-flags #~'("-DLLAMA_BLAS=ON"
+ #:configure-flags
+ #~(list "-DBUILD_SHARED_LIBS=ON"
+ "-DLLAMA_BLAS=ON"
"-DLLAMA_BLAS_VENDOR=OpenBLAS"
+ (string-append "-DBLAS_INCLUDE_DIRS=" #$(this-package-input "openblas") "/include")
+ (string-append "-DBLAS_LIBRARIES=" #$(this-package-input "openblas") "/lib/libopenblas.so")
"-DLLAMA_NATIVE=OFF" ;no '-march=native'
"-DLLAMA_FMA=OFF" ;and no '-mfma', etc.
@@ -584,14 +588,14 @@ (define-public llama-cpp
(mkdir-p bin)
(make-script "convert-hf-to-gguf")
(make-script "convert-llama-ggml-to-gguf")
- (make-script "convert-lora-to-ggml")
- (make-script "convert-persimmon-to-gguf")
- (make-script "convert"))))
+ (make-script "convert-hf-to-gguf-update.py"))))
(add-after 'install-python-scripts 'wrap-python-scripts
(assoc-ref python:%standard-phases 'wrap))
(add-after 'install 'install-main
(lambda _
- (copy-file "bin/main" (string-append #$output "/bin/llama")))))))
+ (with-directory-excursion (string-append #$output "/bin")
+ (symlink "main" "llama"))))
+ )))
(inputs (list python))
(native-inputs (list pkg-config))
(propagated-inputs

base-commit: bc8a41f4a8d9f1f0525d7bc97c67ed3c8aea3111
--
2.45.1
A
A
Andy Tai wrote on 11 Jun 14:02 +0200
[PATCH v5] gnu: llama-cpp: Update commit and configure flags for shared library build.
(address . 71219@debbugs.gnu.org)(name . Andy Tai)(address . atai@atai.org)
ab9b424e00a75d471fc4cfaadb71f765ef40d413.1718107292.git.atai@atai.org
* gnu/packages/machine-learning.scm (lama-cpp): Update to commit a5735e with
pkg-config support.
[arguments](configure-flags): Add cmake configure flag
for shared library build and adjust arguments to make openblas
found by cmake.
(phases) 'install-python-scripts: Remove references to deleted scripts
and add new ones upsteeam.

Change-Id: I7c4bc219a22aa9a949e811b340c7cf745b176d14
---
gnu/packages/machine-learning.scm | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)

Toggle diff (55 lines)
diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index a385ddc18c..f433f8cd65 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -524,7 +524,7 @@ (define-public guile-aiscm-next
(deprecated-package "guile-aiscm-next" guile-aiscm))
(define-public llama-cpp
- (let ((commit "fed0108491a3a3cbec6c6480dc8667ffff9d7659")
+ (let ((commit "a5735e4426b19a3ebd0c653ad8ac01420458ee95")
(revision "2"))
(package
(name "llama-cpp")
@@ -537,12 +537,16 @@ (define-public llama-cpp
(commit commit)))
(file-name (git-file-name name version))
(sha256
- (base32 "16rm9gy0chd6k07crm8rkl2j3hg7y7h0km7k6c8q7bmm2jrd64la"))))
+ (base32 "0nx55wchwf204ld6jygfn37cjrzc4lspwn5v0qk8i6p92499bv0h"))))
(build-system cmake-build-system)
(arguments
(list
- #:configure-flags #~'("-DLLAMA_BLAS=ON"
+ #:configure-flags
+ #~(list "-DBUILD_SHARED_LIBS=ON"
+ "-DLLAMA_BLAS=ON"
"-DLLAMA_BLAS_VENDOR=OpenBLAS"
+ (string-append "-DBLAS_INCLUDE_DIRS=" #$(this-package-input "openblas") "/include")
+ (string-append "-DBLAS_LIBRARIES=" #$(this-package-input "openblas") "/lib/libopenblas.so")
"-DLLAMA_NATIVE=OFF" ;no '-march=native'
"-DLLAMA_FMA=OFF" ;and no '-mfma', etc.
@@ -584,14 +588,14 @@ (define-public llama-cpp
(mkdir-p bin)
(make-script "convert-hf-to-gguf")
(make-script "convert-llama-ggml-to-gguf")
- (make-script "convert-lora-to-ggml")
- (make-script "convert-persimmon-to-gguf")
- (make-script "convert"))))
+ (make-script "convert-hf-to-gguf-update.py"))))
(add-after 'install-python-scripts 'wrap-python-scripts
(assoc-ref python:%standard-phases 'wrap))
(add-after 'install 'install-main
(lambda _
- (copy-file "bin/main" (string-append #$output "/bin/llama")))))))
+ (with-directory-excursion (string-append #$output "/bin")
+ (symlink "main" "llama"))))
+ )))
(inputs (list python))
(native-inputs (list pkg-config))
(propagated-inputs

base-commit: bc8a41f4a8d9f1f0525d7bc97c67ed3c8aea3111
--
2.45.1
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 71219@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 71219
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch