I was trying to fix a strange problem in Rails so I resorted to uninstalling all the gems (using a command found here: http://geekystuff.net/2009/01/14/remove-all-ruby-gems/) and then running bundle install.
The removal was successful, but when I ran bundle install, I got the following error:
Installing activeresource (3.2.13)
Using bundler (1.3.5) Installing
rack-ssl (1.3.3)
Installing json (1.8.0)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native
extension .
c:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb creating Makefile
make
generating generator-i386-mingw32.def
compiling generator.c
linking shared-object json/ext/generator.so
make install
/usr/bin/install -c -m 0755 generator.so
c:/RailsInstaller/Ruby1.9.3/lib/ruby/ge
ms/1.9.1/gems/json-1.8.0/lib/json/ext /usr/bin/install: cannot remove
`c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1
/gems/json-1.8.0/lib/json/ext/generator.so': Permission denied make:
*** [c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/json-1.8.0/lib/j
son/ext/generator.so] Error 1
Gem files will remain installed in
c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9 .1/gems/json-1.8.0 for
inspection.
Results logged to
c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/json-1.8.
0/ext/json/ext/generator/gem_make.out An error occurred while
installing json (1.8.0), and Bundler cannot continue.
Make sure that
gem install json -v '1.8.0' succeeds before bundling.
I've spent a fair amount of time but still can't figure out what's wrong. Please advise.
I downloaded and ran Rails Installer. This time when I ran bundle install, the problem was gone.
It might be the white space in your Ruby path:
NOTE: The path to your must not contain any
whitespaces (like in “C:\Program Files\Ruby193”). This is very
important because whitespaces in the path to your ruby installation
will cause certain error messages as soon as you try to install gems
which require the DevKit.
https://github.com/oneclick/rubyinstaller/wiki/Development-Kit
hth
Frank
Related
I have updated my mac to use Catalina and now I am having all sorts of issues when I try and install Jekyll.
This is what I get when I run my usual grunt setup:
Running "jekyll:dist" (jekyll) task
>> Error: Command failed: bundle exec jekyll -v
>> bundler: command not found: jekyll
>> Install missing gem executables with `bundle install`
Warning: Please install Jekyll before running this task. Use --force to continue.
I then run sudo bundle install
I then get this:
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this
application for all non-root users on this machine.
Fetching gem metadata from https://rubygems.org/.........
Using public_suffix 3.0.1
Using addressable 2.5.2
Using bundler 2.1.4
Using colorator 1.1.0
Fetching ffi 1.9.18
Installing ffi 1.9.18 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Applications/MAMP/htdocs/hangr/vendor/bundle/ruby/2.6.0/gems/ffi-1.9.18/ext/ffi_c
/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 ./siteconf20201016-30905-1yh2cx1.rb extconf.rb
checking for ffi_call() in -lffi... yes
checking for ffi_prep_closure()... yes
checking for ffi_raw_call()... yes
checking for ffi_prep_raw_closure()... yes
checking for shlwapi.h... no
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
checking for ffi_prep_cif_var()... yes
creating extconf.h
creating Makefile
current directory: /Applications/MAMP/htdocs/hangr/vendor/bundle/ruby/2.6.0/gems/ffi-1.9.18/ext/ffi_c
make "DESTDIR=" clean
current directory: /Applications/MAMP/htdocs/hangr/vendor/bundle/ruby/2.6.0/gems/ffi-1.9.18/ext/ffi_c
make "DESTDIR="
compiling AbstractMemory.c
compiling ArrayType.c
compiling Buffer.c
compiling Call.c
Call.c:355:5: error: implicit declaration of function 'rb_thread_call_without_gvl' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
rbffi_thread_blocking_region(call_blocking_function, data, (void *) -1, NULL);
^
./Thread.h:78:39: note: expanded from macro 'rbffi_thread_blocking_region'
# define rbffi_thread_blocking_region rb_thread_call_without_gvl
^
1 error generated.
make: *** [Call.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Applications/MAMP/htdocs/hangr/vendor/bundle/ruby/2.6.0/gems/ffi-1.9.18 for inspection.
Results logged to
/Applications/MAMP/htdocs/hangr/vendor/bundle/ruby/2.6.0/extensions/universal-darwin-19/2.6.0/ffi-1.9.18/gem_make.out
An error occurred while installing ffi (1.9.18), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.9.18' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
jekyll was resolved to 3.4.3, which depends on
jekyll-sass-converter was resolved to 1.5.1, which depends on
sass was resolved to 3.5.5, which depends on
sass-listen was resolved to 4.0.0, which depends on
rb-inotify was resolved to 0.9.10, which depends on
ffi
When I run
ruby -v
I get
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
I have no idea at all what I need to do.
When I run
jekyll -v
I get
-bash: /usr/local/bin/jekyll: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad interpreter: No such file or directory
I tried running this from another post but had no luck
gem install ffi -v '1.9.18' -- --with-cflags="-Wno-error=implicit-function-declaration"
Does anyone have any ideas?
Thanks
The root problem is that you cannot install one of jekyl's dependancies - specifically the ffi gem. Knowing that will better help you workout a fix.
You can see that this is the error by reading your bundle output. Learn how to read these so you can better help yourself in the future; If you were searching for "install ffi on macOS" you might have found more information available to you.
Give that you've just installed Catalina, it's likely that GCC isn't on your machine, or is outdated, or is unlinked.
Try running xcode-select --install to (re)install the Xcode command line tools.
ALSO - STOP USING SUDO
At the very top of your bundle output is a warning that you shouldn't use sudo when installing gems. It's good advice to follow!
Even better advice would be to use rbenv or rvm to create gem sets or environments for each ruby application you're working with. But, if you don't go all the way down that path, ** at least, stop using sudo**
Context:
I ran gem uninstall --all in a "scorched-earth" attempt to debug a persistent Capybara error I was experiencing. My plan was to then run bundle install in the folder where my Gemfile is, and re-install the necessary gems with their correct versions. However, running that command resulted in the following:
Could not find addressable-2.3.6 in any of the sources
So I attempted to install the addressable gem by itself (i.e. gem install addressable), and that seemed to work fine. However when I re-ran bundle install, I got the following:
Could not find websocket-driver-0.3.4 in any of the sources
Attempting the same strategy (gem install websocket-driver) resulted in the following:
Fetching: websocket-driver-0.3.4.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing websocket-driver:
ERROR: Failed to build gem native extension.
/Users/richiethomas/.rvm/rubies/ruby-1.9.3-p547/bin/ruby extconf.rb
creating Makefile
make clean
make
compiling websocket_mask.c
make: *** [websocket_mask.o] Segmentation fault: 11
make failed, exit code 2
Gem files will remain installed in /Users/richiethomas/.rvm/gems/ruby-1.9.3-p547/gems/websocket-driver-0.3.4 for inspection.
Results logged to /Users/richiethomas/.rvm/gems/ruby-1.9.3-p547/extensions/x86_64-darwin-13/1.9.1/websocket-driver-0.3.4/gem_make.out
The contents of the gem_make.out file referenced above are:
creating Makefile
make clean
make
compiling websocket_mask.c
make: *** [websocket_mask.o] Segmentation fault: 11
make failed, exit code 2
My best guess is that I was too hasty in uninstalling all the things, and accidentally uninstalled something related to ruby and/or C compilation. I can't be sure though, because I don't know what a "make" is, or why it failed (according to the .out file).
UPDATE:
I tried running xcode-select --install from the command line, hoping this would solve any potential compilation errors, but no joy.
I ran rvm reinstall ruby-1.9.3 --with-gcc=clang, and this allowed me to install the version of websocket-driver that I wanted.
What helped me on Win 7 x64 was
gem install --verbose websocket-driver
But that not always works for some reason
I have been trying and trying and I can't get past this error. I have Ruby version 1.8.7 and Gem version 2.1.11 and I am trying to install open project and I keep coming up with this error
Installing json (1.8.1)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/json-1.8.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/json-1.8.1/ext/json/ext/generator/gem_make.out
Any help will be appreciated...
Best,
Mike
An error occurred while installing json (1.8.1), and Bundler cannot continue.
Make sure that gem install json -v '1.8.1' succeeds before bundling.
==> Something went wrong :(
==> Installation aborted.
Running sudo gem install json worked for me. Note: running gem install json did not work.
I installed 1.9.3 ruby from http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-1.9.3-p448.exe to C:\Ruby193.
I downloaded https://github.com/downloads/oneclick/rubyinstaller/DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe to C:\ruby_dev_kit and from there ran ruby dk.rb init then ruby dk.rb install
It all installed successfully.
Then when I ran gem install json I keep getting
Installing json (1.4.6) The system cannot find the path specified.
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb
checking for ruby/re.h... yes
checking for ruby/encoding.h... yes
creating Makefile
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.4.
6 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.4.6/ext/json/ext/ge
nerator/gem_make.out
An error occurred while installing json (1.4.6), and Bundler cannot continue.
Make sure that `gem install json -v '1.4.6'` succeeds before bundling.
I also tried gem install json --platform=ruby
Doesn't change anything. It seems that there's c compiler issues but I path defined correctly and DevKit associated as well.
Tried uninstall and install, doesn't help. Any thoughts?
Installing SystemTimer (1.2.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/SystemTimer-1.2.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/SystemTimer-1.2.1/ext/system_timer/gem_make.out
An error occured while installing SystemTimer (1.2.1), and Bundler cannot continue.
Make sure that `gem install SystemTimer -v '1.2.1'` succeeds before bundling.
I saw this post but mysql isn't the issue here (or is it? I do have -devel installed).
This is on a Fedora server, installing Diaspora. I have installed it before, but migrated to a new server. The other one was CentOS, not that it matters at the moment.
Not really sure where to start. I did try a yum list *timer* to see if there was anything along the same lines I needed to install.
Thanks!