socketry / nio4r

Cross-platform asynchronous I/O primitives for scalable network clients and servers.
Other
964 stars 85 forks source link

Install without native extension? #209

Closed mperham closed 5 years ago

mperham commented 5 years ago

I'd like to run nio4r-based infrastructure in pure Ruby mode, on machines without a compiler (for security and stability reasons). Is this possible? I don't see any flags for gem install which disable the native extension build. Is there an ENV hack or similar?

mperham commented 5 years ago

To be clear of my goal, I want to run an async-dns server in pure Ruby mode for serving a low-traffic application.

mperham commented 5 years ago

I got something working by forking, removing all extension references and overriding that gem with my forked version:

source 'https://rubygems.org'

gem 'nio4r', github: "mperham/nio4r"
gem 'rubydns'

Looks like all other dependencies are pure Ruby so thank you for that! đź‘Ź

ioquatix commented 5 years ago

Unless we provide somehow multiple gems, e.g. nio4r-kqueue, is it actually possible to do this and also make it easy for users?

ioquatix commented 5 years ago

What about using FFI?

mperham commented 5 years ago

It’s been a decade since I worked on native stuff. I’m unclear what’s possible these days but it looks like rubygems doesn’t make it easy.

tarcieri commented 5 years ago

As @ioquatix said, It'd require a separate gem, I think, due to RubyGems limitations.