braintree / braintree_ruby

Braintree Ruby library
https://developer.paypal.com/braintree/docs/start/overview
MIT License
444 stars 195 forks source link

braintree 3.0.1 won't install for JRuby #203

Closed mohamedhafez closed 3 years ago

mohamedhafez commented 3 years ago

I get the following error from bundler when I try to install version 3.0.1 of the braintree gem for my JRuby app. It looks like its trying to include a library with a native xml c extension, instead of a Java version. braintree versions 2.x.x always worked without issue. I'm using JRuby version 9.2.13.0 on MacOS 10.15.7

Fetching libxml-ruby 3.2.0
Installing libxml-ruby 3.2.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/Users/mohamed/.rvm/gems/jruby-9.2.13.0/gems/libxml-ruby-3.2.0/ext/libxml
/Users/mohamed/.rvm/rubies/jruby-9.2.13.0/bin/jruby -I
/Users/mohamed/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib -r
./siteconf20201023-26639-labq0m.rb extconf.rb
checking for libxml/xmlversion.h in
/opt/include/libxml2,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2,/usr/local/include...
RuntimeError: The compiler failed to generate an executable file.
You have to install development tools first.

try_do at
/Users/mohamed/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/mkmf.rb:456
try_cpp at
/Users/mohamed/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/mkmf.rb:587
find_header at
/Users/mohamed/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/mkmf.rb:1144
checking_for at
/Users/mohamed/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/mkmf.rb:942
postpone at
/Users/mohamed/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/mkmf.rb:350
open at
/Users/mohamed/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/mkmf.rb:320
postpone at
/Users/mohamed/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/mkmf.rb:350
open at
/Users/mohamed/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/mkmf.rb:320
postpone at
/Users/mohamed/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/mkmf.rb:346
checking_for at
/Users/mohamed/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/mkmf.rb:941
find_header at
/Users/mohamed/.rvm/rubies/jruby-9.2.13.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=/Users/mohamed/.rvm/rubies/jruby-9.2.13.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:

/Users/mohamed/.rvm/gems/jruby-9.2.13.0/extensions/universal-java-1.8/2.5.0/libxml-ruby-3.2.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
/Users/mohamed/.rvm/gems/jruby-9.2.13.0/gems/libxml-ruby-3.2.0 for inspection.
Results logged to
/Users/mohamed/.rvm/gems/jruby-9.2.13.0/extensions/universal-java-1.8/2.5.0/libxml-ruby-3.2.0/gem_make.out

An error occurred while installing libxml-ruby (3.2.0), and Bundler
cannot continue.
Make sure that `gem install libxml-ruby -v '3.2.0' --source
'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  braintree was resolved to 3.0.1, which depends on
    libxml-ruby
mohamedhafez commented 3 years ago

Here's the contents of mkmf.log referred to in the output above

" -o conftest -I/include/universal-java1.8 -I/Users/mohamed/.rvm/rubies/jruby-9.2.13.0/lib/ruby/include/ruby/backward -I/Users/mohamed/.rvm/rubies/jruby-9.2.13.0/lib/ruby/include -I.  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE     -DTARGET_RT_MAC_CFM=0  -fno-omit-frame-pointer -fno-strict-aliasing  -fexceptions  conftest.c  -L. -L/Users/mohamed/.rvm/rubies/jruby-9.2.13.0/lib    -arch x86_64      "
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 */

and gem_make.out:

current directory: /Users/mohamed/.rvm/gems/jruby-9.2.13.0/gems/libxml-ruby-3.2.0/ext/libxml
/Users/mohamed/.rvm/rubies/jruby-9.2.13.0/bin/jruby -I /Users/mohamed/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib -r ./siteconf20201023-26639-labq0m.rb extconf.rb
checking for libxml/xmlversion.h in /opt/include/libxml2,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2,/usr/local/include... RuntimeError: The compiler failed to generate an executable file.
You have to install development tools first.

        try_do at /Users/mohamed/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/mkmf.rb:456
       try_cpp at /Users/mohamed/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/mkmf.rb:587
   find_header at /Users/mohamed/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/mkmf.rb:1144
  checking_for at /Users/mohamed/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/mkmf.rb:942
      postpone at /Users/mohamed/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/mkmf.rb:350
          open at /Users/mohamed/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/mkmf.rb:320
      postpone at /Users/mohamed/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/mkmf.rb:350
          open at /Users/mohamed/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/mkmf.rb:320
      postpone at /Users/mohamed/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/mkmf.rb:346
  checking_for at /Users/mohamed/.rvm/rubies/jruby-9.2.13.0/lib/ruby/stdlib/mkmf.rb:941
   find_header at /Users/mohamed/.rvm/rubies/jruby-9.2.13.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=/Users/mohamed/.rvm/rubies/jruby-9.2.13.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:

  /Users/mohamed/.rvm/gems/jruby-9.2.13.0/extensions/universal-java-1.8/2.5.0/libxml-ruby-3.2.0/mkmf.log

extconf failed, exit code 1
mohamedhafez commented 3 years ago

I'm guessing this is due to adding libxml-ruby to the gemspec in version 3.x.x. If this is necessary for MRI ruby, then we may need a separate gemspec for jruby that excludes that line.

billwerges commented 3 years ago

Hi @mohamedhafez,

Version 3.x.x does require libxml-ruby, and full support for JRuby isn't guaranteed at this time.