Gem::Ext::BuildError: ERROR: Failed to build gem native extension. - tharindu - ruby-on-rails

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
C:/RailsInstaller/Ruby2.1.0/bin/ruby.exe extconf.rb
Invalid drive specification.
Unable to get ImageMagick version
* 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=C:/RailsInstaller/Ruby2.1.0/bin/ruby
extconf failed, exit code 1
Gem files will remain installed in C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1
.0/gems/rmagick-2.15.2 for inspection.
Results logged to C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/extensions/x86
-mingw32/2.1.0/rmagick-2.15.2/gem_make.out
An error occurred while installing rmagick (2.15.2), and Bundler cannot
continue.
Make sure that gem install rmagick -v '2.15.2' succeeds before bundling.
E:\redmine-master\bin>gem install rmagick -v '2.15.2'
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
C:/RailsInstaller/Ruby2.1.0/bin/ruby.exe extconf.rb
Invalid drive specification.
Unable to get ImageMagick version
* 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=C:/RailsInstaller/Ruby2.1.0/bin/ruby
extconf failed, exit code 1
Gem files will remain installed in C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1
.0/gems/rmagick-2.15.2 for inspection.
Results logged to C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/extensions/x86
-mingw32/2.1.0/rmagick-2.15.2/gem_make.out

This worked for me:
brew install ImageMagick
gem install rmagick

Related

Cannot Install gem stackprof on ruby 2.4.10 on Macbook M1

I am trying to bundle install my application. I have the gem stackprof and i keep getting this error whenever i try to install this gem.
I am using M1 with Ruby 2.4.10 and cant find any way around this. Has anyone had this issue and how did you solve it?
Building native extensions with: '--with-cflags=-Wno-error=implicit-function-declaration'
This could take a while...
ERROR: Error installing stackprof:
ERROR: Failed to build gem native extension.
current directory: /Users/tech/.rbenv/versions/2.4.10/lib/ruby/gems/2.4.0/gems/stackprof-0.2.16/ext/stackprof
/Users/tech/.rbenv/versions/2.4.10/bin/ruby -r ./siteconf20220514-21699-1433so.rb extconf.rb --with-cflags=-Wno-error=implicit-function-declaration
checking for rb_postponed_job_register_one()... 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/tech/.rbenv/versions/2.4.10/bin/$(RUBY_BASE_NAME)
extconf.rb:8:in `<main>': missing API: are you using ruby 2.1+? (RuntimeError)
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/tech/.rbenv/versions/2.4.10/lib/ruby/gems/2.4.0/extensions/-darwin-21/2.4.0/stackprof-0.2.16/mkmf.log
extconf failed, exit code 1

Installing ruby gem clamav

I was trying to install clamav gem for a project on windows using ruby on rails.
I used gem install clamav -v '0.4.1'
I keep getting this error:
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing clamav:
ERROR: Failed to build gem native extension.
c:/RailsInstaller/Ruby2.0.0/bin/ruby.exe extconf.rb
checking for clamav.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=c:/RailsInstaller/Ruby2.0.0/bin/ruby
--with-clamav-dir
--without-clamav-dir
--with-clamav-include
--without-clamav-include=${clamav-dir}/include
--with-clamav-lib
--without-clamav-lib=${clamav-dir}/
Gem files will remain installed in c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/clamav-0.4.1 for inspection.
Results logged to c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/clamav-0.4.1/ext/clamav/gem_make.out
I know that there isnt a clamav.h file in the folder for gems in RailsInstaller but it updates from rubygems.org so I cannot change it.
On ubuntu you can install libclamav-dev with following command:
sudo apt-get install libclamav-dev

How to install ruby gem puma on windows

Welcome, gather around.
My first step when trying to install the gem puma is to enter gem install puma --version 2.12.3 into my command prompt. Then this error appears. I don't know what to make of it.
C:\Users>gem install puma --version 2.12.3
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing puma:
ERROR: Failed to build gem native extension.
C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20150809-8352-14jkju1.rb extconf.rb
checking for BIO_read() in -lcrypto... no
checking for BIO_read() in -llibeay32... 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=C:/Ruby22-x64/bin/$(RUBY_BASE_NAME)
--with-puma_http11-dir
--without-puma_http11-dir
--with-puma_http11-include
--without-puma_http11-include=${puma_http11-dir}/include
--with-puma_http11-lib
--without-puma_http11-lib=${puma_http11-dir}/lib
--with-cryptolib
--without-cryptolib
--with-libeay32lib
--without-libeay32lib
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/puma-2
.12.3 for inspection.
Results logged to C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0
/puma-2.12.3/gem_make.out
Please help, thank you!
You probably just need OpenSSL, but be warned that some gems just fail to work on Windows.
https://github.com/hicknhack-software/rails-disco/wiki/Installing-puma-on-windows

Ruby Gem Curb version 0.8.5 - Wont install - Windows 7 Setup with RubeMine 6.0.1

I get the following errors, basically trying to get curb to go but it wont. Here is a snapshot of my terminal:
gem install curb -- -with-curl-lib=c:/curl-7.33.0/lib
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing curb:
ERROR: Failed to build gem native extension.
C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb -with-curl-lib=c:/curl-7.33.0/lib
checking for curl-config... no
checking for main() in -lcurl... 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=C:/RailsInstaller/Ruby1.9.3/bin/ruby
--with-curl-dir
--without-curl-dir
--with-curl-include
--without-curl-include=${curl-dir}/include
--with-curl-lib
--without-curl-lib=${curl-dir}/lib
--with-curllib
--without-curllib
extconf.rb:23:in `<main>': Can't find libcurl or curl/curl.h (RuntimeError)
Try passing --with-curl-dir or --with-curl-lib and --with-curl-include
options to extconf.
Gem files will remain installed in C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/curb-0.8.5 for inspection.
Results logged to C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/curb-0.8.5/ext/gem_make.out
C:\work\gundable>gem install curb -- --with-curl-lib=c:/curl-7.33.0/lib --with-curl-include-c:/curl-7.33.0/include
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing curb:
ERROR: Failed to build gem native extension.
C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb --with-curl-lib=c:/curl-7.33.0/lib --with-curl-include-c:/curl-7.33.0/
include
checking for curl-config... no
checking for main() in -lcurl... 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=C:/RailsInstaller/Ruby1.9.3/bin/ruby
--with-curl-dir
--without-curl-dir
--with-curl-include
--without-curl-include=${curl-dir}/include
--with-curl-lib=${curl-dir}/lib
--with-curllib
--without-curllib
extconf.rb:23:in `<main>': Can't find libcurl or curl/curl.h (RuntimeError)
Try passing --with-curl-dir or --with-curl-lib and --with-curl-include
options to extconf.
Gem files will remain installed in C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/curb-0.8.5 for inspection.
Results logged to C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/curb-0.8.5/ext/gem_make.out
As answered in https://stackoverflow.com/a/20374291 you need to install libcurl3-dev
sudo apt-get install libcurl3-dev

Failed to install ruby-ldap on Snow Leo

I tried to install ruby-ldap on Snow Leo, but it failed:
~/WorkingFolder/temp/test$ sudo gem install ruby-ldap
Password:
Building native extensions. This could take a while...
ERROR: Error installing ruby-ldap:
ERROR: Failed to build gem native extension.
/opt/local/bin/ruby extconf.rb
--with-openldap2
checking for ldap.h... no
checking for lber.h... no
checking for ldap_ssl.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=/opt/local/bin/ruby
--with-netscape
--without-netscape
--without-netscape
--with-openldap1
--without-openldap1
--without-openldap1
--with-openldap2
--without-openldap2
--without-openldap2
--with-wldap32
--without-wldap32
--without-wldap32
--with-ldap-dir
--without-ldap-dir
--with-ldap-include
--without-ldap-include=${ldap-dir}/include
--with-ldap-lib
--without-ldap-lib=${ldap-dir}/lib
--with-ldap-dir
--without-ldap-dir
--without-ldap-dir
--with-ldap
--without-ldap
--without-ldap
--with-libresolv
--without-libresolv
--without-libresolv
--with-libcrypto
--without-libcrypto
--without-libcrypto
--with-libssl
--without-libssl
--without-libssl
--with-libpthread
--without-libpthread
--without-libpthread
--with-libnsl
--without-libnsl
--without-libnsl
--with-liblber
--without-liblber
--without-liblber
--with-libldap_r
--without-libldap_r
--without-libldap_r
--with-libldap
--without-libldap
--without-libldap
can't find ldap.h and lber.h
use the option '--with-ldap-dir'!
Gem files will remain installed in /opt/local/lib/ruby/gems/1.8/gems/ruby-ldap-0.9.11 for inspection.
Results logged to /opt/local/lib/ruby/gems/1.8/gems/ruby-ldap-0.9.11/gem_make.out
Anyone know how to fix this, please help!!
Thanks
The LDAP development headers are unavailable on your system and ruby-ldap requires those headers. Installing Apple's Development Tools (XCode) should install those development headers also. Could you install the Developer Tools and retry installing ruby-ldap?

Resources