install qrencoder gem on osx for ruby on rails project - ruby-on-rails

I am trying to install the qrencoder gem on my mac osx 10.7.4 to use in a ruby on rails project.
When I try gem install qrencoder here is what I get:
ERROR: Error installing qrencoder:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for qrencode.h... yes
checking for QRinput_new() in -lqrencode... 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.
The mkmf.log file does not say anything other than the above.
I have qrencode-3.3.0 installed ok with brew but the gem install fails: any idea ?
when I type qrencode, here is what I get:
"dyld: Library not loaded: /usr/local/lib/libqrencode.3.dylib
Referenced from: /usr/local/bin/qrencode
Reason: Incompatible library version: qrencode requires version 7.0.0 or later, but libqrencode.3.dylib provides version 5.0.0
Trace/BPT trap: 5"

First install libqrencode via homebrew:
brew install qrencode
Then try installing the gem again:
gem install qrencoder
There are more detailed instructions at https://github.com/harrisj/qrencoder if you don't have homebrew and/or would prefer to compile from source.

To install qrencode on ubuntu 12.04 run the command:--
sudo apt-get install qrencode libqrencode-dev

Related

gem install nokogiri -v '1.5.11' failed due to make: /usr/local/bin/gmkdir: No such file or directory

Ruby version: 2.2.5
Mac OSX: 10.11.5
Gem version: 2.4.8
Bundler version: 1.12.5
When I run gem install nokogiri -v '1.5.11', I got the following error:
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/hwpeng/.rvm/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20160707-31800-1ejznjc.rb extconf.rb
====ignored multiple lines====
make "DESTDIR=" install
make: /usr/local/bin/gmkdir: No such file or directory
make: *** [.RUBYARCHDIR.-.nokogiri.time] Error 1
make install failed, exit code 2
I noticed the error message said: make: /usr/local/bin/gmkdir: No such file or directory.
I searched this in google and found a similar post but for cocopods: https://coderwall.com/p/ehijxg/fixing-error-installing-cocoapods-on-macos
The following commands solved my problem. If you have a different error message, please refer to http://www.nokogiri.org/tutorials/installing_nokogiri.html
Homebrew
brew install coreutils
gem install nokogiri -v '1.5.11'
MacPorts
sudo port install coreutils
gem install nokogiri -v '1.5.11'
I had this problem last time and you can try this code:
gem install nokogiri -v 1.5.11 -- --use-system-libraries
I think it will work.
The issue is not directly linked with the nokogiri. It is more around the missing libraries in the system. I am using Mac M1 machine and moving data/libraries from Intel to M1 is a pain. So for me after spending hours I fixed the issue. Steps which I followed to fix library issues are:
Uninstall and install Homebrew
Update the proper PATH in .zshrc or .bachrc file
install the coreutils brew install coreutils
close the terminal and then run the bundle install
Credit for coreutils help: http://thoughtsthatleakedout.blogspot.com/2011/10/problem-with-gmkdir-when-updating-gems.html

Unable to install Rails due to libxml2 not detected properly

I'm trying to install Rails on my Mac (Yosemite). I've gone through several SO questions, reinstalling libxml2 with Homebrew, and with RVM, and updating Ruby, etc. and nothing has worked so far. My libxml2 version is 2.9.2.
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
Building nokogiri using system libraries.
libxml2 version 2.6.21 or later is required!
*** 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.
What should I try next?
You have issues with nokogiri building.
Try the following steps. This should work for Yosemite:
brew install libxml2
bundle config build.nokogiri "--use-system-libraries --with-xml2-include=/usr/local/opt/libxml2/include/libxml2"
bundle install

Broken Rails setup / pg gem

UGH... I broke my (formerly functioning) Rails setup - under OS X Yosemite. I did so using Homebrew to update my version of Git. After getting Git where I want it, running 'rails c' gives these errors:
/Users/grogers/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/pg-0.16.0/lib/pg.rb:4:in `require': dlopen(/Users/grogers/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/pg-0.16.0/lib/pg_ext.bundle, 9): Library not loaded: /usr/local/lib/libpq.5.6.dylib (LoadError)
Referenced from: /Users/grogers/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/pg-0.16.0/lib/pg_ext.bundle
Reason: image not found - /Users/grogers/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/pg-0.16.0/lib/pg_ext.bundle
Seeing the reference to pg_ext, I tried to verify pieces of my postgresql installation. If I try 'gem install pg' or try to update the gem with bundler, I get this:
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/Users/grogers/.rbenv/versions/2.0.0-p353/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/local/bin/pg_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.
I'm probably making my problem worse, but I went back and redid a 'brew install postgres' but still get the same error.
Any help appreciated. Thank you!
Did you also upgrade Postgresql via Homebrew? If not, what version of Postgres are you running, and how do you install it?
If you did upgrade your Postgres you'll need to rebuild the native bindings for the pg gem: gem uninstall pg && gem install pg.

Error in installation of rmagick [in rails 2.3.5]

I was trying to install rmagick gem in rails 2.3.5 . but I could not install as it shows error. Same error comes in both rvm and system.
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:153: undefined (?...) sequence: /^Version: ImageMagick\s+(?\d+.\d+.\d+-\d+)\s+(?\S+)\s+(?\S+)\s+(?\S+)/
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/rmagick-2.13.4 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/rmagick-2.13.4/ext/RMagick/gem_make.out
this was the error.
Already Installed imagemagick,libmagickwand-dev, libxml2-dev, libxslt-dev,libgraphics-magick-perl, libgraphicsmagick++1-dev, libgraphicsmagick++3, libgraphicsmagick1-dev, libgraphicsmagick3 (tried everything got from google)
Seems like v2.13.4 needs some extra stuff installed, simply not only install libs but also:
sudo apt-get install imagemagick
This fixed it for me.
FYI, I got the following error:
checking for ImageMagick version >= 6.4.9... *** 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.
If you don't need the very latest version, you could try:
gem install rmagick -v 2.13.3
And see if the previous one works for you.

Gem installation ruby-audio-1.6.1 error(using Mac OS 10.9 / homebrew)

I tried other tips but didn't work. (see link below please)
ex.
Gem installation ruby-audio failing
ruby-audio 1.6.1 install error (with installed Libsndfile 1.0.25)
I want some feedback on this.
$ gem install ruby-audio<br>
Building native extensions. This could take a while...<br>
ERROR: Error installing ruby-audio:<br>
ERROR: Failed to build gem native extension.<br>
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
<br>
**checking for sndfile.h in /opt/local/include,/usr/local/include,C:/Program Files (x86)/Mega-Nerd/libsndfile/include,C:/Program Files/Mega-Nerd/libsndfile/include... yes<br>
checking for sf_open() in -lsndfile-1... no<br>
checking for sf_open() in -lsndfile... no<br>**<br>
*** extconf.rb failed ***<br>
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.<br>
<br>
Provided configuration options:<br>
--with-opt-dir<br>
--without-opt-dir<br>
--with-opt-include<br>
--without-opt-include=${opt-dir}/include<br>
--with-opt-lib<br>
--without-opt-lib=${opt-dir}/lib<br>
--with-make-prog<br>
--without-make-prog<br>
--srcdir=.<br>
--curdir<br>
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby<br>
--with-sndfile-dir<br>
--without-sndfile-dir<br>
--with-sndfile-include<br>
--without-sndfile-include=${sndfile-dir}/include<br>
--with-sndfile-lib<br>
--without-sndfile-lib=${sndfile-dir}/<br>
--with-sndfile-1lib<br>
--without-sndfile-1lib<br>
--with-sndfilelib<br>
--without-sndfilelib<br><br>
**extconf.rb:21:in `<main>': Can't find libsndfile (http://www.mega-nerd.com/libsndfile/) (RuntimeError)**<br>
<br>
Try passing --with-sndfile-dir or --with-sndfile-lib and --with-sndfile-include<br>
options to extconf. If there are spaces in the path on windows, it may not work.<br>
<br>
<br>
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/ruby-audio-1.6.1 for inspection.<br>
Results logged to /Library/Ruby/Gems/2.0.0/gems/ruby-audio-1.6.1/ext/rubyaudio_ext/gem_make.out
You probably need to install libsndfile as a universal library - by default it doesn't compile a 32-bit slice, which is required for compatibility with the system ruby.
brew uninstall libsndfile
brew install libsndfile --universal
sudo gem install ruby-audio
For ubuntu (Ubuntu 18.04)
sudo apt-get update -y
sudo apt-get install -y libsndfile-dev

Resources