Error while bundle install for idn-ruby - ruby-on-rails

I have twitter-text gem in my application.
When I do a bundle install I am getting the below error.
Need to solve it on high priority.
I also went to the github page https://github.com/twitter/twitter-text/issues/225
but could not find a solution there.
I tried to install directly using the line below but got the same error.
gem install idn-ruby -v '0.1.0'
Error
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-13217-1wpq9sy.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
Thank you in advance

As per the error show in logs
ERROR: could not find idn library!. idn library is required to install twitter text. Try to install that first and then install the gem. Try with
sudo apt-get install libldap2-dev
sudo apt-get install libidn11-dev
Hope this solves your problem.
For mac:
brew install libidn

On a Mac, you can do:
$ brew install libidn

If you're using Mac OS, then here's how to install libidn:
$ brew install libidn

On Centos 7 I had to install libidn-devel via yum install libidn-devel

If you are using Windows and facing same error, then try
Instruction for Windows
Get the appropriate build of GNU LibIDN Library from here
Unpack it where you prefer (e.g. c:\tmp\libs\libidn)
Add option to bundler config
BUNDLE_BUILD__IDN-RUBY: "--with-idn-dir=C:/tmp/libs/libidn/"
Launch bundler install
As for me I used libidn-1.33-win64.zip package

You're required to install LibIDN beforehand, since the gem is just ruby bindings for it.
Requirements
GNU LibIDN Library
Rake to run the tests and generate the documentation
RubyGems to produce a Gem package
Ruby 1.9.1 or above. Patches welcome to make this work in 1.8.7
The specific download method would depend on your OS, but if it's Ubuntu, try sudo apt-get install libidn

Related

How to install ruby-odbc gem on M1 Mac

I am trying to get a rails project running on an M1 mac.
I have to use ruby 2.6.2 and rails 5.2.3
I am using rbenv 1.1.2 and homebrew 3.0
When I run bundle install, I get this error
An error occurred while installing ruby-odbc (0.99999), and Bundler cannot continue.
Make sure that `gem install ruby-odbc -v '0.99999'` succeeds before bundling.
So then I run gem install ruby-odbc -v '0.99999'
This leads to another error
ERROR: Error installing ruby-odbc:
ERROR: Failed to build gem native extension.
current directory: /Users/david.lee/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/ruby-
odbc-0.99999/ext
/Users/david.lee/.rbenv/versions/2.6.2/bin/ruby -I
/Users/david.lee/.rbenv/versions/2.6.2/lib/ruby/2.6.0 -r ./siteconf20210208-46271-1tguvxe.rb
extconf.rb
checking for version.h... no
checking for sql.h... no
*** 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/david.lee/.rbenv/versions/2.6.2/bin/$(RUBY_BASE_NAME)
--with-odbc-dir
--without-odbc-dir
--with-odbc-include
--without-odbc-include=${odbc-dir}/include
--with-odbc-lib
--without-odbc-lib=${odbc-dir}/lib
ERROR: sql.h not found
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/david.lee/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/extensions/-darwin-20/2.6.0/ruby-odbc-0.99999/mkmf.log
When I stackoverflow this error, I get this post which tells me to brew install unixodbc, so I do that and try to bundle install again, which gives me the same error.
All the stackoverflow posts related to sql.h files not being installed do not solve my issue.
HOW DO I INSTALL THIS GEM?
Thanks to a co-worker, I got this resolved.
You need to install the gem while pointing it to the unixodbc directory
This was the line that installed it for me
gem install ruby-odbc -- --with-odbc-dir=/opt/homebrew/Cellar/unixodbc/2.3.9
To find your unixodbc path, run brew info unixodbc
That will give you the path and your version number of unixodbc. Then you put the path and version number in the appropriate spot
gem install ruby-odbc -- --with-odbc-dir=put your path and version number of unixodbc here
None of the above solutions worked for me when I had this error. This is what worked for me:
bundle config set build.ruby-odbc --with-odbc-dir=/opt/homebrew/Cellar/unixodbc/2.3.11
Per this StackOverflow post
If you need this to work while running the bundle command, do the following:
bundle config build.odbc --with-odbc-dir=$(brew --prefix unixodbc)

Bundle Install / TheRubyRacer gem cannot be installed on MacOS Catalina 10.15.2

I'm getting tired of error when trying to bundle install and install therubyracer.
I've tried everything from around the net and nothing helps.
Already installed libv8 and x-code setup.
Appreciate your help!
After command sudo gem install therubyracer -v '0.12.3', I'm receivin error:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.6.0/gems/therubyracer-0.12.3/ext/v8
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20191219-41979-115mu26.rb extconf.rb
checking for -lpthread... yes
checking for -lobjc... yes
checking for v8.h... no
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
--with-pthreadlib
--without-pthreadlib
--with-objclib
--without-objclib
--enable-debug
--disable-debug
--with-v8-dir
--without-v8-dir
--with-v8-include
--without-v8-include=${v8-dir}/include
--with-v8-lib
--without-v8-lib=${v8-dir}/lib
/Library/Ruby/Gems/2.6.0/gems/libv8-3.16.14.19/ext/libv8/location.rb:50:in `configure': By using --with-system-v8, you have chosen to use the version (Libv8::Location::System::NotFoundError)
of V8 found on your system and *not* the one that is bundled with
the libv8 rubygem.
However, your system version of v8 could not be located.
Please make sure your system version of v8 that is compatible
with 3.16.14.19 installed. You may need to use the
--with-v8-dir option if it is installed in a non-standard location
from /Library/Ruby/Gems/2.6.0/gems/libv8-3.16.14.19/lib/libv8.rb:7:in `configure_makefile'
from extconf.rb:32:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/therubyracer-0.12.3/mkmf.log
extconf failed, exit code 1 ```
I've found the solution for this error.
If you have a problem with bundle install check this:
gem list libv8 --remote --all
gem install libv8 -v 3.16.14.19 -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/Users/YOUR_NAME/homebrew/opt/v8#3.15
It works for me, after few hours of fighting with every solution I can find.
Hope it'll help someone.
I was stuck on the same issue and got help from this gist.
brew install v8#3.15
gem install libv8 -v 'YOUR_VERSION' -- --with-system-v8
gem install therubyracer -v 'YOUR_VERSION' -- --with-v8-dir=/usr/local/opt/v8#3.15
bundle install
I am using macOS Catalina version 10.15.3 and ruby version 2.6.3. I hope it helps!
I have faced the same issue recently in Mac OS 10.15.7
brew install v8-315
gem install libv8 -v '3.16.14.19' -- --with-system-v
gem install therubyracer -v '0.12.3' -- --with-system-v8 --with-v8-dir=/usr/local/opt/v8#3.15
Note: while installing ruby race it installed only after putting both the options together --with-system-v8 and --with-v8-dir and pointing to that directory.
Please do verify if the folder exist in that path or not before installing.
Uninstalling v8 and install v8#3.15 on a fresh Catalina install worked for me.
$ brew uninstall v8
$ brew install v8#3.15

I'm trying to install OpenGraph gem in ruby

I've searched entire web looking for a way to get over this error. But it won't budge. I installed all the libraries and dependencies according to my knowledge even uninstalled ruby and nokogiri and reinstalled again. But this error remains here.
Gem files will remain installed in /home/$User/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/nokogiri-1.4.7 for inspection.
Results logged to /home/$User/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0-static/nokogiri-1.4.7/gem_make.out
This is from the gem_make.out log file from this location -> /.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0-static/nokogiri-1.4.7/gem_make.out
ERROR: Error installing opengraph:
ERROR: Failed to build gem native extension.
current directory: /home/$User/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/nokogiri-1.4.7/ext/nokogiri
/home/$User/.rbenv/versions/2.4.2/bin/ruby -r ./siteconf20171125-15877-nibcps.rb extconf.rb --with-nokogiri-dir=/home/$User/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/
*** 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/$User/.rbenv/versions/2.4.2/bin/$(RUBY_BASE_NAME)
extconf.rb:10:in `<main>': uninitialized constant Config (NameError)
Did you mean? RbConfig
CONFIG
extconf failed, exit code 1
I'd be very thankful to you if you could tell me what's wrong with it. Is it a bug in OpenGraph.
P.S: I'm not using opengraph_parser because it has a fallback method. I need opengraph gem because I need to catch the exception.
It's not opengraph, but rather nokogiri.
Nokogiri is a dependency for opengraph.
https://rubygems.org/gems/opengraph/versions/0.0.4
So, it must be related on your machine not having the dependencies needed to support nokogiri (libxml2).
Install these dependencies on your machine (assuming your on Debian/Ubuntu):
sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev
Fedora/Red Hat/CentOS:
sudo yum install -y gcc ruby-devel zlib-devel
sudo yum install -y rubygem-nokogiri (alternative)
Then try installing nokogiri by gem install nokogiri
For other variants, or OS:
http://www.nokogiri.org/tutorials/installing_nokogiri.html
For Fedora 26:
Until further notice, install nokogiri version < 1.8

An error occurred while installing rugged

Following this tutorial [link] to install gitlab on a dedicated server. I need to :
sudo -u git -H bundle install --deployment --without development test postgres aws
But an error occurred while installing rugged :
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for cmake... no
ERROR: CMake is required to build Rugged.
*** 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=/usr/local/bin/ruby
Gem files will remain installed in /home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/rugged-0.21.2 for inspection.
Results logged to /home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/rugged-0.21.2/ext/rugged/gem_make.out
An error occurred while installing rugged (0.21.2), and Bundler cannot continue.
Make sure that `gem install rugged -v '0.21.2'` succeeds before bundling.
So I installed rugged -> I installed CMake & config-pkg :
/home/git/gitlab$ sudo gem install rugged
Building native extensions. This could take a while...
Successfully installed rugged-0.21.2
Parsing documentation for rugged-0.21.2
unable to convert "\xC0" from ASCII-8BIT to UTF-8 for lib/rugged/rugged.so, skipping
1 gem installed
But it doesnt change anything :
Errno::EACCES: Permission denied - /home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/rugged-0.21.2/LICENSE
An error occurred while installing rugged (0.21.2), and Bundler cannot continue.
Make sure that `gem install rugged -v '0.21.2'` succeeds before bundling.
Any idea ?
For OSX if you're using homebrew:
brew install cmake
bundle install
First, try installing cmake:
sudo apt-get install cmake
Then, repeat the command:
sudo -u git -H bundle install --deployment --without development test postgres aws
For me, gem was complaining about pkg-config missing dependence, so I did:
sudo apt-get install pkg-config
and then
sudo gem install rugged -v '0.22.2'
after that, I revert to my older version of gitlab and re-run the script for the upgrade.
My older version of gitlab was 6.9.2 and the upgraded version 8.0.5
Can fix this problem only that way:
download from https://cmake.org/download/. Extract the downloaded tar file and then:
cd $CMAKE_DOWNLOAD_PATH
./configure
make
make install
And after this steps I could successfully run:
gem install rugged -v '0.26.0'
Note: The above mentioned solutions did not work for me.
Here is the error log I got
checking for gmake... no
checking for make... yes
Building Rugged using system libraries.
libgit2 version is not compatible, expected ~> 0.99.0
*** 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.
It was mainly saying libgit2 version is not compatible, expected ~> 0.99.0
and I tried gem install rugged -v '0.99.0' and then bundle install.
then the problem is solved.
Mac OSX 10.6 or later please refer to this url:
http://www.cmake.org/download/
For me it was Openssl problem in a WSL ubuntu 20.04 env
Run
apt install cmake libssl-dev
might also help to run
apt install ruby-dev pkg-config

Can't install RMagick 2.13.1. Can't find Magick-config

$ gem install rmagick
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/Users/XXXXXXX/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... no
Can't install RMagick 2.13.1. Can't find Magick-config in /Users/XXXXXXX/.rvm/gems/ruby-1.9.2-p180/bin:/Users/XXXXXXX/.rvm/gems/ruby-1.9.2-p180#global/bin:/Users/XXXXXXX/.rvm/rubies/ruby-1.9.2-p180/bin:/Users/XXXXXXX/.rvm/bin:/Users/XXXXXXX/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin
*** 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/XXXXXXX/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
Gem files will remain installed in /Users/XXXXXXX/.rvm/gems/ruby-1.9.2-p180/gems/rmagick-2.13.1 for inspection.
Results logged to /Users/XXXXXXX/.rvm/gems/ruby-1.9.2-p180/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
But when I do this:
$ locate Magick-config
/opt/local/bin/Magick-config
/opt/local/share/man/man1/Magick-config.1.gz
/opt/local/var/macports/software/ImageMagick/6.6.4-9_0+q16/opt/local/bin/Magick-config
/opt/local/var/macports/software/ImageMagick/6.6.4-9_0+q16/opt/local/share/man/man1/Magick-config.1.gz
/opt/local/var/macports/software/ImageMagick/6.6.5-0_0+q16/opt/local/bin/Magick-config
/opt/local/var/macports/software/ImageMagick/6.6.5-0_0+q16/opt/local/share/man/man1/Magick-config.1.gz
Any ideas?
command: sudo apt-get install libmagickwand-dev
It isn't quite the answer to the question, but the recommended way of installing Imagemagick and Rmagick on Mac is through homebrew. It's the only way I could get Imagemagick and Rmagick playing nicely together on Mac.
For Ubuntu (11.10+) try installing the libmagick++-dev package.
For other Linux distributions, try installing the libmagick-dev package.
For my case, I am installing it on Ubuntu/Linaro 4.5.2-8ubuntu3, got same error, tried to installed the following two package suites and it worked, maybe either one of them:
sudo apt-get install graphicsmagick-libmagick-dev-compat
sudo apt-get install libmagickwand-dev
On mac, after
brew install imagemagick
Don't forget to link dylibs with:
brew link imagemagick
I had to transfer an old application to a debian stretch server.
The used ruby version was 2.0.x.
imagemagick was installed including libmagickwand-dev.
Trying to install rmagick 2.13.2 failed.
I had to upgrade the rmagick verion (patched my Gemfile.lock) to use rmagick 2.16.0, the last version supporting ruby 2.0.

Resources