summaryrefslogtreecommitdiff
path: root/gnu/packages
diff options
context:
space:
mode:
authorNicolas Graves <ngraves@ngraves.fr>2025-11-02 16:16:02 +0100
committerHilton Chain <hako@ultrarare.space>2025-11-03 22:53:13 +0800
commitdd076bd669ef3dda27f5ddafd714bcf68c371abd (patch)
tree1f1b16b39851ee3dcfb9261572e21f7ce6051069 /gnu/packages
parent2142fce0562b6bf3f7f5460e069ddf377e5a62b2 (diff)
gnu: tensorflow-lite: Fix package.
Fixes some breakages since the last python-team merge. * gnu/packages/machine-learning.scm (tensorflow-lite) [arguments] <#:configure-flags>: Access OpenCL headers through mesa-headers. <#:phases>: Adapt phase 'build-python to process <#:configure-flags> properly, in particular -DCMAKE_C_FLAGS and -DCMAKE_CXX_FLAGS. [native-inputs]: Add python-setuptools and python-wrapper. Remove python-wheel. [inputs]: Replace python-wrapper by python. Remove opencl-clhpp and opencl-headers, their content is already provided through mesa-headers. Change-Id: I77c287141238081e4df0c8df48f374d8d6aa5a82 Signed-off-by: Hilton Chain <hako@ultrarare.space>
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/machine-learning.scm30
1 files changed, 22 insertions, 8 deletions
diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 93b9dfb5e0f..6ffdc8d6316 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -3230,11 +3230,15 @@ Python.")
#:imported-modules (append %cmake-build-system-modules
%pyproject-build-system-modules)
#:modules '((ice-9 match)
+ (srfi srfi-26)
(guix build utils)
(guix build cmake-build-system)
((guix build pyproject-build-system) #:prefix py:))
#:configure-flags
#~(list
+ ;; Access some OpenCL functions in mesa-headers
+ "-DCMAKE_C_FLAGS=-DCL_ENABLE_BETA_EXTENSIONS=1"
+ "-DCMAKE_CXX_FLAGS=-DCL_ENABLE_BETA_EXTENSIONS=1"
;; "-DTFLITE_KERNEL_TEST=ON" ; TODO: build tests
;; so cmake can be used to find this from other packages
"-DTFLITE_ENABLE_INSTALL=ON"
@@ -3355,11 +3359,22 @@ find_library(ML_DTYPES_LIBRARIES
"build_pip_package_with_cmake.sh")))
(substitute* script
(("\"\\$\\{TENSORFLOW_LITE_DIR\\}\"" all)
- (string-append "${CMAKE_ADDITIONAL_CONFIGURE_FLAGS} "
- all)))
+ (string-append "${ADDITIONAL_CMAKE_FLAGS} " all))
+ (("-D(CMAKE_C[X]*_FLAGS)=\"\\$\\{BUILD_FLAGS\\}" all flag)
+ (string-append all " ${ADDITIONAL_" flag "}")))
(setenv "BUILD_NUM_JOBS" (number->string (parallel-job-count)))
- (setenv "CMAKE_ADDITIONAL_CONFIGURE_FLAGS"
- (string-join configure-flags " "))
+ (let* ((config (map (cut string-split <> #\=) configure-flags))
+ (c-flags (assoc-ref config "-DCMAKE_C_FLAGS"))
+ (config (alist-delete "-DCMAKE_C_FLAGS" config))
+ (cxx-flags (assoc-ref config "-DCMAKE_CXX_FLAGS"))
+ (config (alist-delete "-DCMAKE_CXX_FLAGS" config)))
+ (setenv "ADDITIONAL_CMAKE_C_FLAGS"
+ (string-join c-flags "="))
+ (setenv "ADDITIONAL_CMAKE_CXX_FLAGS"
+ (string-join cxx-flags "="))
+ (setenv "ADDITIONAL_CMAKE_FLAGS"
+ (string-join (map (cut string-join <> "=") config)
+ " ")))
(invoke "sh" script))))
(add-after 'install 'install-extra
(lambda _
@@ -3399,11 +3414,9 @@ find_library(ML_DTYPES_LIBRARIES
mesa-headers
neon2sse
nsync
- opencl-clhpp
- opencl-headers
opencl-icd-loader
pthreadpool
- python-wrapper
+ python ;for its /lib
python-ml-dtypes
ruy
re2
@@ -3416,7 +3429,8 @@ find_library(ML_DTYPES_LIBRARIES
`(("pkg-config" ,pkg-config)
("googletest" ,googletest)
("pybind11" ,pybind11)
- ("python-wheel" ,python-wheel)
+ ("python-setuptools" ,python-setuptools)
+ ("python-wrapper" ,python-wrapper) ;for its /bin
("swig" ,swig)
("farmhash-src"
,(let ((commit "816a4ae622e964763ca0862d9dbd19324a1eaf45"))