Native extensions are deleted during build and can not be used
Reference: https://github.com/kontena/pharos-cluster/issues/823#issuecomment-440645953
It's entirely possible that I don't understand the build process correctly, but to me it seems like https://github.com/pmq20/ruby-packer/blob/master/lib/compiler.rb#L860-L862 is deleting all the *.{a,dylib,so,dll,lib,bundle} from the squashfs filesystem, which, I believe, include the compiled output of native extensions?
When I look inside the squashfs, I can see the gem extension dir indeed does not contain the *.bundle:
puts Dir.glob('/__enclose_io_memfs__/lib/ruby/gems/2.5.0/extensions/x86_64-darwin-18/2.5.0-static/bcrypt-3.1.12/**/*').join($/)
/__enclose_io_memfs__/lib/ruby/gems/2.5.0/extensions/x86_64-darwin-18/2.5.0-static/bcrypt-3.1.12/gem.build_complete
/__enclose_io_memfs__/lib/ruby/gems/2.5.0/extensions/x86_64-darwin-18/2.5.0-static/bcrypt-3.1.12/gem_make.out
On my local system there's bcrypt_ext.bundle in there too.
And as it is not there in the squashfs, if I do require 'bcrypt', which does require 'bcrypt_ext', the program dies and says:
/__enclose_io_memfs__/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- bcrypt_ext (LoadError)
Can confirm that modifying the lines referenced above to skip ruby extension directories does fix the problem.
did you use rubyc version v0.4.0?
@iamsimakov No, one compiled from master.
so, just try it, master branch is unstable maybe ) @kke