mirror of
https://github.com/termux-pacman/termux-packages.git
synced 2026-02-11 04:10:52 +00:00
- debpython is the commands `py3compile` and `py3clean` from Debian. I
am calling them that because a large chunk of their source code is
found inside a folder inside Debian's source code named "debpython"
- 5348f70466
- rather than packaging `.pyc` files into packages, `py3compile` and
`py3clean` can be called from `postinst` and `prerm` scripts to
generate all `.pyc` for the `.py` files in the package immediately
after the package is installed, and remove all `.pyc` files immediately
before uninstalling the package, respectively
- fixes the error `trying to overwrite '/data/data/com.termux/files/usr/lib/python3.12/__pycache__/cProfile.cpython-312.pyc'` when packages were built on-device, but at the same time, also:
- prevents the warnings `dpkg: warning: while removing python, directory '/data/data/com.termux/files/usr/lib/python3.12/site-packages' not empty so not removed` as long as no packages were installed using `pip`
- The `termux_step_create_python_debscripts.sh` can configure work on debpython (i.e. its `py3copile` and `py3clean` commands) from the glibc package `python-glibc`, if some glibc package is being compiled.
- New variables have been implemented:
- `TERMUX_PYTHON_CROSSENV_BUILDHOME` - location of crossenv's python build libraries.
- `TERMUX_PKG_PYTHON_RUNTIME_DEPS` - configures the installation of the python modules via pip3 in the pkg's debscripts. If not configured in the package, it will use the value from `TERMUX_PKG_PYTHON_TARGET_DEPS`. If the variable is set to `false`, then the customization of installing python modules will be disabled, even if the `TERMUX_PKG_PYTHON_TARGET_DEPS` variable is set in the package.
- `TERMUX_SUBPKG_PYTHON_RUNTIME_DEPS` - configures the installation of the python modules via pip3 in the subpkg's debscripts.
- Implemented reconfiguration of prefixes in python module `sysconfig` and setting in `TERMUX_PYTHON_CROSSENV_BUILDHOME`, so that python modules from crossenv building can specify system paths of termux for correct compilation.
- Added automatic addition of `python-glibc{-glibc}` dependency when using the `TERMUX_PKG_PYTHON_RUNTIME_DEPS` (for pkg; will be disabled, i.e. will not be added, if the variable is set to `false`) or `TERMUX_SUBPKG_PYTHON_RUNTIME_DEPS` (for subpkg) value.
> How to add a new Python package after this?
Everything is the same, except, now, this block is no longer necessary in `build.sh`.
```bash
termux_step_create_debscripts() {
cat <<- EOF > ./postinst
#!$TERMUX_PREFIX/bin/sh
echo "Installing dependencies through pip..."
pip3 install ${TERMUX_PKG_PYTHON_TARGET_DEPS//, / }
EOF
}
```
- Instead, `scripts/build/termux_step_create_python_debscripts.sh` can now detect the presence of `pip` package lists in `$TERMUX_PKG_PYTHON_TARGET_DEPS`, `$TERMUX_SUBPKG_PYTHON_TARGET_DEPS`, and the `METADATA` file of the Python package if it exists, and automatically insert them as a block into the `postinst` script for all relevant packages.
- `$TERMUX_PKG_PYTHON_TARGET_DEPS` is used for `pip` dependencies that are both on-device build-time and on-device run-time dependencies, and `$TERMUX_PKG_PYTHON_RUNTIME_DEPS` is used for runtime-only `pip` dependencies. `$TERMUX_PKG_PYTHON_RUNTIME_DEPS` overrides `$TERMUX_PKG_PYTHON_TARGET_DEPS` for runtime dependencies,
- i.e. if `TERMUX_PKG_PYTHON_RUNTIME_DEPS` is not specified, but `TERMUX_PKG_PYTHON_TARGET_DEPS` is, then `TERMUX_PKG_PYTHON_TARGET_DEPS` will be used as both on-device build and on-device runtime dependencies,
- but if `TERMUX_PKG_PYTHON_RUNTIME_DEPS` is specified, then `TERMUX_PKG_PYTHON_TARGET_DEPS`, if specified, is used only for on-device build-time dependencies.
- If `python-pip` is not already in the dependencies of any package that needs it, the build will fail with an error instructing maintainers to add `python-pip` to the dependencies of the package that needs it.
Co-authored-by: Maxython <mixython@gmail.com>
65 lines
3.2 KiB
Diff
65 lines
3.2 KiB
Diff
From c79a2c525edce42523b35da3edb87ae937a6e5b1 Mon Sep 17 00:00:00 2001
|
|
From: Yulong Wang <7679871+fs-eire@users.noreply.github.com>
|
|
Date: Thu, 31 Jul 2025 15:02:37 -0700
|
|
Subject: [PATCH] [build] fix macOS x86_64 cross-compile warning
|
|
|
|
---
|
|
cmake/CMakeLists.txt | 1 +
|
|
cmake/onnxruntime_config.h.in | 1 +
|
|
.../lib/sqnbitgemm_kernel_avx2_int8_blklen32.h | 17 +++++++++++++++++
|
|
3 files changed, 19 insertions(+)
|
|
|
|
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
|
|
index a76be16572a03..bdc18c424efd1 100644
|
|
--- a/cmake/CMakeLists.txt
|
|
+++ b/cmake/CMakeLists.txt
|
|
@@ -558,6 +558,7 @@ else()
|
|
check_cxx_compiler_flag(-Wambiguous-reversed-operator HAS_AMBIGUOUS_REVERSED_OPERATOR)
|
|
# -Winterference-size was added in GCC 13
|
|
check_cxx_compiler_flag(-Winterference-size HAS_INTERFERENCE_SIZE)
|
|
+ check_cxx_compiler_flag(-Warray-bounds HAS_ARRAY_BOUNDS)
|
|
check_cxx_compiler_flag(-Wbitwise-instead-of-logical HAS_BITWISE_INSTEAD_OF_LOGICAL)
|
|
check_cxx_compiler_flag(-Wcast-function-type HAS_CAST_FUNCTION_TYPE)
|
|
check_cxx_compiler_flag(-Wcatch-value HAS_CATCH_VALUE)
|
|
diff --git a/cmake/onnxruntime_config.h.in b/cmake/onnxruntime_config.h.in
|
|
index f82a23bf4026b..a36f735c507ba 100644
|
|
--- a/cmake/onnxruntime_config.h.in
|
|
+++ b/cmake/onnxruntime_config.h.in
|
|
@@ -3,6 +3,7 @@
|
|
|
|
#pragma once
|
|
|
|
+#cmakedefine HAS_ARRAY_BOUNDS
|
|
#cmakedefine HAS_BITWISE_INSTEAD_OF_LOGICAL
|
|
#cmakedefine HAS_CAST_FUNCTION_TYPE
|
|
#cmakedefine HAS_CATCH_VALUE
|
|
diff --git a/onnxruntime/core/mlas/lib/sqnbitgemm_kernel_avx2_int8_blklen32.h b/onnxruntime/core/mlas/lib/sqnbitgemm_kernel_avx2_int8_blklen32.h
|
|
index d2d9886ab61f7..a745dd9f1376d 100644
|
|
--- a/onnxruntime/core/mlas/lib/sqnbitgemm_kernel_avx2_int8_blklen32.h
|
|
+++ b/onnxruntime/core/mlas/lib/sqnbitgemm_kernel_avx2_int8_blklen32.h
|
|
@@ -1660,7 +1660,24 @@ MlasQ4Int8TileGemmKernelBlkLen32Avx2(
|
|
|
|
if constexpr (NCols4 == 8) {
|
|
__m128 acc_0 = FoldAccumulators(acc[0], acc[1], acc[2], acc[3]);
|
|
+
|
|
+ // Clang is not happy with the code here, even if constexpr `NCols4 == 8` is always false in this context:
|
|
+ //
|
|
+ // In file included from .../onnxruntime/core/mlas/lib/sqnbitgemm_kernel_avx2.cpp:26:
|
|
+ // .../onnxruntime/core/mlas/lib/sqnbitgemm_kernel_avx2_int8_blklen32.h:1663:49: error: array index 4 is past the end of the array (that has type '__m256[4]') [-Werror,-Warray-bounds]
|
|
+ // 1663 | __m128 acc_1 = FoldAccumulators(acc[4], acc[5], acc[6], acc[7]);
|
|
+ // | ^ ~
|
|
+ // .../onnxruntime/core/mlas/lib/sqnbitgemm_kernel_avx2_int8_blklen32.h:1531:13: note: array 'acc' declared here
|
|
+ // 1531 | __m256 acc[NCols4];
|
|
+ // | ^
|
|
+#if defined(__clang__)
|
|
+#pragma clang diagnostic push
|
|
+#pragma clang diagnostic ignored "-Warray-bounds"
|
|
+#endif
|
|
__m128 acc_1 = FoldAccumulators(acc[4], acc[5], acc[6], acc[7]);
|
|
+#if defined(__clang__)
|
|
+#pragma clang diagnostic pop
|
|
+#endif
|
|
if (BiasPtr != nullptr) {
|
|
acc_0 = _mm_add_ps(acc_0, _mm_loadu_ps(BiasPtr));
|
|
acc_1 = _mm_add_ps(acc_1, _mm_loadu_ps(BiasPtr + 4));
|