Skip to content

braintree 3.0.0 onward incompatible with JRuby #252

@Jimjamjimbo

Description

@Jimjamjimbo

Issue

Cannot install versions 3.0.0 or later of braintree with JRuby due to dependency on libxml-ruby

How to replicate

With any version of JRuby, attempt to install braintree with gem install braintree.

Gives the following output:

$ gem install braintree
Fetching braintree-3.4.0.gem
Building native extensions. This could take a while...
ERROR:  Error installing braintree:
        ERROR: Failed to build gem native extension.

    current directory: C:/jruby-9.2.21.0/lib/ruby/gems/shared/gems/libxml-ruby-5.0.4/ext/libxml
C:/jruby-9.2.21.0/bin/jruby.exe -I C:/jruby-9.2.21.0/lib/ruby/stdlib -r ./siteconf20250618-19088-1wud3mo.rb extconf.rb
checking for libxml/xmlversion.h in /opt/include/libxml2,/opt/local/include/libxml2,/opt/homebrew/opt/libxml2/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2,/usr/local/include,/usr/local/opt/libxml2/include/libxml2... RuntimeError: The compiler failed to generate an executable file.
You have to install development tools first.

        try_do at C:/jruby-9.2.21.0/lib/ruby/stdlib/mkmf.rb:456
       try_cpp at C:/jruby-9.2.21.0/lib/ruby/stdlib/mkmf.rb:587
   find_header at C:/jruby-9.2.21.0/lib/ruby/stdlib/mkmf.rb:1144
  checking_for at C:/jruby-9.2.21.0/lib/ruby/stdlib/mkmf.rb:942
      postpone at C:/jruby-9.2.21.0/lib/ruby/stdlib/mkmf.rb:350
          open at C:/jruby-9.2.21.0/lib/ruby/stdlib/mkmf.rb:320
      postpone at C:/jruby-9.2.21.0/lib/ruby/stdlib/mkmf.rb:350
          open at C:/jruby-9.2.21.0/lib/ruby/stdlib/mkmf.rb:320
      postpone at C:/jruby-9.2.21.0/lib/ruby/stdlib/mkmf.rb:346
  checking_for at C:/jruby-9.2.21.0/lib/ruby/stdlib/mkmf.rb:941
   find_header at C:/jruby-9.2.21.0/lib/ruby/stdlib/mkmf.rb:1143
        <main> at extconf.rb:28
*** 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=C:/jruby-9.2.21.0/bin/jruby
        --with-xml2-config
        --without-xml2-config
        --with-xml2-dir
        --without-xml2-dir
        --with-xml2-include
        --without-xml2-include=${xml2-dir}/include
        --with-xml2-lib
        --without-xml2-lib=${xml2-dir}/lib

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

  C:/jruby-9.2.21.0/lib/ruby/gems/shared/extensions/universal-java-11/2.5.0/libxml-ruby-5.0.4/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in C:/jruby-9.2.21.0/lib/ruby/gems/shared/gems/libxml-ruby-5.0.4 for inspection.
Results logged to C:/jruby-9.2.21.0/lib/ruby/gems/shared/extensions/universal-java-11/2.5.0/libxml-ruby-5.0.4/gem_make.out

mkmf.log contains the following:

" -o conftest.exe -I/include/universal-java11 -IC:/jruby-9.2.21.0/lib/ruby/include/ruby/backward -IC:/jruby-9.2.21.0/lib/ruby/include -I.     -fno-omit-frame-pointer -fno-strict-aliasing  -fexceptions  conftest.c  -L. -LC:/jruby-9.2.21.0/lib  -LC:/jruby-9.2.21.0/lib/native/x86_64-Windows   -m64 -march=native -mtune=native      "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <ruby.h>
4: int main(int argc, char **argv)
5: {
6:   return 0;
7: }
/* end */

Proposed fix

Replace libxml-ruby with another XML parser such as nokogiri
Alternatively, use platform-dependant dependencies and/or replace with JRuby implementation such as libxml-jruby

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions