Skip to content

Instantly share code, notes, and snippets.

@eregon
Last active February 2, 2022 12:13

Revisions

  1. eregon revised this gist Feb 2, 2022. 2 changed files with 15 additions and 0 deletions.
    File renamed without changes.
    15 changes: 15 additions & 0 deletions truffleruby-strscan.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    ```
    $ gem i strscan
    Fetching strscan-3.0.1.gem
    Building native extensions. This could take a while...
    Successfully installed strscan-3.0.1
    1 gem installed
    # Needs require "strscan.so" to repro because require "strscan" would always prefer strscan.rb even if later in $LOAD_PATH,
    # which luckily works around the issue but is not exactly fully reliable (e.g., if the gem adds strscan.rb at some point)
    $ ruby -e 'require "strscan.so"; s=StringScanner.new("This is an example string"); p s.eos?'
    /home/eregon/.rubies/truffleruby-dev/lib/gems/gems/strscan-3.0.1/ext/strscan/strscan.c:214:in `strscan_s_allocate': External LLVMFunction onig_region_init cannot be found. (com.oracle.truffle.llvm.runtime.except.LLVMLinkerException) (RuntimeError)
    Translated to internal error
    from /home/eregon/.rubies/truffleruby-dev/lib/truffle/truffle/cext.rb:1236:in `__allocate__'
    from -e:1:in `<main>'
    ```
  2. eregon revised this gist Feb 2, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion failing_default_gems.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    Testing on JRuby because the failures are clearer as it does not support C extensions.
    Testing on JRuby because the failures are clearer as it does not support C extensions, and JRuby 9.3 targets Ruby 2.6 which makes the errors clearer (no mix with new default gems in Ruby 3 which might hide errors with lucky versions).

    `io-wait`, `strscan` don't work on JRuby, but JRuby has those in stdlib and they work fine.
    So the immediate issue is some gems depend needleslly on those default gems when they don't need to.
  3. eregon revised this gist Feb 2, 2022. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion failing_default_gems.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    Testing on JRuby because the failures are clearer as it does not support C extensions.

    io-wait, strscan don't work on JRuby, but JRuby has those in stdlib and they work fine.
    `io-wait`, `strscan` don't work on JRuby, but JRuby has those in stdlib and they work fine.
    So the immediate issue is some gems depend needleslly on those default gems when they don't need to.

    ```
    source "https://rubygems.org"
  4. eregon revised this gist Feb 2, 2022. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion failing_default_gems.md
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,8 @@ source "https://rubygems.org"
    gem "net-imap"
    ```

    bundle
    ```
    $ bundle
    Fetching gem metadata from https://rubygems.org/...
    Resolving dependencies...
    Using bundler 2.2.29
    @@ -228,3 +229,4 @@ continue.
    In Gemfile:
    net-imap was resolved to 0.2.3, which depends on
    strscan
    ```
  5. eregon created this gist Feb 2, 2022.
    230 changes: 230 additions & 0 deletions failing_default_gems.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,230 @@
    Testing on JRuby because the failures are clearer as it does not support C extensions.

    io-wait, strscan don't work on JRuby, but JRuby has those in stdlib and they work fine.

    ```
    source "https://rubygems.org"
    gem "net-imap"
    ```

    bundle
    Fetching gem metadata from https://rubygems.org/...
    Resolving dependencies...
    Using bundler 2.2.29
    Using timeout 0.2.0
    Fetching io-wait 0.2.1
    Fetching digest 3.1.0 (java)
    Fetching strscan 3.0.1
    Installing strscan 3.0.1 with native extensions
    Installing io-wait 0.2.1 with native extensions
    Installing digest 3.1.0 (java)
    Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory:
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/gems/shared/gems/io-wait-0.2.1/ext/io/wait
    /home/eregon/.rubies/jruby-9.3.2.0/bin/jruby -I
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib -r
    ./siteconf20220202-10295-1hsq3js.rb extconf.rb
    checking for rb_io_wait()... *** extconf.rb failed ***
    Could not create Makefile due to some reason, probably lack of necessary
    libraries and/or headers. Check the mkmf.log file for more details. You may
    need configuration options.

    Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/home/eregon/.rubies/jruby-9.3.2.0/bin/jruby
    RuntimeError: The compiler failed to generate an executable file.
    You have to install development tools first.

    try_do at /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/mkmf.rb:456
    try_link0 at /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/mkmf.rb:541
    try_link at /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/mkmf.rb:556
    try_func at /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/mkmf.rb:765
    have_func at
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/mkmf.rb:1051
    checking_for at /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/mkmf.rb:942
    postpone at /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/mkmf.rb:350
    open at /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/mkmf.rb:320
    postpone at /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/mkmf.rb:350
    open at /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/mkmf.rb:320
    postpone at /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/mkmf.rb:346
    checking_for at /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/mkmf.rb:941
    have_func at
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/mkmf.rb:1050
    <main> at extconf.rb:5

    To see why this extension failed to compile, please check the mkmf.log which can
    be found here:

    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/gems/shared/extensions/universal-java-11/2.6.0/io-wait-0.2.1/mkmf.log

    extconf failed, exit code 1

    Gem files will remain installed in
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/gems/shared/gems/io-wait-0.2.1 for
    inspection.
    Results logged to
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/gems/shared/extensions/universal-java-11/2.6.0/io-wait-0.2.1/gem_make.out

    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/rubygems/ext/builder.rb:92:in
    `run'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb:47:in
    `block in build'
    org/jruby/ext/tempfile/Tempfile.java:242:in `open'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb:26:in
    `build'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/rubygems/ext/builder.rb:158:in
    `build_extension'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/rubygems/ext/builder.rb:192:in
    `block in build_extensions'
    org/jruby/RubyArray.java:1865:in `each'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/rubygems/ext/builder.rb:189:in
    `build_extensions'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/rubygems/installer.rb:837:in
    `build_extensions'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/bundler/rubygems_gem_installer.rb:66:in
    `build_extensions'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/bundler/rubygems_gem_installer.rb:26:in
    `install'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/bundler/source/rubygems.rb:199:in
    `install'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/bundler/installer/gem_installer.rb:54:in
    `install'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/bundler/installer/gem_installer.rb:16:in
    `install_from_spec'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/bundler/installer/parallel_installer.rb:186:in
    `do_install'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/bundler/installer/parallel_installer.rb:177:in
    `block in worker_pool'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/bundler/worker.rb:62:in
    `apply_func'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/bundler/worker.rb:57:in
    `block in process_queue'
    org/jruby/RubyKernel.java:1507:in `loop'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/bundler/worker.rb:54:in
    `process_queue'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/bundler/worker.rb:91:in
    `block in create_threads'

    An error occurred while installing io-wait (0.2.1), and Bundler cannot
    continue.

    In Gemfile:
    net-imap was resolved to 0.2.3, which depends on
    net-protocol was resolved to 0.1.2, which depends on
    io-wait


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

    current directory:
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/gems/shared/gems/strscan-3.0.1/ext/strscan
    /home/eregon/.rubies/jruby-9.3.2.0/bin/jruby -I
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib -r
    ./siteconf20220202-10295-1tfaekv.rb extconf.rb
    checking for onig_region_memsize() in ruby.h... *** extconf.rb failed ***
    Could not create Makefile due to some reason, probably lack of necessary
    libraries and/or headers. Check the mkmf.log file for more details. You may
    need configuration options.

    Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/home/eregon/.rubies/jruby-9.3.2.0/bin/jruby
    RuntimeError: The compiler failed to generate an executable file.
    You have to install development tools first.

    try_do at /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/mkmf.rb:456
    try_link0 at /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/mkmf.rb:541
    try_link at /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/mkmf.rb:556
    try_func at /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/mkmf.rb:765
    have_func at
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/mkmf.rb:1051
    checking_for at /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/mkmf.rb:942
    postpone at /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/mkmf.rb:350
    open at /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/mkmf.rb:320
    postpone at /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/mkmf.rb:350
    open at /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/mkmf.rb:320
    postpone at /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/mkmf.rb:346
    checking_for at /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/mkmf.rb:941
    have_func at
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/mkmf.rb:1050
    <main> at extconf.rb:4

    To see why this extension failed to compile, please check the mkmf.log which can
    be found here:

    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/gems/shared/extensions/universal-java-11/2.6.0/strscan-3.0.1/mkmf.log

    extconf failed, exit code 1

    Gem files will remain installed in
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/gems/shared/gems/strscan-3.0.1 for
    inspection.
    Results logged to
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/gems/shared/extensions/universal-java-11/2.6.0/strscan-3.0.1/gem_make.out

    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/rubygems/ext/builder.rb:92:in
    `run'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb:47:in
    `block in build'
    org/jruby/ext/tempfile/Tempfile.java:242:in `open'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb:26:in
    `build'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/rubygems/ext/builder.rb:158:in
    `build_extension'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/rubygems/ext/builder.rb:192:in
    `block in build_extensions'
    org/jruby/RubyArray.java:1865:in `each'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/rubygems/ext/builder.rb:189:in
    `build_extensions'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/rubygems/installer.rb:837:in
    `build_extensions'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/bundler/rubygems_gem_installer.rb:66:in
    `build_extensions'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/bundler/rubygems_gem_installer.rb:26:in
    `install'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/bundler/source/rubygems.rb:199:in
    `install'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/bundler/installer/gem_installer.rb:54:in
    `install'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/bundler/installer/gem_installer.rb:16:in
    `install_from_spec'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/bundler/installer/parallel_installer.rb:186:in
    `do_install'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/bundler/installer/parallel_installer.rb:177:in
    `block in worker_pool'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/bundler/worker.rb:62:in
    `apply_func'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/bundler/worker.rb:57:in
    `block in process_queue'
    org/jruby/RubyKernel.java:1507:in `loop'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/bundler/worker.rb:54:in
    `process_queue'
    /home/eregon/.rubies/jruby-9.3.2.0/lib/ruby/stdlib/bundler/worker.rb:91:in
    `block in create_threads'

    An error occurred while installing strscan (3.0.1), and Bundler cannot
    continue.

    In Gemfile:
    net-imap was resolved to 0.2.3, which depends on
    strscan