rake-compiler/rake-compiler-dock

bundle all required exe / dll / .a files for a gem to operate?

larskanis opened this issue · 10 comments

Asked per email by Doug:

I'm trying to sort out for myself how I might use rake-compiler-dock for a specific set of gems. I am failing.

I suspect it is because I don't know the first thing about Rakefiles for gems. Before I go spend a year or two trying to get smart enough to understand your process, I have a question that I hope is fairly easy for you to answer.

My question: does your process bundle all required exe / dll / .a files for a gem to operate? Ruby 2.6.5 32bit (for execution speed). I want to deploy the standard install without dev kit, and with gtk3 and mechanize that will work without requiring the dev kit. I'm struggling with size, primarily, and distribution. I'm finding this stuff scattered all over the place in a ruby + devkit install, and 1.7GB is just a bit too much for me to press on my userbase.

rake-compiler-dock provides an execution environment with various cross compilers. The actual build is done by rake-compiler. It provides the rake tasks to build and ship the extension '.so' files. But shipping dependent dlls is still beyond the scope of rake-compiler. You either have to build your extension with all dependencies static linked into the '.so' file or manage the dll packaging on your own.

Nokogiri and ffi are example gems with static linking, while fxruby doesn't link static, but ships a whole bunch of dependent dlls in it's mingw gems. You can check how they do this.

So to your question: No, neither rake-compiler nor rake-compiler-dock bundles required dependencies out of the box.

Anyway your use case sounds more like you're looking for an installer of a complete ruby based application. This is something RubyInstaller2 can handle. I didn't document this feature so far, but I'm using it in-house. It can build a customized ruby installer with everything required to run the bundled application. It can ship any preinstalled gems and preinstalled MINGW packages with their DLLs and can provide customized start menu entries, desktop icons etc. You don't have to ship the whole Devkit. I believe a sample application should make things more clear. If this would help, I could try to prepare such a sample application on the weekend.

Thank you, Lars. I really appreciate everything you do for the community. I've been scanning RubyInstaller2. Getting set up for it. I look forward to your sample application when available.

Hi, Lars - I hope you're well and healthy in these troubled times. I was wondering, might you be willing to share the feature you mentioned? Even undocumented and without a sample app, I'm willing to give it a go. I suspect you're incredibly busy, so hopefully this can be a bridge. I'll even try to help out by documenting as I go.

@OSXLich-Doug I didn't forget about you! But it's good to remember be about this task.

As a first sign I pushed the gem rubyinstaller-build to https://rubygems.org/gems/rubyinstaller-build . It can be used to build derived "Ruby+X" packages with the RubyInstaller2 framework.

I have a project which makes use of this gem to build an installer with a custom ruby application. Unfortunately it is closed source and I have to extract the interesting parts to an Open Source project.

@larskanis Thank you so much for this - I just scanned the gem and update in rubyinstaller2. I see a couple of interesting points already in the commit you made today. I appreciate you investing the time to include all this in your rubyinstaller2 repository. Above and beyond! I look forward to the sample project to complete my understanding, and in the meantime, I'm going to explore.

Hi, @larskanis Just a quick check-in on converting private to open source example of your new process.

@larskanis - I hope all's well with you and your friends and family in these times.

I've been reviewing the rubyinstaller-build gem and looking over what I think you're intending. To my very basic understanding, it appears that you're scanning the existing environment, in particular to create a manifest of installed msys2 packages to use as a basis for deciding which DLLs are needed in the Ruby + X concept. It looks like you have set up to take that manifest and installed gems, and incorporate them into a non-Devkit based install and button it all up with the Inno-setup tool. The non-Devkit based install would of course retain the ability to install the complete Devkit (handy), but doesn't install everything at the outset.

That may not be accurate, but I think that's what I'm seeing. If it is what I'm seeing, it looks very capable of meeting my requested use case. In particular, most of my ~ 1000 user are not developers, but rely on a much smaller community of about ~30 or so to keep new features coming in. So the core of my users have no need for compiling tools, alternate languages (python / perl) or any of the heft that goes with that type of environment. In fact, most of the innovation team doesn't, either - only a select few would be incorporating new gem features that might require a dev environment. It even appears this process could update the installation as well without requiring any Devkit for the users. Putting together a Ruby + X environment that does not require all the supporting Devkit tools and files would be spot on. It's a great answer to the retirement of fat binary gems which is how (after significant delay) something like this would have been handled in the past.

Did you make sufficient progress on your open source project that you'd be willing to share? Even if not in a complete state, it may be just the jump start I need to deliver an updated 2.6 based Ruby + X environment to my users. I'm fumbling in the dark, even with my insights (or maybe because of them - I might be overlooking something simple) - and I could use that guiding light. Stay safe!

@OSXLich-Doug Sorry I forgot about this issue! I have a working sample GUI application based on fxruby. My original plan was to publish a nice rails app, but I don't have the time to build it.
Not sure if that meets your needs, but since it's much better than nothing, I'll publish the fxruby sample app in the next days.

@larskanis That would be ideal! Even better than anything else I can imagine. As an aside I've been checking out fxruby as a replacement for the GTK2 / GTK3 framework the ruby application I'm supporting is using. This approach would not only help me with my distribution challenge, but could be a shot in the arm to moving away from that framework, too. My sincere appreciation!

@larskanis Quick check in on status. Did you manage to find the time for this?