oxidize-rb / rb-sys

Easily build Ruby native extensions in Rust
https://oxidize-rb.github.io/rb-sys/
Apache License 2.0
219 stars 34 forks source link

`rb-sys-dock` with ruby 3.4.0-preview1 #372

Closed Vagab closed 2 months ago

Vagab commented 3 months ago

not sure if it's the right place to ask, but I've tried to parse some readme's of rake-compile and rake-compile-dock but couldn't find anything about the preview versions. For some reason when I try to compile my extension for ruby 3.4.0-preview1 it fails with don't know how to build task 'native:x86_64-linux'. Here's my rakefile:

require "bundler/gem_tasks"
require "rb_sys/extensiontask"

task build: :compile

GEMSPEC = Gem::Specification.load("my_gem.gemspec")

exttask = RbSys::ExtensionTask.new("my_gem", GEMSPEC) do |ext|
  ext.lib_dir = "lib/my_gem"
  ext.cross_compile = true
  ext.cross_platform = %w[
    x86_64-linux
  ]
end

namespace :gem do
  exttask.cross_platform.each do |plat|
    desc "Build native extension for #{plat}"

    multitask native: plat
    task plat do
      sh "rb-sys-dock", "-p", plat, "--ruby-versions", "3.4", "--build"
    end
  end
end

task default: %i[compile spec]

edit: all is good with "3.3"

ianks commented 2 months ago

3.4 is not a stable release, and the ruby API is unstable so native gem compilation will not be guaranteed to work in future versions. what you want is to package a source code gem with the stable-abi-compiled-fallback feature to support ruby head