Add gem
feature to reduce Windows linking bugs
#24
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.
~It turns out the linking behavior of gems is more nuanced than we previously accounted for in magnus. On MacOS and Linux, you do not want to link in libruby, but on Windows you do. The behavior is a tricky and is not well suited for imperative interface (i.e.
features = ["link-ruby"]
. In the future, there may even be more unknown edge cases that we need to account for, so knowing that the user whats to build agem
makes it possible for rb-sys to do what the user really wants.To make cross-platform linking reliable, this PR brings in the
gem
feature from rb-sys so things Just Work™️ for gems. This should reduce a class of pesky, head-scatching linker issues for windows compilation.~In oxidize-rb/rb-sys#94, I changed the strategy for how rb-sys detects if it should build for usage in a gem. It relies on the
create_rust_makefile
setting--cfg=rb_sys_gem
in theRUSTFLAGS
. This strategy makes it somagnus
no longer needs to worry about anything when a Gem is being built, which should solve some integration headaches.As such, we no longer need to conditionally do things like setting the
ruby_abi_version
, since that is now now handled automatically.