twitter / twitter-text

Twitter Text Libraries. This code is used at Twitter to tokenize and parse text to meet the expectations for what can be used on the platform.
https://developer.twitter.com/en/docs/counting-characters
Apache License 2.0
3.07k stars 510 forks source link

Cannot bundle install gem inside a Docker container #343

Closed knajjars closed 3 years ago

knajjars commented 3 years ago

When I try to run the command bundle to install all Ruby gems inside a Docker container I get the following error:

#9 156.1 Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
#9 156.1 
#9 156.1     current directory: /usr/local/bundle/gems/idn-ruby-0.1.0/ext
#9 156.1 /usr/local/bin/ruby -I /usr/local/lib/ruby/3.0.0 -r
#9 156.1 ./siteconf20210403-1-cc9cj.rb extconf.rb
#9 156.1 checking for -lidn... no
#9 156.1 ERROR: could not find idn library!
#9 156.1 
#9 156.1   Please install the GNU IDN library or alternatively specify at least one
#9 156.1   of the following options if the library can only be found in a non-standard
#9 156.1   location:
#9 156.1     --with-idn-dir=/path/to/non/standard/location
#9 156.1         or
#9 156.1     --with-idn-lib=/path/to/non/standard/location/lib
#9 156.1     --with-idn-include=/path/to/non/standard/location/include
#9 156.1 
#9 156.1 *** extconf.rb failed ***
#9 156.1 Could not create Makefile due to some reason, probably lack of necessary
#9 156.1 libraries and/or headers.  Check the mkmf.log file for more details.  You may
#9 156.1 need configuration options.
#9 156.1 
#9 156.1 Provided configuration options:
#9 156.1        --with-opt-dir
#9 156.1        --without-opt-dir
#9 156.1        --with-opt-include
#9 156.1        --without-opt-include=${opt-dir}/include
#9 156.1        --with-opt-lib
#9 156.1        --without-opt-lib=${opt-dir}/lib
#9 156.1        --with-make-prog
#9 156.1        --without-make-prog
#9 156.1        --srcdir=.
#9 156.1        --curdir
#9 156.1        --ruby=/usr/local/bin/$(RUBY_BASE_NAME)
#9 156.1        --with-idn-dir
#9 156.1        --without-idn-dir
#9 156.1        --with-idn-include
#9 156.1        --without-idn-include=${idn-dir}/include
#9 156.1        --with-idn-lib
#9 156.1        --without-idn-lib=${idn-dir}/lib
#9 156.1        --with-idnlib
#9 156.1        --without-idnlib
#9 156.1 
#9 156.1 To see why this extension failed to compile, please check the mkmf.log which can
#9 156.1 be found here:
#9 156.1 
#9 156.1   /usr/local/bundle/extensions/x86_64-linux-musl/3.0.0/idn-ruby-0.1.0/mkmf.log
#9 156.1 
#9 156.1 extconf failed, exit code 1
#9 156.1 
#9 156.1 Gem files will remain installed in /usr/local/bundle/gems/idn-ruby-0.1.0 for
#9 156.1 inspection.
#9 156.1 Results logged to
#9 156.1 /usr/local/bundle/extensions/x86_64-linux-musl/3.0.0/idn-ruby-0.1.0/gem_make.out
#9 156.1 
#9 156.1 An error occurred while installing idn-ruby (0.1.0), and Bundler cannot
#9 156.1 continue.
#9 156.1 Make sure that `gem install idn-ruby -v '0.1.0' --source
#9 156.1 'https://rubygems.org/'` succeeds before bundling.
#9 156.1 
#9 156.1 In Gemfile:
#9 156.1   twitter-text was resolved to 3.1.0, which depends on
#9 156.1     idn-ruby

In my Gemfile I have

gem 'twitter', '~> 7.0'
gem "idn-ruby", "~> 0.1.0"
gem 'twitter-text', '~> 3.1'

And for Dockerfile I install libidn as follows:

RUN apk add --update --virtual  libidn

Any suggestions?

antarr commented 3 years ago

@knajjars did you get this resolved?