-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Bug
When installing kson-lang from an sdist, the native library for the target platform may not be built, resulting in a runtime error:
File "cffi/api.py", line 829, in _load_backend_lib
raise OSError(msg)
OSError: cannot load library '.../site-packages/kson/libkson.so':
libkson.so: cannot open shared object file: No such file or directory.
Root cause
The build backend checks whether native artifacts already exist before building from source (lib-python/build_backend.py:21-23):
native_files = ["kson.dll", "libkson.dylib", "libkson.so", "kson_api.h"]
artifacts_exist = any((src_kson_dir / f).exists() for f in native_files)This check is platform-agnostic — any() returns True if any of the listed files exist, regardless of whether that file is usable on the current platform. If a stale artifact from a
different OS is present (e.g. libkson.dylib from macOS), the check passes, the Gradle build is skipped, and the actually needed native library is never compiled.
Fix
Make the check platform-aware: only verify the native artifact relevant to the current OS:
- Linux:
libkson.so - macOS:
libkson.dylib - Windows:
kson.dll
- Ensure cross-platform artifacts are not accidentally included in published sdists so stale binaries from one platform don't end up
triggering the skip on another.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels