Error installing geoip_city gem - ruby-on-rails

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

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

Error when trying to install therubyracer

When I try to install the gem therubyracer i get this error:
gem install therubyracer
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
/opt/ruby-enterprise-1.8.7-2012.02/bin/ruby extconf.rb
checking for main() in -lpthread... yes
Warning! Unable to load libv8 ~> 3.16.14.
*** 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=/opt/ruby-enterprise-1.8.7-2012.02/bin/ruby
--with-pthreadlib
--without-pthreadlib
--enable-debug
--disable-debug
/opt/ruby-enterprise-1.8.7-2012.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': no such file to load -- libv8 (LoadError)
from /opt/ruby-enterprise-1.8.7-2012.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from extconf.rb:29
Gem files will remain installed in /home/speedup18meses/.gems/gems/therubyracer-0.12.1 for inspection.
Results logged to /home/speedup18meses/.gems/gems/therubyracer-0.12.1/ext/v8/gem_make.out
I use a shared server, so, i dont have sudo access to my user.
I am using this at a Rails app.
I tried this:
gem install libv8 -v '3.16.14.3' -- --with-system-v8
gem install therubyracer
.
gem install libv8
gem install therubyracer
I tried to install an especific version, and edit the Gemfile, but neither works.
I am using this at a Rails app
Then in your Gemfile add the line:
gem 'therubyracer'
Then do:
$ bundle install
Then Bundler will handle installing the dependencies.
When I try to install the gem therubyracer i get this error:
I don't get that error. Throw your computer away and get my computer along with the software I have installed.

Unable to install therubyracer gem

I installed libv8 gem seperately without a hitch, but when I try to install therubyracer gem I get the following error:
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
checking for main() in -lpthread... yes
Warning! Unable to load libv8 ~> 3.16.14.
*** 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}/
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby
--with-pthreadlib
--without-pthreadlib
--enable-debug
--disable-debug
extconf.rb:32:in `<main>': undefined method `configure_makefile' for Libv8:Module (NoMethodError)
Gem files will remain installed in /home/thecodehitman/ruby/gems/gems/therubyracer-0.12.1 for inspection.
Results logged to /home/thecodehitman/ruby/gems/gems/therubyracer-0.12.1/ext/v8/gem_make.out
Not sure what to do.
Try this:
$ sudo gem install therubyracer --platform ruby
Try with or without sudo.
If it is a Ruby on Rails app, include the line:
gem 'therubyracer', :platform=>:ruby
inside Gemfile.

debugger-linecache install error

i try to install the debugger-linecache gem , but i got the following error,
Building native extensions. This could take a while...
....
ERROR: Error installing debugger-linecache:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
*** 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/bin/ruby
extconf.rb:2:in `require': no such file to load -- debugger/ruby_core_source (LoadError)
from extconf.rb:2
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/debugger-linecache-1.1.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/debugger-linecache-1.1.1/ext/trace_nums/gem_make.out
i have already done:
sudo gem install debugger-ruby_core_source
i found the problem to be that since i am on fedora , i am using ruby 1.8.3 and that seems to be problem. now upgraded to ruby 1.9.3, problem solved.
I installed the dependency first:
gem install debugger-linecache --version 1.1.2
After that, I ran the bundle install command and it worked fine.
What dannynjust said, and:
git clone git://github.com/cldwalker/debugger-ruby_core_source.git &&
sudo rm -rf /var/lib/gems/1.8/gems/debugger-ruby_core_source-1.1.7 &&
sudo mv debugger-ruby_core_source /var/lib/gems/1.8/gems/debugger-ruby_core_source-1.1.7

Setting up Ruby on Rails App. Problems installing mysql gem

I'm trying to set up rails for the first time. I've got the app made, I've been following lots of guides.
When I try to install the mysql gem gem install mysql
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
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=/usr/bin/ruby
--with-mysql-config
--without-mysql-config
Looking around on SO and Google, people say to do:
gem install mysql --with-mysql-config=/usr/bin/mysql_config
but I get:
ERROR: While executing gem ... (OptionParser::InvalidOption)
invalid option: --with-mysql-config=/usr/bin/mysql_config
Any ideas on how I can get this to work?
If you haven't already you'll need to install the MySQL development library as root:
yum install mysql-devel
Then in the gem install command you need to have another -- in the command line before the --with-mysql-config option:
gem install mysql -- --with-mysql-config=/usr/bin/mysql_config

Resources