Page MenuHomeFreeBSD

misc/py-onnxruntime: Fix wheel missing the compiled pybind extension
Needs ReviewPublic

Authored by michaelo on Sat, Aug 15, 4:56 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Aug 15, 7:54 PM
Unknown Object (File)
Sat, Aug 15, 7:53 PM
Unknown Object (File)
Sat, Aug 15, 6:08 PM
Subscribers
None

Details

Reviewers
yuri
Summary

setup.py's per-platform "libs" list decides which capi/ files get bundled
into the wheel as package data. It has dedicated branches for Linux
(manylinux and non-manylinux), Darwin, and Windows, but none for FreeBSD --
which silently fell through to the Windows-oriented default, whose *.dll/
*.pyd glob patterns never match anything here. The wheel built without
error, but ended up missing onnxruntime_pybind11_state.so entirely, along
with libonnxruntime_providers_shared.so and the versioned libonnxruntime.so;
the port previously worked around this with a manual post-install step that
copied the pybind extension in from the raw build tree afterward.

Add a FreeBSD branch to setup.py's libs list, mirroring the already-working
Darwin one (plain package-data entries, no ext_modules), so the wheel now
includes the same compiled artifacts on FreeBSD as it does on every other
supported platform. The now-redundant post-install workaround is removed.

Separately, tools/ci_build/build.py's own bdist_wheel invocation never
exposed a way to control the wheel's output directory, leaving it at
setup.py's undocumented default (a "dist" directory relative to the CMake
build tree). Add a small env-var pass-through (ORT_DIST_DIR) so the port
can redirect it to a predictable, WRKSRC-relative location instead,
matching the location PEP517_INSTALL_CMD/PEP517_BUILD_DEPEND now expect.

Diff Detail

Repository
R11 FreeBSD ports repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 75610
Build 72493: arc lint + arc unit

Event Timeline

michaelo created this revision.

Found this completely by incident while working on python.mk improvements. At least setup.py changes could be upstream. They are straight forward.