Giter Club home page Giter Club logo

ruby-packer's Introduction

Ruby Packer

Packing your Ruby application into a single executable.

Windows macOS Linux

Features

It takes less than 5 minutes to compile any project with Ruby Packer.

You won't need to modify a single line of code in your application, no matter how you developed it as long as it works in plain Ruby!

  • Works on win Windows, macOS macOS and linux Linux
  • Windows is supported via the native Windows API; there are no MSYS2/MinGW/Cygwin dependencies
  • Creates a binary distribution of your Ruby and/or Rails application
  • Supports natively any form of require and load, including dynamic ones (e.g. load(my_path + '/x.rb'))
  • Ruby Packer is written in Ruby and is packed and distributed using Ruby Packer itself
  • Native C extensions are fully supported
  • Open Source, MIT Licensed

Known Limitations

  • Some gems that use C extensions that use libc IO to load files from your Rails application will not work with rubyc. Notably, bootsnap will not work with rubyc
  • On macOS and Linux, DTrace is currently disabled, see #114

Download

Stable Releases

Here is the latest stable Ruby Packer release:

OS Arch. Executable
Windows x64 https://gw.alipayobjects.com/os/rmsportal/WxwlPrUTTReYNVVxJMtR.zip
macOS x64 https://gw.alipayobjects.com/os/enclose-prod/b812fa0f-d52b-44f1-8233-65ab8707cf1f/rubyc-v0.4.0-darwin-x64.gz
Linux x64 https://gw.alipayobjects.com/os/enclose-prod/1fd23e6b-d48f-4ed0-94dd-f0f539960253/rubyc-v0.4.0-linux-x64.gz

Unstable Pre-release

Whenever the master branch CI succeeded, a Ruby Packer pre-release binary would be automatically generated. Here is the latest unstable pre-release build:

OS Arch. Executable
Windows x64 https://github.com/pmq20/ruby-packer/releases/download/windows-x64/rubyc.exe
macOS x64 https://github.com/pmq20/ruby-packer/releases/download/darwin-x64/rubyc
Linux x64 https://github.com/pmq20/ruby-packer/releases/download/linux-x64/rubyc

Install

win Install on Windows

First install the prerequisites:

Then download rubyc.exe from either Unstable Pre-release or Stable Releases. Optionally, put it under C:\Windows or any other PATH directories. Open Visual Studio's "x64 Native Tools Command Prompt" and execute rubyc --help therein.

macOS Install on macOS

First install the prerequisites:

  • SquashFS Tools: brew install squashfs
  • Xcode
    • You also need to install the Command Line Tools via Xcode. You can find this under the menu Xcode -> Preferences -> Downloads
    • This step will install gcc and the related toolchain containing make
  • Ruby

Then download rubyc from either Unstable Pre-release or Stable Releases. Run chmod +x to give it execution permissions and execute ./rubyc --help.

linux Install on Linux

First install the prerequisites:

  • SquashFS Tools
    • sudo yum install squashfs-tools
    • sudo apt install squashfs-tools
  • gcc or clang
  • GNU Make
  • Ruby

Then download rubyc from either Unstable Pre-release or Stable Releases. Run chmod +x to give it execution permissions and execute ./rubyc --help.

Usage

rubyc [OPTION]... [ENTRANCE_FILE]

ENTRANCE_FILE refers to the path of an executable ruby script from your project, e.g. "bin/rails".
If ENTRANCE_FILE was not provided, a single raw Ruby interpreter executable would be produced.

-r, --root=DIR                   The path to the root of your application
-o, --output=FILE                The path of the output file
-d, --tmpdir=DIR                 The directory for temporary files
    --keep-tmpdir                Keeps all temporary files that were generated last time
    --openssl-dir                The path to openssl
    --make-args=ARGS             Extra arguments to be passed to make
    --nmake-args=ARGS            Extra arguments to be passed to nmake
-i, --ignore-file=STRING         Ignore file(s) from build
    --debug                      Enable debug mode
    --quiet                      Enable quiet mode
-v, --version                    Prints the version of rubyc and exit
-V, --ruby-version               Prints the version of the Ruby runtime and exit
    --ruby-api-version           Prints the version of the Ruby API and exit
-h, --help                       Prints this help and exit

The --openssl-dir Option

rubyc compiles its own version of openssl without any certifications. To be able to use ssl with rubyc it should know where to find the certifications.

By default this path is set to /usr/local/etc/openssl/ but can be overridden using the --openssl-dir argument.

Keep in mind that users running your compiled package should have their certifications present in this directory as well.

The --ignore-file Option

If you don't want certain files included in the build you can ignore them from the command line using -i.

rubyc -i ignore.file -i ignore-2.file -i "ignore*"

Alternatively you can create a .rubycignore file in the root of your project to specify which files should be ignored.

Examples

Producing a Portable Ruby Interpreter Executable

I.e. packing the raw Ruby interpreter without packing any projects:

rubyc
./a.out (or a.exe on Windows)

Packing a CLI utility

Taking Ruby Packer itself as an example of the CLI utility to pack:

git clone --depth 1 https://github.com/pmq20/ruby-packer
cd ruby-packer
rubyc bin/rubyc
./a.out (or a.exe on Windows)

Packing a Rails Application

rails new yours
cd yours
rubyc bin/rails
./a.out server (or a.exe server on Windows)

Building rubyc from Source

To build rubyc you must have a C compiler and the necessary toolchain to build ruby and the libraries stuffed inside rubyc which include at least:

  • gdbm
  • libffi
  • ncurses
  • openssl
  • readline
  • yaml
  • zlib

If you are unsure if your toolchain is complete then trying to build rubyc will let you know you are missing something. Unfortunately it may tell you with some unfamiliar message. Please file an issue here if this occurs.

Once your toolchain is set up run bundle. To compile your own rubyc run:

bundle exec rake rubyc

Or (if you want to compile with debug symbols):

ENCLOSE_IO_RUBYC_ADDTIONAL_ARGS=--debug bundle exec rake rubyc

This will produce a single rubyc executable, which can be put inside any of your PATH locations, so that it can be directly called from the command prompt. For example:

mv rubyc /usr/local/bin

Remember that rubyc includes all the files from the current directory in the built executable. You must delete the prior rubyc or your squashfs will continually grow larger and the embedded squashfs compile time will be very, very long.

Authors

Minqi Pan et al.

License

MIT

See Also

ruby-packer's People

Contributors

64kramsystem avatar bethesque avatar bryanp avatar chanmanx avatar drbrain avatar jakolehm avatar monkeywithacupcake avatar nilsding avatar pmq20 avatar swagdevops avatar yourivdlans avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ruby-packer's Issues

MacOS Errors

I've been trying to build a few things using rubyc on MacOS in the last couple days and getting symbol linking issues.

I'm on Sierra 10.12.6.

generating enc.mk
making srcs under enc
make[1]: Entering directory '/private/var/folders/11/5pldwnwx76xfh_qgmcqq15h80000gn/T/rubyc/ruby-2.4.1-0.5.0'
generating table from enc/trans/big5.c
dyld: lazy symbol binding failed: Symbol not found: _utimensat
  Referenced from: /private/var/folders/11/5pldwnwx76xfh_qgmcqq15h80000gn/T/rubyc/ruby-2.4.1-0.5.0/./miniruby
  Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: _utimensat
  Referenced from: /private/var/folders/11/5pldwnwx76xfh_qgmcqq15h80000gn/T/rubyc/ruby-2.4.1-0.5.0/./miniruby
  Expected in: /usr/lib/libSystem.B.dylib

make[1]: *** [enc.mk:284: enc/trans/big5.c] Abort trap: 6
make[1]: Leaving directory '/private/var/folders/11/5pldwnwx76xfh_qgmcqq15h80000gn/T/rubyc/ruby-2.4.1-0.5.0'
make: *** [uncommon.mk:855: srcs-enc] Error 2

This attempt was to build rubyc from master.

bin/rubyc -c bin/rubyc

Rails server can't be started because of the log problem

After my Rails project is compiled, an error is raised when I try to start the server

$ ./a.out s
/__enclose_io_memfs__/lib/ruby/2.4.0/open-uri.rb:37:in `initialize': No such file or directory @ rb_sysopen - /__enclose_io_memfs__/local/log/development.log (Errno::ENOENT)
	from /__enclose_io_memfs__/lib/ruby/2.4.0/open-uri.rb:37:in `open'
	from /__enclose_io_memfs__/lib/ruby/2.4.0/open-uri.rb:37:in `open'
	from /__enclose_io_memfs__/lib/ruby/2.4.0/logger.rb:752:in `create_logfile'
	from /__enclose_io_memfs__/lib/ruby/2.4.0/logger.rb:746:in `rescue in open_logfile'
	from /__enclose_io_memfs__/lib/ruby/2.4.0/logger.rb:743:in `open_logfile'
	from /__enclose_io_memfs__/lib/ruby/2.4.0/logger.rb:736:in `set_dev'
	from /__enclose_io_memfs__/lib/ruby/2.4.0/logger.rb:671:in `initialize'
	from /__enclose_io_memfs__/lib/ruby/2.4.0/logger.rb:387:in `new'
	from /__enclose_io_memfs__/lib/ruby/2.4.0/logger.rb:387:in `initialize'
	from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/bundler/gems/lls_logger-ffb74f91993e/lib/lls_logger/file_logger.rb:4:in `initialize'
	from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/bundler/gems/lls_logger-ffb74f91993e/lib/lls_logger.rb:19:in `new'
	from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/bundler/gems/lls_logger-ffb74f91993e/lib/lls_logger.rb:19:in `new'
	from /__enclose_io_memfs__/local/config/initializers/logger.rb:17:in `<top (required)>'
	from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:274:in `require'
	from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:274:in `block in require'
	from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:240:in `load_dependency'
	from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:274:in `require'
	from /__enclose_io_memfs__/local/config/application.rb:13:in `<class:Application>'
	from /__enclose_io_memfs__/local/config/application.rb:12:in `<module:Neo>'
	from /__enclose_io_memfs__/local/config/application.rb:11:in `<top (required)>'
	from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:78:in `require'
	from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:78:in `block in server'
	from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:75:in `tap'
	from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:75:in `server'
	from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
	from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/commands.rb:17:in `<top (required)>'
	from /__enclose_io_memfs__/local/bin/rails:4:in `require'
	from /__enclose_io_memfs__/local/bin/rails:4:in `<main>'

The lls_logger is a logging gem, lls_logger-ffb74f91993e/lib/lls_logger/file_logger.rb:4 is like:

module LlsLogger
  class FileLogger < ::Logger
    def initialize(tag, log_dir: 'log')
      super(File.join(log_dir, "#{tag}.log"))
    end
  end
end

32-bit?

Is there support for that architecture? For developing as well as distributing?

add instructions on `brew install squashfs`

utils.rb line 26 in spawn

compiler.rb line 143 in make_enclose_io_memfs

/__enclose_io_memfs__/_local_/lib/compiler/utils.rb:26:in `spawn': No such file or directory - mksquashfs (Errno::ENOENT)

Pry & readline causing problems

Pry.start

works fine on the machine that compiled the package, but on another machine hitting arrow key just rings the terminal bell.

Once I installed "rb-readline" gem it worked on both

SSL "Certificate verify failed" when running trivial test program

Here's my trivial test program:

require 'rss'
require 'open-uri'

def pull(url)
  open(url) do |rss|
    feed = RSS::Parser.parse(rss)
    feed.items.each{ |item| puts item.title }
  end
end

pull 'https://www.theguardian.com/uk-news/rss'

This program works when I run it using ruby. But the compiled (gcc) version does this:

/__enclose_io_memfs__/lib/ruby/2.4.0/net/protocol.rb:44:in `connect_nonblock': SSL_connect returned=1 errno=0 state=error: certificate verify failed (OpenSSL::SSL::SSLError)
        from /__enclose_io_memfs__/lib/ruby/2.4.0/net/protocol.rb:44:in `ssl_socket_connect'
        from /__enclose_io_memfs__/lib/ruby/2.4.0/net/http.rb:948:in `connect'
        from /__enclose_io_memfs__/lib/ruby/2.4.0/net/http.rb:887:in `do_start'
        from /__enclose_io_memfs__/lib/ruby/2.4.0/net/http.rb:876:in `start'
        from /__enclose_io_memfs__/lib/ruby/2.4.0/open-uri.rb:323:in `open_http'
        from /__enclose_io_memfs__/lib/ruby/2.4.0/open-uri.rb:741:in `buffer_open'
        from /__enclose_io_memfs__/lib/ruby/2.4.0/open-uri.rb:212:in `block in open_loop'
        from /__enclose_io_memfs__/lib/ruby/2.4.0/open-uri.rb:210:in `catch'
        from /__enclose_io_memfs__/lib/ruby/2.4.0/open-uri.rb:210:in `open_loop'
        from /__enclose_io_memfs__/lib/ruby/2.4.0/open-uri.rb:151:in `open_uri'
        from /__enclose_io_memfs__/lib/ruby/2.4.0/open-uri.rb:721:in `open'
        from /__enclose_io_memfs__/lib/ruby/2.4.0/open-uri.rb:35:in `open'
        from /__enclose_io_memfs__/local/one.rb:6:in `pull'
        from /__enclose_io_memfs__/local/one.rb:12:in `<main>'

Not sure what is going on here; I'm far from clever with SSL.

If change 'https://' to 'http://' in the code, then there is no change: it still retrieves the headlines in ruby, and still returns the exact same error message when compiled.

avoid incomplete tmpdir - configure: error: something wrong with LDFLAGS

my environment
sw_vers -productVersion
Mac O 10.12.5

ruby -v
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16]

had compiler error on LDFLAGS when I downloaded rubyc from binary release. but after seeing your answer in #5 I cloned the repository and tried again

./bin/rubyc -v
0.2.0

I am still getting error with LDFLAGS

/Users/senthilnayagam/tech/ruby-compiler/bin/rubyc 
Ruby Compiler (nodec) v0.2.0
- entrance: not provided, a single Ruby interpreter executable will be produced.
- HINT: call rubyc with --help to see more options and use case examples
- options: {:make_args=>"-j4", :output=>"/Users/senthilnayagam/tech/hello/a.out", :tmpdir=>"/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc"}

-> mkdir -p /var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc
-> cd /var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/ruby
-> Running [{"CI"=>"true", "ENCLOSE_IO_USE_ORIGINAL_RUBY"=>"1", "CFLAGS"=>" -fPIC -O3 -fno-fast-math -ggdb3 -Os -fdata-sections -ffunction-sections -pipe  -I/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/zlib  -I/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/openssl/include  -I/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/gdbm/build/include  -I/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/yaml/build/include  -I/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/libffi/build/lib/libffi-3.2.1/include  -I/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/ncurses/build/include  -I/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/readline/build/include ", "LDFLAGS"=>" -L/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/zlib /var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/zlib/libz.a  -L/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/openssl  -L/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/gdbm/build/lib  -L/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/yaml/build/lib  -L/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/libffi/build/lib  -L/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/ncurses/build/lib  -L/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/readline/build/lib ", "ENCLOSE_IO_RUBYC_1ST_PASS"=>"1", "ENCLOSE_IO_RUBYC_2ND_PASS"=>nil}, "./configure                                   --prefix=/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/ruby/build                                   --enable-bundled-libyaml                                   --without-gmp                                   --disable-dtrace                                   --enable-debug-env                                   --disable-install-rdoc"]
checking for ruby... /Users/senthilnayagam/.rvm/rubies/ruby-2.4.0/bin/ruby
config.guess already exists
config.sub already exists
checking build system type... x86_64-apple-darwin16.6.0
checking host system type... x86_64-apple-darwin16.6.0
checking target system type... x86_64-apple-darwin16.6.0
checking for clang... clang
checking for gcc... (cached) clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether clang accepts -g... yes
checking for clang option to accept ISO C89... none needed
checking whether we are using the GNU C++ compiler... yes
checking whether clang++ accepts -g... yes
checking how to run the C preprocessor... clang -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking whether clang needs -traditional... no
checking for ld... ld
checking whether the linker is GNU ld... no
checking whether clang -E accepts -o... yes
checking for real target cpu... x86_64
checking for ranlib... ranlib
checking for ar... ar
checking for ar D option... no
checking for as... as
checking for objdump... objdump
checking for objcopy... no
checking for gobjcopy... no
checking for nm... nm
checking whether ln -s works... yes
checking whether make sets $(MAKE)... yes
checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p
checking for dtrace... dtrace
checking for dot... no
checking for doxygen... no
checking for pkg-config... pkg-config
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for cd using physical directory... cd -P
checking whether CFLAGS is valid... yes
checking whether LDFLAGS is valid... no
configure: error: something wrong with LDFLAGS=" -L/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/zlib /var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/zlib/libz.a  -L/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/openssl  -L/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/gdbm/build/lib  -L/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/yaml/build/lib  -L/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/libffi/build/lib  -L/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/ncurses/build/lib  -L/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/readline/build/lib "
Failed running [{"CI"=>"true", "ENCLOSE_IO_USE_ORIGINAL_RUBY"=>"1", "CFLAGS"=>" -fPIC -O3 -fno-fast-math -ggdb3 -Os -fdata-sections -ffunction-sections -pipe  -I/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/zlib  -I/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/openssl/include  -I/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/gdbm/build/include  -I/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/yaml/build/include  -I/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/libffi/build/lib/libffi-3.2.1/include  -I/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/ncurses/build/include  -I/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/readline/build/include ", "LDFLAGS"=>" -L/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/zlib /var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/zlib/libz.a  -L/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/openssl  -L/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/gdbm/build/lib  -L/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/yaml/build/lib  -L/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/libffi/build/lib  -L/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/ncurses/build/lib  -L/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/readline/build/lib ", "ENCLOSE_IO_RUBYC_1ST_PASS"=>"1", "ENCLOSE_IO_RUBYC_2ND_PASS"=>nil}, "./configure                                   --prefix=/var/folders/l4/f5_wfby913j97tfshf5ddvl80000gn/T/rubyc/ruby/build                                   --enable-bundled-libyaml                                   --without-gmp                                   --disable-dtrace                                   --enable-debug-env                                   --disable-install-rdoc"]

redis-trib.rb instruction

Hi,
Can you show me how can I build redis-trib.rb as standalone binary?
I always ends with some error:
./rubyc --gem=redis --gem-version=4.0.1 redis-trib.rb give me:

Successfully installed redis-4.0.1
1 gem installed
-> cd /tmp/rubyc/rubyc_work_dir/enclose_io_memfs/lib/ruby/gems/2.4.0/bin
/enclose_io_memfs/local/lib/compiler/utils.rb:45:in chdir': No such file or directory @ dir_chdir - /tmp/rubyc/rubyc_work_dir/__enclose_io_memfs__/lib/ruby/gems/2.4.0/bin (Errno::ENOENT) from /__enclose_io_memfs__/local/lib/compiler/utils.rb:45:in chdir'
from /enclose_io_memfs/local/lib/compiler.rb:625:in block (2 levels) in prepare_local' from /__enclose_io_memfs__/local/lib/compiler/utils.rb:45:in block in chdir'
from /enclose_io_memfs/local/lib/compiler/utils.rb:45:in chdir' from /__enclose_io_memfs__/local/lib/compiler/utils.rb:45:in chdir'
from /enclose_io_memfs/local/lib/compiler.rb:614:in block in prepare_local' from /__enclose_io_memfs__/local/lib/compiler/utils.rb:45:in block in chdir'
from /enclose_io_memfs/local/lib/compiler/utils.rb:45:in chdir' from /__enclose_io_memfs__/local/lib/compiler/utils.rb:45:in chdir'
from /enclose_io_memfs/local/lib/compiler.rb:527:in prepare_local' from /__enclose_io_memfs__/local/lib/compiler.rb:464:in block in run!'
from /enclose_io_memfs/local/lib/compiler/utils.rb:45:in block in chdir' from /__enclose_io_memfs__/local/lib/compiler/utils.rb:45:in chdir'
from /enclose_io_memfs/local/lib/compiler/utils.rb:45:in chdir' from /__enclose_io_memfs__/local/lib/compiler.rb:365:in run!'
from /enclose_io_memfs/local/bin/rubyc:149:in `

'

if I run ./rubyc redis-trib.rb I get with a.out, but without dependencies

./a.out
/enclose_io_memfs/local/redis-trib.rb:1573: warning: key "threshold" is duplicated and overwritten on line 1573
/enclose_io_memfs/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- redis (LoadError) from /__enclose_io_memfs__/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require'
from /enclose_io_memfs/local/redis-trib.rb:25:in `

'

No output file after compiling

No output file is produced after compiling my Rails project using rubyc bin/rails. Found this log in the end:

-> cd bin
Cannot find entrance /path/to/myproject/bin/rails, available entrances are _guard-core, aws.rb, 
bootstrap, bundle, byebug, coderay, commander, db_drop, db_migrate, erubis, fluent-post, git-
version-bump, god, guard, htmldiff, httparty, iap, ipip, ldiff, listen, mojibake, mongrel_rpm, newrelic, 
newrelic_cmd, nokogiri, nrdebug, protoc-gen-ruby, pry, puma, pumactl, rackup, rails, rake, 
restclient, rotp, rpc_server, rspec, rubocop, ruby-parse, ruby-prof, ruby-prof-check-trace, ruby-
rewrite, safe_yaml, setup, sidekiq, sidekiqctl, slimrb, spork, sprockets, stackprof, stackprof-
flamegraph.pl, stackprof-gprof2dot.py, thin, thor, tilt, unicorn, unicorn_rails, uuid.

OS: macOS 10.12.5
ruby version: 2.4.0
rubyc version: Ruby Compiler (rubyc) v0.1.0 (runtime 2.4.0)
rails version: 4.2.8

Support alpine Docker image environment

I am trying to create a Docker image for this as it would be very useful in multi-stage builds for Ruby software or with e.g. OpenFaaS. Unfortunately, it seems to not be usable in an Alpine linux image.

A simple image file:

ARG rubyvers
FROM ruby:${rubyvers}-alpine
RUN apk add --no-cache squashfs-tools gcc make curl ca-certificates && curl -L http://enclose.io/rubyc/rubyc-linux-x64.gz | gunzip > /usr/bin/rubyc && chmod +rx /usr/bin/rubyc
RUN rubyc

yields:

/bin/sh: rubyc: not found

Note that the same error results from providing a full path to rubyc.

Debugging the image with a statically compiled/linked goss go binary:

RUN curl -L https://github.com/aelsabbahy/goss/releases/download/v0.3.5/goss-linux-amd64 -o /usr/bin/goss
RUN goss

works correctly and proves there is some kind of incompatibility here.

No such file or directory @ unlink_internal - /__enclose_io_memfs__/local/tmp/cache/assets/sprockets/v3.0/HZ

I've successfully packed my ruby application into a single executable file and server has started successfully. However, when I try to load website in browser, I get the following error:
screen shot 2018-08-10 at 2 17 36 pm

Here's another example of an error when loading a different page:
screen shot 2018-08-10 at 2 19 24 pm

There are no problems with application when running on local server, but this problem arises when trying to run application from executable file created with rubyc.

Does anybody know what the issue is?

Thank you

mysql2 gem

Hello, we use mysql2 gem which uses the native extension.
Do I understand correctly that build rails app with this gem is impossible?
Could you give me some advice about it?
Do you have any plans to add support native extensions? is it possible?

Windows Server 2016 Bison not found

When trying to use rubyc to build a Windows binary, it errors out saying it's looking for bison. I think I followed the instruction in the README, with installation of squashfs, visual studio and ruby via ruby-installer. What's the recommended method for getting bison on Windows? (Sorry, I'm minimally proficient on Windows). Do I need something like mingw?

Choking on compile of ncurses.

I tried the new version, but get errored-out when it gets to compiling ncurses:

gcc -DHAVE_CONFIG_H -I. -I../include  -D_GNU_SOURCE -DNDEBUG -fPIC -O3 -fno-fast-math -ggdb3 -Os -fdata-sections -ffunction-sections -pipe   --param max-inline-insns-single=1200 -c ../ncurses/./base/lib_getstr.c -o ../objects/lib_getstr.o
In file included from ./curses.priv.h:325:0,
                 from ../ncurses/lib_gen.c:19:
_6335.c:843:15: error: expected ‘)’ before ‘int’
../include/curses.h:1631:56: note: in definition of macro ‘mouse_trafo’
 #define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen)
                                                        ^
Makefile:962: recipe for target '../objects/lib_gen.o' failed
make[1]: *** [../objects/lib_gen.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/tmp/rubyc/ncurses/ncurses'
Makefile:113: recipe for target 'all' failed
make: *** [all] Error 2
Failed running [{"CI"=>"true", "ENCLOSE_IO_USE_ORIGINAL_RUBY"=>"1", "CFLAGS"=>" -fPIC -O3 -fno-fast-math -ggdb3 -Os -fdata-sections -ffunction-sections -pipe ", "LDFLAGS"=>""}, "make -j4"]

I'm compiling on linux, ubuntu 16.04, 64bit. Any ideas?

Cant run a.out server after compile rails app

this is my issue:

$ ./a.out server
=> Booting Puma
=> Rails 5.1.6 application starting in development
=> Run rails server -h for more startup options
Exiting
/enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/bundler/gems/rb-inotify-be4cf88b4dab/lib/rb-inotify/watcher.rb:74:in initialize': No such file or directory - Failed to watch "/__enclose_io_memfs__/local/config/locales" (Errno::ENOENT) from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/bundler/gems/rb-inotify-be4cf88b4dab/lib/rb-inotify/notifier.rb:190:in new'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/bundler/gems/rb-inotify-be4cf88b4dab/lib/rb-inotify/notifier.rb:190:in watch' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/bundler/gems/rb-inotify-be4cf88b4dab/lib/rb-inotify/notifier.rb:204:in watch'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/listen-3.1.5/lib/listen/adapter/linux.rb:32:in _configure' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/listen-3.1.5/lib/listen/adapter/base.rb:45:in block in configure'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/listen-3.1.5/lib/listen/adapter/base.rb:40:in each' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/listen-3.1.5/lib/listen/adapter/base.rb:40:in configure'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/listen-3.1.5/lib/listen/adapter/base.rb:63:in start' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/listen-3.1.5/lib/listen/listener.rb:68:in block in class:Listener'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/listen-3.1.5/lib/listen/fsm.rb:121:in instance_eval' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/listen-3.1.5/lib/listen/fsm.rb:121:in call'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/listen-3.1.5/lib/listen/fsm.rb:91:in transition_with_callbacks!' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/listen-3.1.5/lib/listen/fsm.rb:57:in transition'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/listen-3.1.5/lib/listen/listener.rb:91:in start' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6/lib/active_support/evented_file_update_checker.rb:94:in boot!'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6/lib/active_support/evented_file_update_checker.rb:65:in initialize' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6/lib/active_support/i18n_railtie.rb:59:in new'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6/lib/active_support/i18n_railtie.rb:59:in initialize_i18n' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6/lib/active_support/i18n_railtie.rb:23:in block in class:Railtie'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:67:in block in execute_hook' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:60:in with_execution_control'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:65:in execute_hook' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:50:in block in run_load_hooks'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:49:in each' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:49:in run_load_hooks'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/application/finisher.rb:66:in block in <module:Finisher>' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/initializable.rb:30:in instance_exec'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/initializable.rb:30:in run' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/initializable.rb:59:in block in run_initializers'
from /enclose_io_memfs/lib/ruby/2.4.0/tsort.rb:228:in block in tsort_each' from /__enclose_io_memfs__/lib/ruby/2.4.0/tsort.rb:350:in block (2 levels) in each_strongly_connected_component'
from /enclose_io_memfs/lib/ruby/2.4.0/tsort.rb:431:in each_strongly_connected_component_from' from /__enclose_io_memfs__/lib/ruby/2.4.0/tsort.rb:349:in block in each_strongly_connected_component'
from /enclose_io_memfs/lib/ruby/2.4.0/tsort.rb:347:in each' from /__enclose_io_memfs__/lib/ruby/2.4.0/tsort.rb:347:in call'
from /enclose_io_memfs/lib/ruby/2.4.0/tsort.rb:347:in each_strongly_connected_component' from /__enclose_io_memfs__/lib/ruby/2.4.0/tsort.rb:226:in tsort_each'
from /enclose_io_memfs/lib/ruby/2.4.0/tsort.rb:205:in tsort_each' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/initializable.rb:58:in run_initializers'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/application.rb:353:in initialize!' from /__enclose_io_memfs__/local/config/environment.rb:5:in <top (required)>'
from config.ru:3:in require_relative' from config.ru:3:in block in

'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/rack-2.0.5/lib/rack/builder.rb:55:in instance_eval' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/rack-2.0.5/lib/rack/builder.rb:55:in initialize'
from config.ru:in new' from config.ru:in '
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/rack-2.0.5/lib/rack/builder.rb:49:in eval' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/rack-2.0.5/lib/rack/builder.rb:49:in new_from_string'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/rack-2.0.5/lib/rack/builder.rb:40:in parse_file' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/rack-2.0.5/lib/rack/server.rb:319:in build_app_and_options_from_config'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/rack-2.0.5/lib/rack/server.rb:219:in app' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:24:in app'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/rack-2.0.5/lib/rack/server.rb:354:in wrapped_app' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:80:in log_to_stdout'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:42:in start' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:135:in block in perform'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:130:in tap' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:130:in perform'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/thor-0.20.0/lib/thor/command.rb:27:in run' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in invoke_command'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/thor-0.20.0/lib/thor.rb:387:in dispatch' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/command/base.rb:63:in perform'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/command.rb:44:in invoke' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/commands.rb:16:in <top (required)>'
from /enclose_io_memfs/local/bin/rails:9:in require' from /__enclose_io_memfs__/local/bin/rails:9:in <top (required)>'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in load' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in call'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in call' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/spring-2.0.2/lib/spring/client.rb:30:in run'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/spring-2.0.2/bin/spring:49:in <top (required)>' from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in load'
from /enclose_io_memfs/local/vendor/bundle/ruby/2.4.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in <top (required)>' from /__enclose_io_memfs__/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in require'
from /enclose_io_memfs/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in require' from /__enclose_io_memfs__/local/bin/spring:15:in <top (required)>'
from /enclose_io_memfs/local/bin/rails:3:in load' from /__enclose_io_memfs__/local/bin/rails:3:in '
I tried somethings but cant understand my problem, thanks for any help.

UPDATE: Finally the main problem was my env to development, so i config my rails app to work for production in all of dependencys, thanks to @iamsimakov for solution.

Wrong Etc.sysconfdir

require 'etc'

puts Etc.sysconfdir

will be rendered, as: /__enclose_io_memfs__/etc (x86_64 GNU/Linux)

Fail on running the binary build for my rails 4.2

I tried to compile my Rails 4.2 project on Ruby 2.4.2 in OSX 10.13.2. It took nearly an 70 minutes to complete. The binary file is 779M (it's a large project with a lot of testing code). When I try to run it, it product the below error message and crashed, could you please help? Thanks a lot!

$ ./a.out
/__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.0.0/lib/bootsnap/compile_cache/iseq.rb:40:in `fetch': No such file or directory (Errno::ENOENT)
	from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.0.0/lib/bootsnap/compile_cache/iseq.rb:40:in `load_iseq'
	from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
	from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.0.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
	from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:274:in `block in require'
	from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:240:in `load_dependency'
	from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:274:in `require'
	from /__enclose_io_memfs__/local/bin/rails:8:in `<main>'

Please note that compiling and run Rails 5 sample app seems works in the same environment.

Ruby apps with gem dependencies do not run

I tried to run an app having a gem dependency, green_shoes, a Ruby gtk2 gui library.

After it compiled the script and outputed a.out file, running produces this error

>$ ./a.out 
/__enclose_io_memfs__/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- green_shoes (LoadError)
	from /__enclose_io_memfs__/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /__enclose_io_memfs__/local/green.rb:1:in `<main>'

Now at first take what i can infer is it is using ruby 2.4 to package an app, but since on my system i got 2.3.3, it wont load.
So how can we tell the packer to add those gems either from a local directory or fetch from rubygems.org or a custom version from github?
Dependencies should be automatically added , right? Else it should have prompted unavailability or asked to provide dependency path, while packing.

Unable to get working build on Windows

I've been struggling for a few days with Windows, and finally got a clean build of my project, however it doesn't run. In trying to elimenate my project as the problem, I took a well-known rubygem (httparty) and attempted to build a single executable using ruby-packer. Again, it built but I was unable to get it to run, as it has some type of gemspec load error.

Steps to reproduce:

  1. git clone https://github.com/jnunemaker/httparty.git
  2. rubyc -c bin/httparty
  3. Attempt to run a.exe

Output:


C:\Users\Administrator\Downloads\httparty>a.exeC:/__enclose_io_memfs__/lib/ruby/2.4.0/rubygems.rb:270:in `find_spec_for_exe': can't find gem httparty (>= 0.a) (Gem::GemNotFoundException)        from C:/__enclose_io_memfs__/lib/ruby/2.4.0/rubygems.rb:298:in `activate_bin_path'        from /__enclose_io_memfs__/lib/ruby/gems/2.4.0/bin/httparty:22:in `<main>'2C:\Users\Administrator\Downloads\httparty>C:\Users\Administrator\Downloads\httparty>a.exeC:/__enclose_io_memfs__/lib/ruby/2.4.0/rubygems.rb:270:in `find_spec_for_exe': can't find gem httparty (>= 0.a) (Gem::GemNotFoundException)        from C:/__enclose_io_memfs__/lib/ruby/2.4.0/rubygems.rb:298:in `activate_bin_path'        from /__enclose_io_memfs__/lib/ruby/gems/2.4.0/bin/httparty:22:in `<main>'
C:\Users\Administrator\Downloads\httparty>

C:\Users\Administrator\Downloads\httparty>a.exeC:/__enclose_io_memfs__/lib/ruby/2.4.0/rubygems.rb:270:in `find_spec_for_exe': can't find gem httparty (>= 0.a) (Gem::GemNotFoundException)        from C:/__enclose_io_memfs__/lib/ruby/2.4.0/rubygems.rb:298:in `activate_bin_path'        from /__enclose_io_memfs__/lib/ruby/gems/2.4.0/bin/httparty:22:in `<main>'
C:\Users\Administrator\Downloads\httparty>

This system is Windows 2016 x64, Visual Studio 2015u3 community, choco installed bison, squashfs tried from both the link on the README with this project and from chocoloatey.

embedded shared library access problems

Traceback (most recent call last):
	7: from /__enclose_io_memfs__/local/exe/lmod-ruby-installer:30:in `<main>'
	6: from /__enclose_io_memfs__/local/exe/lmod-ruby-installer:30:in `require'
	5: from /__enclose_io_memfs__/local/lib/lri.rb:3:in `<top (required)>'
	4: from /__enclose_io_memfs__/local/lib/lri.rb:3:in `require'
	3: from /__enclose_io_memfs__/local/lib/lri/archives.rb:3:in `<top (required)>'
	2: from /__enclose_io_memfs__/local/lib/lri/archives.rb:3:in `require'
	1: from /__enclose_io_memfs__/local/vendor/bundle/ruby/2.5.0/gems/oga-2.14/lib/oga.rb:18:in `<top (required)>'
/__enclose_io_memfs__/local/vendor/bundle/ruby/2.5.0/gems/oga-2.14/lib/oga.rb:18:in `require': ./lmod-ruby-installer: undefined symbol: Init_liboga - /__enclose_io_memfs__/local/vendor/bundle/ruby/2.5.0/gems/oga-2.14/lib/liboga.so (LoadError)
$ strings /tmp/rubyc/rubyc_work_dir/__enclose_io_memfs__/local/vendor/bundle/ruby/2.5.0/gems/oga-2.14/lib/liboga.so| grep Init
Init_liboga_xml_lexer
Init_liboga
InitVM(ext) {void InitVM_ ##ext(void);InitVM_ ##ext();}
Init_stack(addr) ruby_init_stack(addr)
Init_liboga_xml_lexer
Init_liboga
Init_liboga_xml_lexer
Init_liboga

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

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.

  • Steps to reproduce:

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

  • Expected behaviour

bundle.exe is created

  • Actual behaviour

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.

cross-compile instructions ?

Is it possible to compile linux from mac or get a universal binary ...
otherwise saying so in the readme would be nice binaries will only work on the systems they were compiled on

NMAKE : fatal error U1077: 'cl' : return code '0x2' on Windows

Windows 10, 64 bit
Ruby 2.5.1
Visual Studio 2015 Update 3

Command Ran:
rubyc my_script.rb

Debug:

-> Project root not supplied, C:/Users/yohoj/Downloads/rs_acc_creator assumed.
Ruby Compiler (rubyc) v0.4.0
- entrance: C:/Users/yohoj/Downloads/rs_acc_creator/rs_acc_creator.rb
- options: {:make_args=>"-j4", :output=>"C:/Users/yohoj/Downloads/rs_acc_creator/a.exe", :tmpdir=>"C:/Users/yohoj/AppData/Local/Temp/rubyc"}

-> mkdir -p C:/Users/yohoj/AppData/Local/Temp/rubyc
-> cd C:/Users/yohoj/AppData/Local/Temp/rubyc/ruby-2.4.1-0.4.0
-> Running [{"CI"=>"true", "ENCLOSE_IO_USE_ORIGINAL_RUBY"=>"1", "ENCLOSE_IO_RUBYC_1ST_PASS"=>"1", "ENCLOSE_IO_RUBYC_2ND_PASS"=>nil}, "call win32\\configure.bat                                   --disable-install-doc                                   --prefix=\"C:/Users/yohoj/AppData/Local/Temp/rubyc/ruby-2.4.1-0.4.0/build\""]
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.
-> Running [{"CI"=>"true", "ENCLOSE_IO_USE_ORIGINAL_RUBY"=>"1", "ENCLOSE_IO_RUBYC_1ST_PASS"=>"1", "ENCLOSE_IO_RUBYC_2ND_PASS"=>nil}, "nmake "]

Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-> Running [{"CI"=>"true", "ENCLOSE_IO_USE_ORIGINAL_RUBY"=>"1", "ENCLOSE_IO_RUBYC_1ST_PASS"=>"1", "ENCLOSE_IO_RUBYC_2ND_PASS"=>nil}, "nmake install"]

Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation.  All rights reserved.

NMAKE : fatal error U1073: don't know how to make 'install'
Stop.
Failed running [{"CI"=>"true", "ENCLOSE_IO_USE_ORIGINAL_RUBY"=>"1", "ENCLOSE_IO_RUBYC_1ST_PASS"=>"1", "ENCLOSE_IO_RUBYC_2ND_PASS"=>nil}, "nmake install"]

Maybe related issue?
#34

Instructions on compiling rubyc yourself?

Ultimately my goal here is to see if I could cross compile from x86_64 to arm, all while having a single executable. I don't see instructions on building rubyc itself, which may be just a rubyc package of the bin/rubyc command.

If I wanted this to work with cross compile targets, do you have any hints?

Also, great work. This is a very cool project.

Compile project with Gemfile and/or gemspec

Hi.
First of all, I would like to thank you for the great project.

I use latest ruby-compiler from the GitHub.

When I try to compile a project with Gemfile and gemspec I get an error:

Cannot find entrance /Users/user/ruby/crowdin-cli/bin/crowdin-cli, available entrances are bundle, bundler, crowdin-cli.

I look through the code. And it seems like it tries to get the absolute path to the binary.

Makefile:113: recipe for target 'all' failed

# rubyc --version
0.4.0
# uname -srp
Linux 4.8.0-59-generic x86_64
gcc -DHAVE_CONFIG_H -I. -I../include  -D_GNU_SOURCE -DNDEBUG -fPIC -O3 -fno-fast-math -ggdb3 -Os -fdata-sections -ffunction-sections -pipe   --param max-inline-insns-single=1200 -c ../ncurses/./base/lib_getstr.c -o ../objects/lib_getstr.o
In file included from ./curses.priv.h:325:0,
                 from ../ncurses/lib_gen.c:19:
_12495.c:843:15: error: expected ')' before 'int'
../include/curses.h:1631:56: note: in definition of macro 'mouse_trafo'
 #define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen)
                                                        ^
Makefile:962: recipe for target '../objects/lib_gen.o' failed
make[1]: *** [../objects/lib_gen.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/tmp/rubyc.1000/ncurses/ncurses'
Makefile:113: recipe for target 'all' failed
make: *** [all] Error 2
Failed running [{"CI"=>"true", "ENCLOSE_IO_USE_ORIGINAL_RUBY"=>"1", "CFLAGS"=>" -fPIC -O3 -fno-fast-math -ggdb3 -Os -fdata-sections -ffunction-sections -pipe ", "LDFLAGS"=>""}, "make -j4"]

Each time, first compilation fails (when tmpdir was empty), as seen above. A new compilation after this error will succeed.

Failed to build JSON

Failed to build json-1.8.3

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /tmp/rubyc/rubyc_work_dir/__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/json-1.8.3/ext/json/ext/generator
/tmp/rubyc/ruby-2.4.1-0.4.0/build/bin/ruby -r ./siteconf20180821-24184-n1kw.rb extconf.rb
creating Makefile

current directory: /tmp/rubyc/rubyc_work_dir/__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR=" clean

current directory: /tmp/rubyc/rubyc_work_dir/__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
generator.c: In function ‘generate_json’:
generator.c:861:25: error: ‘rb_cFixnum’ undeclared (first use in this function)
     } else if (klass == rb_cFixnum) {
                         ^
generator.c:861:25: note: each undeclared identifier is reported only once for each function it appears in
generator.c:863:25: error: ‘rb_cBignum’ undeclared (first use in this function)
     } else if (klass == rb_cBignum) {
                         ^
Makefile:241: recipe for target 'generator.o' failed
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /tmp/rubyc/rubyc_work_dir/__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/json-1.8.3 for inspection.
Results logged to
/tmp/rubyc/rubyc_work_dir/__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/extensions/x86_64-linux/2.4.0-static/json-1.8.3/gem_make.out

An error occurred while installing json (1.8.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.3'` succeeds before bundling.


command: cat /tmp/rubyc/rubyc_work_dir/__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/extensions/x86_64-linux/2.4.0-static/json-1.8.3/gem_make.out

result/contents:

current directory: /tmp/rubyc/rubyc_work_dir/__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/json-1.8.3/ext/json/ext/generator
/tmp/rubyc/ruby-2.4.1-0.4.0/build/bin/ruby -r ./siteconf20180821-24184-n1kw.rb extconf.rb
creating Makefile

current directory: /tmp/rubyc/rubyc_work_dir/__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR=" clean

current directory: /tmp/rubyc/rubyc_work_dir/__enclose_io_memfs__/local/vendor/bundle/ruby/2.4.0/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
generator.c: In function ‘generate_json’:
generator.c:861:25: error: ‘rb_cFixnum’ undeclared (first use in this function)
     } else if (klass == rb_cFixnum) {
                         ^
generator.c:861:25: note: each undeclared identifier is reported only once for each function it appears in
generator.c:863:25: error: ‘rb_cBignum’ undeclared (first use in this function)
     } else if (klass == rb_cBignum) {
                         ^
Makefile:241: recipe for target 'generator.o' failed
make: *** [generator.o] Error 1

make failed, exit code 2

cannot load hitimes

My CLI is using the hitimes gem but it seems to fail to load with this message

/__enclose_io_memfs__/lib/ruby/gems/2.4.0/gems/hitimes-1.2.6/lib/hitimes.rb:56:in `<top (required)>': Unable to find binary extension, was hitimes installed correctly? The following paths were tried. (LoadError)
/usr/local/bin/hitimes/2.4/hitimes : cannot load such file -- hitimes/2.4/hitimes
/usr/local/bin/hitimes/hitimes : cannot load such file -- hitimes/hitimes

It seems that hitimes tried to load from 2 paths (https://github.com/copiousfreetime/hitimes/blob/master/lib/hitimes.rb#L34-L35) and thus cannot find the path properly as it look from the executable root directory instead of the __enclose_io_memfs__ one.

Any suggestions?

Ignore some files when packaging

Hi.

I propose adding .rubycingnore file or configuration option -e <file> where users can list files and directories which should be excluded from the package.

Arm support

Any idea what would be involved in getting this working with Arm? (We could compile everything directly on our arm board) Would be happy to put a little money towards getting this supported on Arm if that anyone is interested.

Thanks!

How to include /lib/x86_64-linux-gnu/libc.so.6

Helllo, thank you very much for ruby-packer.
Now I see error
./rails: /lib/x86_64-linux-gnu/libc.so.6: version GLIBC_2.17' not found (required by ./rails)I think there is any extra flags to g++ for include it. Something like:-D__STDC_FORMAT_MACROS -std=c++11 -static -static-libgcc -static-libstdc++It maybe passed through option--make-args=ARGS`
But how?
Does anyone know little example for it?
And it maybe important: I built on Ubuntu 16 and try start it on Ubuntu 12

Using predictable tmp directory

When building projects with rubyc/ruby-packer., it uses a predictable name, in /tmp. If this is happening, an attacker could put their own payloads and instructions in that location. Additonally, it prevents multiple builds using ruby-packer from happening at the same time on the same system.

Rename project ruby-compiler to ruby-packer

Hi

As I see, that project does not compile ruby code to machine or byte code, it just packs it.
So it will be honestly to rename project to avoid misrepresentation.

Thanks

cannot load such file -- tty-prompt

Hello, after I run the compiler I try to execute the file ./a.out but I receive the below error for gem tty-prompt. I've also received the same for pry

in my .rb file I have

require 'tty-prompt'

and I receive error

/enclose_io_memfs/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- tty-prompt (LoadError) from /__enclose_io_memfs__/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require'
from /enclose_io_memfs/local/prerequisite_runner.rb:4:in `

'

I'm using rubyc 0.4.0 and ruby 2.4.1p111

Are assets supported?

Hello, thank you very much for ruby-packer. It's very useful to hide source code of the application.
I packed Rails app.
In my case, I have static files in public/. Such as 400.html, 500.html, and precompiled assets.
If I request it then see 404 on static files:
"GET /_docs.yaml HTTP/1.1" 404
And 200 status on asset request:
"GET /assets/application-6b4ca925523b68974a5f3d9245ac77d11df5f4a7c3ab5912af679a09d63fc5b1.css HTTP/1.1" 200 1257
but if request this asset separately I see:

body:before {
            font-weight: bold;
            content: "\000a Errno::ENOENT: No such file or directory @ unlink_internal - \002f __enclose_io_memfs__\002f local\002f tmp\002f cache\002f assets\002f sprockets\002f v3.0\002f Jk\002f Jk7G-MnAv71IzfxNF24kN_dPQ7Qn2zD1CCdHNGoiHBE.cache.57148160.4137.359214";
          }

Is there any recomendations about structure assets:

  1. precompilation or not
  2. specified config.assets in config/application.rb

It takes very long to start rails server

It takes about 10 seconds to start my rails server

rails s  10.00s user 3.88s system 77% cpu 17.859 total

but takes more than 2 minutes when using result of ruby-compiler

./a.out s  157.41s user 1.64s system 95% cpu 2:46.34 total

Not Finding bundler gem in build?

In trying to compile cli gem I am working on with:

rubyc bin/byr

I get the following error at the end:

-> Running [{"CI"=>"true", "PATH"=>"/tmp/rubyc/ruby/build/bin:/home/ded/.rbenv/shims:/home/ded/.rbenv/bin:/home/ded/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/ded/.cask/bin:/home/ded/go/bin", "GEM_HOME"=>nil, "GEM_PATH"=>nil, "ENCLOSE_IO_USE_ORIGINAL_RUBY"=>"1", "ENCLOSE_IO_RUBYC_1ST_PASS"=>"1", "ENCLOSE_IO_RUBYC_2ND_PASS"=>nil}, "sh", "-c", "gem install /__enclose_io_memfs__/local/vendor/bundler-1.15.1.gem --force --local --no-rdoc --no-ri"]
ERROR:  Could not find a valid gem '/__enclose_io_memfs__/local/vendor/bundler-1.15.1.gem' (>= 0) in any repository
Failed running [{"CI"=>"true", "PATH"=>"/tmp/rubyc/ruby/build/bin:/home/ded/.rbenv/shims:/home/ded/.rbenv/bin:/home/ded/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/ded/.cask/bin:/home/ded/go/bin", "GEM_HOME"=>nil, "GEM_PATH"=>nil, "ENCLOSE_IO_USE_ORIGINAL_RUBY"=>"1", "ENCLOSE_IO_RUBYC_1ST_PASS"=>"1", "ENCLOSE_IO_RUBYC_2ND_PASS"=>nil}, "sh", "-c", "gem install /__enclose_io_memfs__/local/vendor/bundler-1.15.1.gem --force --local --no-rdoc --no-ri"]

It looks like it is trying to install the bundler gem from a local source but not finding it. Also seems to specify a root path /enclose_io_memfs ...

Am I missing something obvious here, or is this a bug?

Windows: Cannot open include file: 'zlib.h'

Hi,

I'm having trouble getting rubyc to compile my project on Windows. It works fine on OS X.

It appears that the zlib header is missing. I thought it might be in the C:\Users\Tom\AppData\Local\Temp\rubyc\zlib directory, but it isn't.

Any ideas?

Command Line Output

C:\Users\Tom\proj\interwang>rubyc bin\interwang.rb
-> Project root not supplied, C:/Users/Tom/proj/interwang assumed.
Ruby Compiler (rubyc) v0.4.0
- entrance: C:/Users/Tom/proj/interwang/bin/interwang.rb
- options: {:make_args=>"-j4", :output=>"C:/Users/Tom/proj/interwang/a.exe", :tmpdir=>"C:/Users/Tom/AppData/Local/Temp/rubyc"}

-> mkdir -p C:/Users/Tom/AppData/Local/Temp/rubyc
-> cp -r "C:/__enclose_io_memfs__/local/ruby" "C:/Users/Tom/AppData/Local/Temp/rubyc/ruby-2.4.1-0.4.0"
-> cd C:/Users/Tom/AppData/Local/Temp/rubyc/ruby-2.4.1-0.4.0
-> cd C:/Users/Tom/proj/interwang
-> cd C:/Users/Tom/AppData/Local/Temp/rubyc/ruby-2.4.1-0.4.0
-> Running [{"CI"=>"true", "ENCLOSE_IO_USE_ORIGINAL_RUBY"=>"1", "ENCLOSE_IO_RUBYC_1ST_PASS"=>"1", "ENCLOSE_IO_RUBYC_2ND_PASS"=>nil}, "call win32\\configure.bat                                   --disable-install-doc                                   --prefix=\"C:/Users/Tom/AppData/Local/Temp/rubyc/ruby-2.4.1-0.4.0/build\""]
Creating verconf.mk
Creating Makefile.new
"type `nmake' to make ruby."
-> Running [{"CI"=>"true", "ENCLOSE_IO_USE_ORIGINAL_RUBY"=>"1", "ENCLOSE_IO_RUBYC_1ST_PASS"=>"1", "ENCLOSE_IO_RUBYC_2ND_PASS"=>nil}, "nmake "]

Microsoft (R) Program Maintenance Utility Version 14.12.25835.0
Copyright (C) Microsoft Corporation.  All rights reserved.

        CC = cl -nologo
        LD = cl -nologo
        LDSHARED = cl -nologo -LD
        CFLAGS = -MD -Zi -W2 -wd4100 -wd4127 -wd4210 -wd4214 -wd4255 -wd4574  -wd4668 -wd4710 -wd4711 -wd4820 -wd4996  -we4028 -we4142 -O2sy-  -Zm600  -MD /Ox  -I"C:/Users/Tom/AppData/Local/Temp/rubyc/zlib"
        XCFLAGS = -DRUBY_EXPORT -I. -I.ext/include/i386-mswin32_140 -I./include -I. -I./enc/unicode/9.0.0  -MD /Ox  -I"C:/Users/Tom/AppData/Local/Temp/rubyc/zlib"
 CPPFLAGS = -D_WIN32_WINNT=0x0600
 DLDFLAGS = -incremental:no -debug -opt:ref -opt:icf -libpath:"C:\Users\Tom\AppData\Local\Temp\rubyc\zlib" "C:/Users/Tom/AppData/Local/Temp/rubyc/zlib/zlib.lib" -dll
 SOLIBS =
generating known_errors.inc
known_errors.inc unchanged
file2lastrev.rb: does not seem to be under a vcs: .
./revision.h unchanged
generating id.h
id.h updated
Creating config.h
.ext\include\i386-mswin32_140\ruby\config.h updated
Creating config.status
compiling main.c
main.c
c:\users\tom\appdata\local\temp\rubyc\ruby-2.4.1-0.4.0\include\enclose_io_win32.h(24): warning C4005: 'stat': macro redefinition
c:\users\tom\appdata\local\temp\rubyc\ruby-2.4.1-0.4.0\include\ruby/win32.h(171): note: see previous definition of 'stat'
c:\users\tom\appdata\local\temp\rubyc\ruby-2.4.1-0.4.0\include\enclose_io_win32.h(25): warning C4005: 'fstat': macro redefinition
c:\users\tom\appdata\local\temp\rubyc\ruby-2.4.1-0.4.0\include\ruby/win32.h(172): note: see previous definition of 'fstat'
compiling dmydln.c
dmydln.c
compiling miniruby.rc
compiling miniinit.c
miniinit.c
compiling dmyext.c
dmyext.c
generating miniprelude.c
miniprelude.c updated
compiling miniprelude.c
miniprelude.c
compiling autoupdate_autoupdate.c
autoupdate_autoupdate.c
autoupdate_autoupdate.c(10): fatal error C1083: Cannot open include file: 'zlib.h': No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\HostX86\x86\cl.EXE"' : return code '0x2'
Stop.
Failed running [{"CI"=>"true", "ENCLOSE_IO_USE_ORIGINAL_RUBY"=>"1", "ENCLOSE_IO_RUBYC_1ST_PASS"=>"1", "ENCLOSE_IO_RUBYC_2ND_PASS"=>nil}, "nmake "]

Contents of zlib directory

Directory of C:\Users\Tom\AppData\Local\Temp\rubyc\zlib

2018-02-12  17:51    <DIR>          .
2018-02-12  17:51    <DIR>          ..
2017-08-14  20:08             5,204 adler32.c
2017-08-14  20:08    <DIR>          amiga
2017-08-14  20:08            78,553 ChangeLog
2017-08-14  20:08             8,099 CMakeLists.txt
2017-08-14  20:08             2,699 compress.c
2017-08-14  20:08            28,244 configure
2018-02-12  17:51    <DIR>          contrib
2017-08-14  20:08            16,573 FAQ
2017-08-14  20:08             1,988 INDEX
2017-08-14  20:08               100 Makefile
2017-08-14  20:08            13,680 Makefile.in
2017-08-14  20:08             5,187 README
              10 File(s)        160,327 bytes

undefined local variable or method `gemspec'

Using rubyc cloned from master:

Traceback (most recent call last):
        6: from /__enclose_io_memfs__/local/bin/rubyc:143:in `<main>'
        5: from /__enclose_io_memfs__/local/lib/compiler.rb:681:in `run!'
        4: from /__enclose_io_memfs__/local/lib/compiler.rb:808:in `prepare_local'
        3: from /__enclose_io_memfs__/local/lib/compiler/utils.rb:86:in `chdir'
        2: from /__enclose_io_memfs__/local/lib/compiler/utils.rb:86:in `chdir'
        1: from /__enclose_io_memfs__/local/lib/compiler/utils.rb:86:in `block in chdir'
/__enclose_io_memfs__/local/lib/compiler.rb:824:in `block in prepare_local': undefined local variable or method `gemspec' for #<Compiler:0x000055fb177aa928> (NameError)
Did you mean?  gemspecs

install_from_gemspec gemspec.first, gemfiles

Command used (nothing insane):

CPPFLAGS=-P /usr/local/bin/rubyc bin/sample -r . -d /tmp -o sample

Directory content:

drwxrwxr-x 2 dimitri dimitri 3,5K mai   12 12:11 bin
-rw-rw-r-- 1 dimitri dimitri 3,3K mai    8 11:22 gems.locked
-rw-rw-r-- 1 dimitri dimitri 1,4K mai    8 11:22 gems.rb
drwxrwxr-x 3 dimitri dimitri 3,5K mai   12 12:11 lib
-rw-rw-r-- 1 dimitri dimitri 1,9K mai   12 11:50 sample.gemspec

Symbol not found: _clock_gettime

maybe because I'm on Yosemite ... but a better error message would be good :)

./rubyc help
dyld: lazy symbol binding failed: Symbol not found: _clock_gettime
  Referenced from: /Users/mgrosser/Code/tools/ruco/./rubyc (which was built for Mac OS X 10.12)
  Expected in: /usr/lib/libSystem.B.dylib

Error while compiling rails app

I am using ruby 2.3.3 with Rails 5.0.4
While trying to compile a rails app with ./rubyc bin/rails I ran into an error:

In file included from ./curses.priv.h:325:0,
                 from ../ncurses/lib_gen.c:19:
_29511.c:843:15: error: expected ‘)’ before ‘int’
Makefile:962: recipe for target '../objects/lib_gen.o' failed
make[1]: *** [../objects/lib_gen.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/tmp/rubyc/ncurses/ncurses'
Makefile:113: recipe for target 'all' failed
make: *** [all] Error 2
Failed running [{"CI"=>"true", "ENCLOSE_IO_USE_ORIGINAL_RUBY"=>"1", "CFLAGS"=>" -fPIC -O3 -fno-fast-math -ggdb3 -Os -fdata-sections -ffunction-sections -pipe ", "LDFLAGS"=>""}, "make -j4"]

And the the output executable binary file was not created. Any light on this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.