Skip to content

Fix static-only wolfSSL linking, improve FFI import errors, and fix make dist#64

Open
cconlon wants to merge 3 commits intowolfSSL:masterfrom
cconlon:ffiFixes
Open

Fix static-only wolfSSL linking, improve FFI import errors, and fix make dist#64
cconlon wants to merge 3 commits intowolfSSL:masterfrom
cconlon:ffiFixes

Conversation

@cconlon
Copy link
Member

@cconlon cconlon commented Mar 2, 2026

This PR fixes issue #40 where USE_LOCAL_WOLFSSL with a static-only wolfSSL build fails to produce a working _ffi module, and users get a NameError instead of a useful error message.

  • Pass static .a archives directly via extra_objects instead of -lwolfssl, which the linker can't resolve without a shared library present
  • Replace silent except ImportError: pass with _FFIPlaceholder that raises ImportError with instructions
  • Fix libwolfssl_path global that was always "", breaking optional function detection
  • Add .dylib detection for macOS alongside .so
  • Fix make dist target that referenced missing ./make/osx/ and ./make/manylinux1/ scripts
  • Fix __del__ methods to avoid triggering the placeholder during garbage collection

@cconlon cconlon self-assigned this Mar 2, 2026
Copilot AI review requested due to automatic review settings March 2, 2026 21:28
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes local/static wolfSSL builds producing a broken _ffi module, improves the user-facing failure mode when CFFI bindings aren’t available, and repairs the make dist packaging target.

Changes:

  • Switch static-only linking to pass libwolfssl.a via extra_objects rather than -lwolfssl
  • Replace silent _ffi import failures with a placeholder that raises an actionable error
  • Improve lib detection (.dylib support) and simplify make dist to build sdist + wheel

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
wolfssl/utils.py Introduces an _ffi placeholder object to surface meaningful import-time failures
wolfssl/_methods.py Uses the placeholder on _ffi import failure and adjusts destructor guard logic
wolfssl/_build_ffi.py Adds robust lib path discovery, optional function probing changes, and static archive linking support
wolfssl/init.py Uses the placeholder on _ffi import failure and adjusts destructor guard logic
Makefile Fixes dist target by building sdist + wheel without missing scripts

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants