While doing bundle install
collect2.exe: error: ld returned 1 exit status
make: *** [RMagick2.so] Error 1
make failed, exit code 2
Gem files will remain installed in
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rmagick-2.16.0 for
inspection.
Results logged to
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/rmagick-2.16.0/gem_make.out
An error occurred while installing rmagick (2.16.0), and Bundler cannot
continue.
Make sure that `gem install rmagick -v '2.16.0'` succeeds before bundling.
In Gemfile:
rmagick
Then I tried gem install rmagick -v '2.16.0' which in turn throwed this error
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
collect2.exe: error: ld returned 1 exit status
make: *** [RMagick2.so] Error 1
make failed, exit code 2
Gem files will remain installed in C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rmagick-2.16.0 for inspection.
Results logged to C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/rmagick-2.16.0/gem_make.out
After that i tried gem install rmagick --platform=ruby -- --with-opt-lib="C:/Program Files/ImageMagick-6.9.6-Q16-HDRI/lib" --with-opt-include="C:/Program Files/ImageMagick-6.9.6-Q16-HDRI/include" which throwed the same error as mentioned above in gem install rmagick -v '2.16.0'
Please help me out with this..
Install ImageMagick on Windows 10
Important: DON'T download the latest version of ImageMagick. It won't work with RMagick on a Windows development environment. You have to take Version: 6.7.9-9-Q16 and they have to be the 32-bit versions (even if you are on a 64-bit system). I found those versions of ImageMagick here.
STEP 1: Download and Install STATIC: ImageMagick-6.7.9-9-Q16-windows-static.exe
Set the installation path to 'C:\ImageMagick' - this is important, to avoid the common windows whitespace path bug, then just click through the rest of the installation
STEP 2: Download and Install DLL: ImageMagick-6.7.9-9-Q16-windows-dll.exe
During installation, check the checkbox to install the source headers.
Install RMagick Gem in Rails
Now go to your Rails Console (Git bash), cd to the root path of your Rails Application and enter the following command:
gem install rmagick --platform=ruby -- --with-opt-dir=C:/ImageMagick
The installation takes a while, when everything was successfull you should see:
Thats it. Don't forget to add gem 'RMagick' to your Gemfile.
If you still don't succeed, try to install:
MinGW Min GNU Windows Environment
http://www.mingw.org/
http://sourceforge.net/projects/mingw...
(make sure to install the development tools)
Related
I am working on multiple Ruby on Rails applications and running...
MacOS 10.15.7,
Ruby 2.6.5,
Rails 5.2.3,
In a project app directory I am trying to run a bundle install and get the following error:
An error occurred while installing jaro_winkler (1.5.3), and Bundler cannot continue.
Make sure that `gem install jaro_winkler -v '1.5.3' --source
'https://.../api/gems/rubygems/'` succeeds before bundling.
I proceed to install the gem from the specified source and get confirmation of install
Building native extensions. This could take a while...
Successfully installed jaro_winkler-1.5.3
Parsing documentation for jaro_winkler-1.5.3
Done installing documentation for jaro_winkler after 0 seconds
1 gem installed
after running bundle install again, I will get the original error
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/private/var/folders/yr/dw4ljvv14cl9vp76jt_6zqrsv1qhkf/T/bundler20210406-62421-1bm7o1ijaro_winkler-1.5.3/gems/jaro_winkler-1.5.3/ext/jaro_winkler
/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
./siteconf20210406-62421-10txxc5.rb extconf.rb
creating Makefile
current directory:
/private/var/folders/yr/dw4ljvv14cl9vp76jt_6zqrsv1qhkf/T/bundler20210406-62421-1bm7o1ijaro_winkler-1.5.3/gems/jaro_winkler-1.5.3/ext/jaro_winkler
make "DESTDIR=" clean
current directory:
/private/var/folders/yr/dw4ljvv14cl9vp76jt_6zqrsv1qhkf/T/bundler20210406-62421-1bm7o1ijaro_winkler-1.5.3/gems/jaro_winkler-1.5.3/ext/jaro_winkler
make "DESTDIR="
make: *** No rule to make target
`/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin19/ruby/config.h',
needed by `adj_matrix.o'. Stop.
make failed, exit code 2
Gem files will remain installed in
/var/folders/yr/dw4ljvv14cl9vp76jt_6zqrsv1qhkf/T/bundler20210406-62421-1bm7o1ijaro_winkler-1.5.3/gems/jaro_winkler-1.5.3
for inspection.
Results logged to
/var/folders/yr/dw4ljvv14cl9vp76jt_6zqrsv1qhkf/T/bundler20210406-62421-1bm7o1ijaro_winkler-1.5.3/extensions/universal-darwin-19/2.6.0/jaro_winkler-1.5.3/gem_make.out
An error occurred while installing jaro_winkler (1.5.3), and Bundler cannot continue.
Make sure that `gem install jaro_winkler -v '1.5.3' --source
'https://.../api/gems/rubygems/'` succeeds before bundling.
The error message above doesn't give me any clear indication of what is happening. Additionally there is no such directory in the location where the message says "results logged to."
This seems to be happening in multiple application directories - but with different affected gems in each directory. They are all similar in that the error reads "make sure gem succeeds before bundling", then the gem install will succeed, and then the following bundle install will fail with the same original message.
Earlier today I did a clean Ruby 2.6.5 install and updated the Xcode CLI via xcode-select --install
If I run gem which jaro_winkler I get
/Users/{username}/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/jaro_winkler-1.5.3/lib/jaro_winkler.rb
Does anyone have any information on what could be causing this? I cannot do any bundle install without this happening. Please let me know if any more information is desired.
Thank you!
You mentioned that you are using ruby 2.6.5, but the gem is attempting to be installed in 2.6.0. Check that your Gemfile has the correct Ruby version in it.
When you ran gem which, it looks you are using rbenv. Make sure that you are using the correct Ruby version in there, too. Those rubies get installed in a different directory than xcode's. Sometimes there's a .rbenv file in the dir that will set the version as well.
Just some ideas. Hopefully something sticks.
Ended up being an issue with gem install location - export PATH="/usr/local/bin:$PATH" was previously added to my .bash_profile and this was effecting where gems were installed.
Somewhere in the error message /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby is mentioned - this is the "system default" Mac version of Ruby and is not the Ruby version I was intending to use with .rbenv ( 2.6.5 ) and gem installs.
Removing the export mentioned above help resolve the issue.
edit- wording
I have created new rails app and try to run bundle install it shows this error,
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/json-1.8.6/ext/json/ext/generator/usr/bin/ruby2.3 -r ./siteconf20170704-11395-12tpg5u.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.3.0/gems/json-1.8.6 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/json-1.8.6/gem_make.out
An error occurred while installing json (1.8.6), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.6'` succeeds before bundling
Kindly send me some suggestions,Thanks in Advance.
If you have a Mac or Linux machine try the following command:
sudo apt-get install ruby-dev
If that fails, what is your output for:
gem install json -v '1.8.6'
(please copy and paste all the output).
Similar issue
I'm not sure what will fix it for Mac, but people had positive experiences with brew install ruby.
If anyone facing this error with Mac OS Big Sur, please update the ruby version to atleast 2.7. I am using rvm to resolve this issue.
First checked the ruby version and rvm list
if rvm not install then install rvm
I've been trying to gem install pg on many different ways I've found on the internet and none work. They all give the same error.
What I've tried :
gem install pg -- --with-pg-dir=C:\Program Files (x86)\PostgreSQL\9.3:
gem install pg -- --with-pg-dir=C:\Program Files\PostgreSQL\9.5:
gem install pg
Using bundle install after editing the Gemfile.
Every single time I get this error:
C:\laragon\www\ruby\Car-X>gem install pg Building native extensions. This could take a while... C:/jruby-9.1.2.0/lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb:56: warning: Tempfile#unlink or delete called on open file; ignoring ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
current directory: C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/pg-0.18.4/ext C:/jruby-9.1.2.0/bin/jruby.exe -r ./siteconf20160629-8568-1ou7emz.rb extconf.rb NotImplementedError: C extensions are not supported
<top> at C:/jruby-9.1.2.0/lib/ruby/stdlib/mkmf.rb:1 require at org/jruby/RubyKernel.java:944 (root) at C:/jruby-9.1.2.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1
<top> at extconf.rb:2
extconf failed, exit code 1
Gem files will remain installed in C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/pg-0.18.4 for inspection. Results logged to C:/jruby-9.1.2.0/lib/ruby/gems/shared/extensions/universal-java-1.8/2.3.0/pg-0.18.4/gem_make.out
Any help would be apreciated.
You need to install the ruby devkit so that your ruby compiler can deal with native C code.
Check out the instructions on how to do so here:
https://github.com/oneclick/rubyinstaller/wiki/Development-Kit
Once you've installed it, make sure that your windows PATH environmental variable includes a link to the bin folder in your newly created devkit directory. (P.S. Make sure there are no spaces in the path to the directory).
This error occurs when I try to install http_parser using gem:
dongl_000#LENNY ~/ava-home (master)
$ gem install http_parser.rb -v '0.6.0'
Building native extensions. This could take a while...
ERROR: Error installing http_parser.rb:
ERROR: Failed to build gem native extension.
c:/Ruby22-x64/bin/ruby.exe -r ./siteconf20160217-15056-1hoiyfc.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
generating ruby_http_parser-x64-mingw32.def
make: *** No rule to make target '/c/Ruby22-x64/include/ruby-2.2.0/ruby.h', need
ed by 'ruby_http_parser.o'. Stop.
make failed, exit code 2
Gem files will remain installed in c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/http_p
arser.rb-0.6.0 for inspection.
Results logged to c:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0
/http_parser.rb-0.6.0/gem_make.out
How can I resolve this issue?
Versions
ruby : 2.2.1
rubyGem : 2.4.5
I was going through this very same issue.
Looked up the Git Repository for the Gem (HTTP_Parser) and found out the reason for my problem:
HTTP_Parser currently doesn't not support a Path with spaces
So I renamed my path and solved it.
To resolve attempt to add the devkit to Ruby like this:
Install Ruby+DevKit from RubyInstaller: Ruby Window Installers
Downloads
Check the "ridk install" checkbox at the end of the installer.
When RIDK runs, pick option 3 to install both MSYS and MINGW dev tools (make is provided with the MINGW stuff).
Open a fresh console (to get fresh environment variables), and rerun your gem or bundle command...and hope for the best.
What do these errors mean?
[root#localhost config]# gem install bluecloth
Building native extensions. This could take a while...
ERROR: Error installing bluecloth:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
can't find header files for ruby.
Gem files will remain installed in /usr/lib64/ruby/gems/1.8/gems/bluecloth-2.0.7 for
inspection.
Results logged to /usr/lib64/ruby/gems/1.8/gems/bluecloth-2.0.7/ext/gem_make.out
[root#localhost config]#
And this
[root#localhost config]# gem install chronic
Successfully installed json_pure-1.4.3
Successfully installed rubyforge-2.0.4
Successfully installed hoe-2.6.0
Successfully installed chronic-0.2.3
4 gems installed
/usr/lib64/ruby/gems/1.8/gems/rdoc-2.5.8/lib/rdoc/ruby_lex.rb:67: warning:
parenthesize argument(s) for future version
ERROR: While executing gem ... (Gem::DocumentError)
ERROR: RDoc documentation generator not installed: no such file to load -- irb/slex
[root#localhost config]#
I have installed rdocs using "yum install ruby-rdocs". But I don't understand what this error means
yum install ruby-devel ruby-irb ruby-rdoc ruby-ri
Although the former command fixes both issues, take in mind that in the case of the second error message, you can had also skip the documentation by adding --no-rdoc.
April 2017:
--[no-]rdoc argument has been deprecated as explained in gem install --help. You now have to use --no-document at each gem installation or store this in your ~/.gemrc as explained in this answer.