twitter-text icon indicating copy to clipboard operation
twitter-text copied to clipboard

JRuby Support

Open jeremyhaile opened this issue 7 years ago • 12 comments

twitter-text 2.x depends on the idn-ruby gem which doesn't currently support JRuby. This means that twitter-text also doesn't work on JRuby.

Was this intentional? Is there any workaround? Can the dependency on idn-ruby be made optional?

jeremyhaile avatar Dec 22 '17 15:12 jeremyhaile

I second making idn-ruby optional. I'd happily take an error message saying that a domain name in kanji can't be supported over having to deal with idn-ruby ( which looks like a dead gem dependent on some ugly hackery to install libidn )

iantheparker avatar Dec 31 '17 04:12 iantheparker

This dependency on idn-ruby also breaks JRuby support for gollum. We too would appreciate it if idn-ruby were made optional.

bartkamphorst avatar Jan 16 '18 11:01 bartkamphorst

Also, having trouble installing idn-ruby even in a standard Rails-MRI setup. @kaushlakers Any thoughts on what and when solution are you folks considering for this?

oyeanuj avatar Feb 03 '18 19:02 oyeanuj

brew install libidn

zegomesjf avatar Feb 20 '18 17:02 zegomesjf

@zegomesjf is there anything like that for Ubuntu users? I tried sudo apt-get install idn, and the library is installed, but the gem can't find it.

I also tried installing as indicated here: http://www.gnu.org/software/libidn/ but the gem still can't find it

Finally I followed the instructions here: http://www.linuxfromscratch.org/blfs/view/cvs/general/libidn.html the gem still can't find it.

This is the error message I get:

Installing idn-ruby 0.1.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /home/ubuntu/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/idn-ruby-0.1.0/ext
/home/ubuntu/.rbenv/versions/2.5.0/bin/ruby -r ./siteconf20180301-15079-169teyr.rb extconf.rb
checking for -lidn... no
ERROR: could not find idn library!

  Please install the GNU IDN library or alternatively specify at least one
  of the following options if the library can only be found in a non-standard
  location:
    --with-idn-dir=/path/to/non/standard/location
        or
    --with-idn-lib=/path/to/non/standard/location/lib
    --with-idn-include=/path/to/non/standard/location/include

*** 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/ubuntu/.rbenv/versions/2.5.0/bin/$(RUBY_BASE_NAME)
	--with-idn-dir
	--without-idn-dir
	--with-idn-include
	--without-idn-include=${idn-dir}/include
	--with-idn-lib
	--without-idn-lib=${idn-dir}/lib
	--with-idnlib
	--without-idnlib

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

  /home/ubuntu/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/extensions/x86_64-linux/2.5.0-static/idn-ruby-0.1.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/ubuntu/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/idn-ruby-0.1.0 for inspection.
Results logged to /home/ubuntu/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/extensions/x86_64-linux/2.5.0-static/idn-ruby-0.1.0/gem_make.out

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

In Gemfile:
  twitter-text was resolved to 2.1.0, which depends on
    idn-ruby

octopusinvitro avatar Mar 01 '18 16:03 octopusinvitro

I have this same error , help us to resolve it. [ Fetching idn-ruby 0.1.0 Installing idn-ruby 0.1.0 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /home/inuscg/.rvm/gems/ruby-2.3.0@idt-two/gems/idn-ruby-0.1.0/ext

/home/inuscg/.rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20180427-3409-q264pw.rb extconf.rb checking for main() in -lidn... no ERROR: could not find idn library!

Please install the GNU IDN library or alternatively specify at least one of the following options if the library can only be found in a non-standard location: --with-idn-dir=/path/to/non/standard/location or --with-idn-lib=/path/to/non/standard/location/lib --with-idn-include=/path/to/non/standard/location/include

*** 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/inuscg/.rvm/rubies/ruby-2.3.0/bin/$(RUBY_BASE_NAME) --with-idn-dir --without-idn-dir --with-idn-include --without-idn-include=${idn-dir}/include --with-idn-lib --without-idn-lib=${idn-dir}/lib --with-idnlib --without-idnlib

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

/home/inuscg/.rvm/gems/ruby-2.3.0@idt-two/extensions/x86_64-linux/2.3.0/idn-ruby-0.1.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/inuscg/.rvm/gems/ruby-2.3.0@idt-two/gems/idn-ruby-0.1.0 for inspection. Results logged to /home/inuscg/.rvm/gems/ruby-2.3.0@idt-two/extensions/x86_64-linux/2.3.0/idn-ruby-0.1.0/gem_make.out

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

In Gemfile: twitter-text was resolved to 2.1.0, which depends on idn-ruby ](url)

pmokariya avatar Apr 27 '18 03:04 pmokariya

Try with this: sudo apt-get install libghc-gnuidn-dev This fix it for me!

dfutrille avatar Jun 14 '18 22:06 dfutrille

FYI, @shibafu528 has patches for twitter-text to use simpleidn https://github.com/mmriis/simpleidn instead of idn-ruby https://github.com/shibafu528/twitter-text/commit/80cdb0c76e64a71401c1bd4cb2f58327c82d99ff with some modification https://github.com/shibafu528/simpleidn/commit/69420ce9777a4b2a338dd981b31a3d4fc39dd72b

tsutsui avatar Mar 09 '19 12:03 tsutsui

For mac, do brew install libidn and then you can install gem install idn-ruby -v '0.1.0' --source 'https://rubygems.org/'

rburton avatar Jun 01 '19 02:06 rburton

I'd like to bump this issue. On apple m1 arm64 architecture libidn does no longer compile, so brew install libidn is no longer valid.

Is there any reason why switching to simpleidn is not a good idea?

xijo avatar Mar 03 '21 16:03 xijo

For those using the apple m1, you can install it by passing the path to the lib as it does not seem to be able to find it otherwise. Something like:

bew install libidn
gem install idn-ruby -v '0.1.0' -- --with-idn-dir=/opt/homebrew/Cellar/libidn/1.36/

teomores avatar Apr 26 '21 10:04 teomores

For those using the apple m1, you can install it by passing the path to the lib as it does not seem to be able to find it otherwise. Something like:

bew install libidn
gem install idn-ruby -v '0.1.0' -- --with-idn-dir=/opt/homebrew/Cellar/libidn/1.36/

This solution worked for me except libidn is now 1.41. Thank you so much!

herrowna avatar Nov 30 '22 04:11 herrowna