Skip to content

Commit 8415622

Browse files
committed
fix(main/python-onnxruntime): reorganize capi .so files
- Fixes #28769 - They stopped being installed automatically for some reason in Python 3.13, so install them manually, and implement the `libonnxruntime.so` and `libonnxruntime_providers_shared.so` files for Python using symbolic links and a dependency on the parent package
1 parent c5312f2 commit 8415622

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

packages/onnxruntime/build.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="Cross-platform, high performance ML inferencing and trai
33
TERMUX_PKG_LICENSE="MIT"
44
TERMUX_PKG_MAINTAINER="@termux"
55
TERMUX_PKG_VERSION="1.24.3"
6+
TERMUX_PKG_REVISION=1
67
TERMUX_PKG_SRCURL=git+https://github.com/microsoft/onnxruntime
78
TERMUX_PKG_DEPENDS="abseil-cpp, libc++, protobuf, libre2"
89
TERMUX_PKG_BUILD_IN_SRC=true
@@ -64,5 +65,15 @@ termux_step_make_install() {
6465

6566
local _pyver="${TERMUX_PYTHON_VERSION//./}"
6667
local _wheel="onnxruntime-${TERMUX_PKG_VERSION}-cp${_pyver}-cp${_pyver}-android_${TERMUX_ARCH}.whl"
67-
pip install --no-deps --prefix="$TERMUX_PREFIX" "$TERMUX_PKG_SRCDIR/dist/${_wheel}"
68+
pip install --force-reinstall --no-deps --prefix="$TERMUX_PREFIX" "$TERMUX_PKG_SRCDIR/dist/${_wheel}"
69+
}
70+
71+
termux_step_post_make_install() {
72+
# for some reason in python 3.13, these are no longer getting installed automatically
73+
install -Dm644 onnxruntime_pybind11_state.so \
74+
-t "$TERMUX_PYTHON_HOME/site-packages/onnxruntime/capi"
75+
ln -sf "$TERMUX_PREFIX/lib/libonnxruntime.so" \
76+
"$TERMUX_PYTHON_HOME/site-packages/onnxruntime/capi/libonnxruntime.so"
77+
ln -sf "$TERMUX_PREFIX/lib/libonnxruntime_providers_shared.so" \
78+
"$TERMUX_PYTHON_HOME/site-packages/onnxruntime/capi/libonnxruntime_providers_shared.so"
6879
}

packages/onnxruntime/python-onnxruntime.subpackage.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@ bin
44
lib/python*
55
"
66
TERMUX_SUBPKG_DEPENDS="python, python-numpy, python-pip"
7-
TERMUX_SUBPKG_DEPEND_ON_PARENT=deps

0 commit comments

Comments
 (0)