Skip to content

Fix native extension load path for source gem installs#10

Merged
igalshilman merged 2 commits into
restatedev:mainfrom
yshaul:fix/native-extension-load-path
May 14, 2026
Merged

Fix native extension load path for source gem installs#10
igalshilman merged 2 commits into
restatedev:mainfrom
yshaul:fix/native-extension-load-path

Conversation

@yshaul
Copy link
Copy Markdown
Contributor

@yshaul yshaul commented May 14, 2026

Problem

When the gem is installed from source (gem install restate-sdk without a pre-compiled native gem), extconf.rb builds the native extension to lib/restate_internal.bundle. However, vm.rb lives in lib/restate/ and uses require_relative, so the existing fallback resolves to lib/restate/restate_internal — which doesn't exist.

The load path chain in vm.rb currently tries:

  1. lib/restate/<ruby_version>/restate_internal (cross-compiled gems)
  2. lib/restate/restate_internal (rake compile dev builds)

But misses the case where the extension is at lib/restate_internal (source gem installs).

Solution

Add a third fallback require_relative '../restate_internal' to handle source gem installs where the extension is built one directory up from vm.rb.

Made with Cursor

yshaul and others added 2 commits May 14, 2026 10:15
When the gem is installed from source (gem install), extconf.rb builds
the native extension to lib/restate_internal.bundle. But vm.rb is in
lib/restate/ and uses require_relative, so the fallback resolves to
lib/restate/restate_internal — which doesn't exist.

Add a third fallback that looks one directory up to find the extension
at lib/restate_internal where source builds place it.

Co-authored-by: Cursor <cursoragent@cursor.com>
The falcon gem (0.55.3) depends on the openssl gem (4.0.2) which
requires OpenSSL development headers to compile its native extension.
The slim Docker image doesn't include these by default.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link
Copy Markdown
Contributor

@igalshilman igalshilman left a comment

Choose a reason for hiding this comment

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

Thanks! merging.

@igalshilman igalshilman merged commit d30d9d7 into restatedev:main May 14, 2026
2 checks passed
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.

2 participants