Failed to build gem native extension while installing rmovie gem - ruby-on-rails

I am trying to install rmovie gem on Ubuntu Desktop 12.04 LTS. ffmpeg is installed but I'm getting this error:
$ gem install rmovie
Building native extensions. This could take a while...
ERROR: Error installing rmovie:
ERROR: Failed to build gem native extension.
/home/ror_dev/.rvm/rubies/ruby-1.9.3-p362/bin/ruby extconf.rb
gcc -c -fpic -g qp_movie.c -o qp_movie.o
In file included from qp_movie.c:4:0:
qp_util.h:4:28: fatal error: ffmpeg/avcodec.h: No such file or directory
compilation terminated.
make: *** [qp_movie.o] Error 1
checking for avcodec_init() in -lavcodec... yes
checking for av_register_all() in -lavformat... yes
checking for quadrupel_init() in -lquadrupel... 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
--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/ror_dev/.rvm/rubies/ruby-1.9.3-p362/bin/ruby
--with-ffmpeg-dir
--without-ffmpeg-dir
--with-ffmpeg-include
--without-ffmpeg-include=${ffmpeg-dir}/include
--with-ffmpeg-lib
--without-ffmpeg-lib=${ffmpeg-dir}/lib
--with-quadrupel-dir
--without-quadrupel-dir
--with-quadrupel-include
--without-quadrupel-include=${quadrupel-dir}/include
--with-quadrupel-lib
--without-quadrupel-lib=${quadrupel-dir}/lib
--with-avcodeclib
--without-avcodeclib
--with-avformatlib
--without-avformatlib
--with-quadrupellib
--without-quadrupellib
extconf failed: need quadrupel library
First attempt was to relocate avcodec to where installer is searching for it. No success. Next - correcting paths in quadrupel files to point it to where avcodec is located. No success.
What is this quadrupel thing and how to force it to work?
Or maybe there is some replacement for rmovie?

Use github.com/streamio/streamio-ffmpeg, it is more actively developed. rmovie was developed in 2006 and it may not be compatible with the current version of ffmpeg

Do like this -
1) Keep the gem in a gemfile -
gem "rmovie", "~> 0.5.1"
2) Run bundle install
If still get errors try:
sudo apt-get install ffmpeg libavcodec-extra-52
If package not found try:
sudo apt-get install ffmpeg libavcodec-extra-53
you can also try to install the libmp3lame0 package:
sudo apt-get install libmp3lame0

Related

Can't install RMagick 4.2.3

I'm running Debian WSL 2 and I cannot install any version of RMagick.
I installed imagemagick#6 via homebrew and after installation I saw following:
imagemagick#6 is keg-only, which means it was not symlinked into /home/linuxbrew/.linuxbrew,
because this is an alternate version of another formula.
If you need to have imagemagick#6 first in your PATH, run:
echo 'export PATH="/home/linuxbrew/.linuxbrew/opt/imagemagick#6/bin:$PATH"' >> ~/.zshrc
For compilers to find imagemagick#6 you may need to set:
export LDFLAGS="-L/home/linuxbrew/.linuxbrew/opt/imagemagick#6/lib"
export CPPFLAGS="-I/home/linuxbrew/.linuxbrew/opt/imagemagick#6/include"
For pkg-config to find imagemagick#6 you may need to set:
export PKG_CONFIG_PATH="/home/linuxbrew/.linuxbrew/opt/imagemagick#6/lib/pkgconfig"
I followed all the instructions above
then I tried to install RMagick via gem install rmagick -v '4.1.2' --source 'https://rubygems.org/'
and got output:
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
current directory: /home/ketch/.asdf/installs/ruby/2.7.1/lib/ruby/gems/2.7.0/gems/rmagick-4.1.2/ext/RMagick
/home/ketch/.asdf/installs/ruby/2.7.1/bin/ruby -I /home/ketch/.asdf/installs/ruby/2.7.1/lib/ruby/2.7.0 -r ./siteconf20211106-21975-1odkmjc.rb extconf.rb
checking for brew... yes
checking for Ruby version >= 2.3.0... yes
checking for pkg-config... yes
ERROR: Can't install RMagick 4.1.2. Can't find ImageMagick with pkg-config
*** 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/ketch/.asdf/installs/ruby/2.7.1/bin/$(RUBY_BASE_NAME)
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/ketch/.asdf/installs/ruby/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/rmagick-4.1.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/ketch/.asdf/installs/ruby/2.7.1/lib/ruby/gems/2.7.0/gems/rmagick-4.1.2 for inspection.
Results logged to /home/ketch/.asdf/installs/ruby/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/rmagick-4.1.2/gem_make.out
I tried to install rmagick on my WSL debian, WSL ubuntu, and on Manjaro through virtual machine, everytime the same error

Cannot install uchardet gem on Mac OS catalina

Recently I got the following errors when I tried to install the uchardet GEM in MacOS catalina,Even I specific the ICU version and lib, it still doesn't work, anyone have ideas?
Installing uchardet 0.2.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/xxx/.rvm/gems/ruby-2.6.4/gems/uchardet-0.2.0/ext
/Users/xxx/.rvm/rubies/ruby-2.6.4/bin/ruby -I /Users/xxx/.rvm/rubies/ruby-2.6.4/lib/ruby/site_ruby/2.6.0 -r ./siteconf20200420-38494-q9y0cf.rb extconf.rb
Could not find ICU libraries and/or development tools. Try installing "icu-devtools" or "icu" package.
*** 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
--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/xxx/.rvm/rubies/ruby-2.6.4/bin/$(RUBY_BASE_NAME)
extconf failed, exit code 1
Gem files will remain installed in /Users/xxx/.rvm/gems/ruby-2.6.4/gems/uchardet-0.2.0 for inspection.
Results logged to /Users/xxx/.rvm/gems/ruby-2.6.4/extensions/x86_64-darwin-19/2.6.0/uchardet-0.2.0/gem_make.out
I was able to reproduce this on my mac:
I fixed this error by re-installing and re-linking icu4c
brew install icu4c
brew link icu4c --force # if it shows you an error and tells you to add the path manually add them
restarted my terminal then re-installed the gem (i also tried this)
you will know it's working when you have which icu-config working https://github.com/dmgk/uchardet/blob/506105c5322fe3cde7ce3e2b2868f875b9b57230/ext/extconf.rb#L3-L6
however now i have another error uchardet.c:2:10: fatal error: 'unicode/ucsdet.h' file not found i do think the gems needs better configuration around this

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

Error installing geoip_city gem

I keep getting an error when trying to install the geoip_city gem. I've already installed the GeoIP C library to /opt/GeoIP, but the gem doesn't seem to pick it up. I've tried:
sudo gem install geoip_city -- --with-geoip-dir=/opt/GeoIP
sudo gem install geoip_city -- --with-geoip-lib=/opt/GeoIP/lib
sudo gem install geoip_city -- --with-geoip-dir=/opt/GeoIP --with-geoip-lib=/opt/GeoIP/lib
all of which output this error:
Building native extensions. This could take a while...
ERROR: Error installing geoip_city:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb --with-geoip-lib=/opt/GeoIP/lib
checking for GeoIP_record_by_ipnum() in -lGeoIP... no
you must have geoip c library installed!
*** 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/1.8/usr/bin/ruby
--with-geoip-dir
--without-geoip-dir
--with-geoip-include
--without-geoip-include=${geoip-dir}/include
--with-geoip-lib=${geoip-dir}/lib
--with-GeoIPlib
--without-GeoIPlib
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/geoip_city-0.2.0 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/geoip_city-0.2.0/gem_make.out
cantorrodista was on the right track, though. I had to run the command like this:
sudo env ARCHFLAGS="-arch i386" gem install geoip_city -- --with-geoip-dir=/opt/GeoIP
I think you have to pass the ARCHFLAGS parameter to indicate that is going to be built for a 64 bit arquitecture:
sudo env ARCHFLAGS="-arch x86_64" gem install geoip_city -- --with-geoip-dir=/opt/GeoIP

How to install mysql gem on Mac os 10.6?

i just installed MAMP on this iMac and the rubygems but when i run:
sudo gem install mysql — –with-mysql-config=/usr/local/mysql/bin/mysql_config
gives me
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
ERROR: could not find gem — locally or in a repository
ERROR: could not find gem –with-mysql-config=/usr/local/mysql/bin/mysql_config locally or in a repository
how can i install this gem ?
I found this and worked out perfectly:
you can go to http://www.tmtm.org/en/ruby/mysql/ to download the tar
file, and run the command below
# ruby ./install.rb
to install the mysql.rb
Use the following it worked with me
brew install mysql
Do you have the Xcode developer tools installed on Mac OS X? If not, I'd start there.
You can download them here: http://developer.apple.com/technologies/xcode.html
Once you've installed that, try again.
i'm still getting this
$ sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... no
checking for rb_thread_start_timer()... no
checking for mysql.h... no
checking for mysql/mysql.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/1.8/usr/bin/ruby
--with-mysql-config
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
You need the mysql development libs to compile it. If you were on linux you could use "yum install mysql-devel". Not sure about how to get them installed on a mac, but try downloading the connector libraries from here:
MySql Connector Downloads
You may have to pass in a --with-mysql-libs option to point to the directory when the C libraries are unpacked to. Hope this points you in the right direction.
Or you can just put the libraries in the default directory:
/usr/lib64/mysql
Download mysql-dev from mysql.com

Resources