I am using Rails 4. Bundle was working up until yesterday, when I had to reinstall Bundler because of a different error. Now, when I run "bundle install", a few gems are successfully installed and then I receive this error message:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby -r ./siteconf20150509-3462-k6ug3q.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling generator.c
make: gcc-4.2: No such file or directory
make: *** [generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in /usr/local/lib/ruby/gems/2.0.0/gems/json- 1.8.2 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.0.0/extensions/x86_64-darwin- 10/2.0.0-static/json-1.8.2/gem_make.out
An error occurred while installing json (1.8.2), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.2'` succeeds before bundling.
I then try to 'gem install json -v '1.8.2' and get this error message:
Building native extensions. This could take a while...
/usr/local/lib/ruby/site_ruby/2.0.0/rubygems/ext/builder.rb:73: warning:
Insecure world writable dir /usr/local/lib/ruby/gems/2.0.0 in PATH, mode 040777
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby -r ./siteconf20150509-3898-12pmbxe.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling generator.c
make: gcc-4.2: No such file or directory
make: *** [generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in /usr/local/lib/ruby/gems/2.0.0/gems/json-1.8.2 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.0.0/extensions/x86_64-darwin- 10/2.0.0-static/json-1.8.2/gem_make.out
I have no idea how to fix this. I have tried several solutions including:
-"rvm implode"
-"sudo gem update --system"
-"sudo gem update --system --no-user-install"
-"sudo chmod 755 /usr/local/lib/ruby/gems/2.0.0/gems"
-"xcode-select --install"
-running Disk Repair
I read a few things about making changes to the path and bash profile, but I am unclear on how to do that.
Thank you in advance! Already spent 2 hours trying to solve this.
Answered in this stack question : Insecure world writable dir /Users/username in PATH, mode 040777 when running Ruby commands
Your home folder should only be writable by you, not by anyone else. The reason gem is complaining about this is that you have folders in your PATH that are inside your (insecure) home folder, and that means that anyone who wants to could hack you by renaming/moving your .rvm folder and replacing it with an impostor.
To fix your home folder, run chmod go-w /Users/kristoffer. If there are any other insecure folders on the way to anything in your PATH, you should fix them similarly.
BTW, the reason that Disk Utility didn't repair this is that it only repairs files installed as part of the OS (see Apple's KB article on the subject). There is an option to repair home folder permissions if you boot from the install DVD and run Password Reset from the Utilities menu, but I'm not sure if it resets the permissions themselves or just ownership.
Update
Installing a new version of Ruby seemed to work. Previously I was using 2.0.0, and now I upgraded to 2.2.2. This seems to have made the issue go away.
Related
gem install rails
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/websocket-driver-0.7.5/ext/websocket-driver
C:/Ruby31-x64/bin/ruby.exe -I C:/Ruby31-x64/lib/ruby/site_ruby/3.1.0 -r ./siteconf20220326-12676-skaw7l.rb extconf.rb
creating Makefile
current directory: C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/websocket-driver-0.7.5/ext/websocket-driver
make DESTDIR= clean
current directory: C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/websocket-driver-0.7.5/ext/websocket-driver
make DESTDIR=
generating websocket_mask-x64-mingw-ucrt.def
compiling websocket_mask.c
make: gcc: No such file or directory
make: *** [Makefile:246: websocket_mask.o] Error 127
make failed, exit code 2
Gem files will remain installed in C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/websocket-driver-0.7.5 for inspection.
Results logged to C:/Ruby31-x64/lib/ruby/gems/3.1.0/extensions/x64-mingw-ucrt/3.1.0/websocket-driver-0.7.5/gem_make.out
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
Please help me to get rid of this error.
have you followed any Youtube tutorials if yes, then yeah you are not alone I have also screwed up and don't have any solutions yet but I think reinstalling from the beginning from your own not from the tutorials, you may succeed.
If I succeed then I would tell ya!
I have recently tried to install rails via gem by running gem install rails. However, it always fails with the following error message.
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: D:/Program Files/Ruby30-x64/lib/ruby/gems/3.0.0/gems/websocket-driver-0.7.3/ext/websocket-driver
D:/Program\ Files/Ruby30-x64/bin/ruby.exe -I D:/Program\ Files/Ruby30-x64/lib/ruby/3.0.0 -r ./siteconf20210303-3696-skc9xl.rb extconf.rb
creating Makefile
current directory: D:/Program Files/Ruby30-x64/lib/ruby/gems/3.0.0/gems/websocket-driver-0.7.3/ext/websocket-driver
make "DESTDIR=" clean
Makefile:269: *** multiple target patterns. Stop.
current directory: D:/Program Files/Ruby30-x64/lib/ruby/gems/3.0.0/gems/websocket-driver-0.7.3/ext/websocket-driver
make "DESTDIR="
Makefile:269: *** multiple target patterns. Stop.
make failed, exit code 2
Gem files will remain installed in D:/Program Files/Ruby30-x64/lib/ruby/gems/3.0.0/gems/websocket-driver-0.7.3 for inspection.
Results logged to D:/Program Files/Ruby30-x64/lib/ruby/gems/3.0.0/extensions/x64-mingw32/3.0.0/websocket-driver-0.7.3/gem_make.out
Does anyone know what is actually happening here? I would appreciate any answer. Thanks
Usually, this "multiple target patterns" error when compile gem extensions is caused by spaces in directory names where you have installed your Ruby or your gems.
Especially on Windows, you should install your Ruby to a directory which contains no spaces, rather than your current location D:/Program Files/Ruby30-x64. To fix this, I recommend to uninstall Ruby and install it again to a more appropriate location.
i have problem with installing Rails on my server.
My server is not supporting GCC 4.7, i have only GCC 4.3.2.
I've read that unrecognized command line option "-flto" is a problem with GCC directly
When i install Rails, it shows me an error:
Installing sassc 2.2.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/users/rails/.gems/gems/sassc-2.2.1/ext
/opt/ruby-2.5.3/bin/ruby -r ./siteconf20191129-24208-1qqnsyr.rb extconf.rb
creating Makefile
current directory: /home/users/rails/.gems/gems/sassc-2.2.1/ext
make "DESTDIR=" clean
current directory: /home/users/rails/.gems/gems/sassc-2.2.1/ext
make "DESTDIR="
compiling ./libsass/src/cencode.c
cc1: error: unrecognized command line option "-flto"
make: *** [cencode.o] Error 1
make failed, exit code 2
Gem files will remain installed in /home/users/rails/.gems/gems/sassc-2.2.1 for inspection.
Results logged to /home/users/rails/.gems/extensions/x86_64-linux/2.5.0-static/sassc-2.2.1/gem_make.out
Support told me, they can install 4.7 because they would need to rebuild almost half of libraries.
Is there easy way to fix this error?
What if i will exclude sassc from my installation? If this is a good idea, how can i do it?
I dont have this library in my Gemfile, can i delete those gems from my .gems folder? (i'm not that experienced in Ruby yet).
Thank you for your help
The option -flto is a link-time optimization flag. You do not need it. This flag is set in the sassc extconf.rb file, and can be disabled by doing:
export CONFIGURE_ARGS=--disable-lto
And then you can proceed to install Rails as normal.
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.
I'm trying to upgrade my rails 3.2.3 app. I've updated the gemfile to gem 'rails', '3.2.11' and ran bundle update rails but got the following error:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/Arel/.rvm/rubies/ruby-1.9.3-head/bin/ruby extconf.rb
creating Makefile
make
compiling generator.c
make: /usr/bin/gcc-4.2: No such file or directory
make: *** [generator.o] Error 1
Gem files will remain installed in /Users/Arel/.rvm/gems/ruby-1.9.3-head/gems/json-1.7.6 for inspection.
Results logged to /Users/Arel/.rvm/gems/ruby-1.9.3-head/gems/json-1.7.6/ext/json/ext/generator/gem_make.out
An error occured while installing json (1.7.6), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.6'` succeeds before bundling.
So I tried the solution that I found everywhere, to create a symlink using the command:
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
but that just returns the error:
ln: /usr/bin/gcc-4.2: File exists
I don't know a lot about using the terminal to navigate around OSX, so I'm kind of struggling here. Any ideas?
/usr/bin/gcc-4.2 could already be a symlink, but a broken one that points to a nonexistent file.