pmq20 / ruby-packer

Packing your Ruby application into a single executable.
MIT License
1.56k stars 99 forks source link

Cannot load such file -- socket.so while packing gem #58

Open bethesque opened 6 years ago

bethesque commented 6 years ago

Thank you for your work on ruby-packer. I hope it will solve some "path too long" problems we're having with Travelling Ruby on Windows. I'm trying to create a windows executable out of a gem (bundler is just the example here) on Appveyor, and I'm hitting a problem.

Appveyer file: https://github.com/pact-foundation/pact-ruby-cli/blob/master/appveyor.yml

Key line:

rubyc.exe --output bundle.exe --gem=bundler --gem-version=1.16.4 bundle

bundle.exe is created

https://ci.appveyor.com/project/pact-foundation/pact-ruby-cli/build/1.0.15#L180

-> cd C:/Users/appveyor/AppData/Local/Temp/1/rubyc/bundler-1.16.4
Downloading http://rubygems.org/downloads/bundler-1.16.4.gem
C:/__enclose_io_memfs__/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': 
cannot load such file -- socket.so (LoadError

From what I can see, the error is coming from the ruby inside rubyc, as __enclose_io_memfs__ seems to be a path particular to ruby-packer.

I have tried to reproduce the correct environment by copying https://github.com/pmq20/ruby-packer/blob/master/ruby/appveyor.yml but I must be missing something. Any pointers would be appreciated, as my googling has not provided anything helpful.

bethesque commented 6 years ago

Ok, I've realised that my appveyor file was way over complicated and I only needed to copy what you'd done in the root appveyor file, but I get the same issue.

https://ci.appveyor.com/project/pact-foundation/pact-ruby-cli#L244

bethesque commented 6 years ago

Train of thought here, I'm not sure why it's trying load an .so file on windows - it's like it doesn't know it's on windows?

iamsimakov commented 6 years ago

hi, do you need to build this gem strongly on windows? did you try to do it on the linux/mac?

bethesque commented 6 years ago

It works on Linux, but yes, the main point of my exercise is to create a Windows executable.

bethesque commented 6 years ago

I'm assuming that I need to build the Windows executable on Windows... being able to build it on Linux would be preferable, but strange! (Having said that, the Travelling Ruby windows executable gets built on Linux, so I guess anything is possible!)

iamsimakov commented 6 years ago

If you assigned to windows you can use Docker Ubuntu image with rubyc to build app. )) but I am not sure I see full picture what you want.

bethesque commented 6 years ago

I want to build a windows executable. Your documentation suggests that a windows executable needs to be built on windows.

rubyc --gem=bundler --gem-version=1.15.4 bundle
./a.out (or a.exe on Windows)

Do you have any example scripts that show how to build a windows executable using ruby-packer?

artyomkalm commented 5 years ago

The same question, does anybody have any progress in this?

vitalykarasik commented 4 years ago

The same question after 1.5 year - any luck?