ci(release): ship the C-API shared library and header (#25)#29
Merged
Conversation
The release bundles only carried parakeet-cli, so integrating via
ctypes/dlopen meant compiling from source. Add a separate shared-library
bundle per (platform, backend, arch) alongside each CLI bundle.
The lib is built in its own build dir with PARAKEET_SHARED=ON and
PARAKEET_BUILD_CLI=OFF, so the CLI bundles stay single self-contained
binaries. Each lib bundle carries libparakeet.{so,dylib,dll}, the
parakeet_capi.h header, LICENSE and README (plus the same cudart/cublas
on CUDA). The release job already globs dist/*, so they attach with no
further change.
Two things that would have silently broken it:
- BUILD_SHARED_LIBS=OFF builds ggml's static objects without -fPIC, so
folding them into a shared lib fails to link on Linux. The shared-lib
configure steps set CMAKE_POSITION_INDEPENDENT_CODE=ON.
- The C-API header marks symbols with plain extern "C", no dllexport, so
an MSVC DLL would export nothing. Set WINDOWS_EXPORT_ALL_SYMBOLS on the
parakeet target when PARAKEET_SHARED is on. No effect on Linux/macOS.
Verified on Linux CPU: a self-contained libparakeet.so depending only on
standard system libs, with the parakeet_capi_* symbols exported.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #25.
The prebuilt release bundles only carried
parakeet-cli, so integrating the C-API via ctypes/dlopen meant compiling from source. This adds a separate shared-library bundle per (platform, backend, arch) alongside each existing CLI bundle.What ships
A new
parakeet-<ver>-lib-<platform>-<backend>-<arch>bundle for every existing variant (linux cpu/vulkan/cuda x64 + cpu arm64, macos metal arm64 + cpu x64, windows cpu/vulkan/cuda x64), each containing:libparakeet.so/libparakeet.dylib/parakeet.dllinclude/parakeet_capi.hThe lib builds in its own build dir with
PARAKEET_SHARED=ONandPARAKEET_BUILD_CLI=OFF, so the CLI bundles stay byte-for-byte unchanged as single self-contained binaries. Thereleasejob already globsdist/*, so the new bundles attach with no change there.Two gotchas the implementation had to handle
BUILD_SHARED_LIBS=OFFbuilds ggml's static objects without-fPIC, so folding them into a shared lib fails to link (relocation R_X86_64_PC32 ... recompile with -fPIC). The shared-lib configure steps set-DCMAKE_POSITION_INDEPENDENT_CODE=ON.extern "C"with no__declspec(dllexport), so an MSVC DLL exports zero symbols and is useless to ctypes.WINDOWS_EXPORT_ALL_SYMBOLSis set on theparakeettarget under thePARAKEET_SHAREDbranch. No effect on Linux/macOS.Verification
Built locally on Linux CPU: a self-contained
libparakeet.sodepending only on standard system libs, with theparakeet_capi_*symbols exported (nm -D). The Windows DLL export and macOS dylib only get exercised on the CI runners; aworkflow_dispatchrun confirms them without needing a tag.🤖 Generated with Claude Code