I am trying bundle install in my windows env and it fails with the below error.
I did install dev kit:
ruby dk.rb init
ruby dk.rb install
When running bundle install, I get the following output.
DL is deprecated, please use Fiddle
Fetching gem metadata from https://rubygems.org/.........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using mime-types 2.3
Using mini_portile 0.6.0
Using nokogiri 1.6.2.1
Using rack 1.5.2
Using rack-test 0.6.2
Using xpath 2.0.0
Using capybara 2.3.0
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
c:/Ruby200/bin/ruby.exe extconf.rb
creating Makefile
make "DESTDIR=" clean
0 [main] rm 10376 open_stackdumpfile: Dumping stack trace to rm.exe.stackdump
make: [clean-static] Error 5 (ignored)
0 [main] rm 14216 open_stackdumpfile: Dumping stack trace to rm.exe.stackdump
make: [clean] Error 5 (ignored)
make "DESTDIR="
generating generator-i386-mingw32.def
compiling generator.c
In file included from c:/Ruby200/include/ruby-2.0.0/ruby.h:33:0,
from ../fbuffer/fbuffer.h:5,
from generator.c:1:
c:/Ruby200/include/ruby-2.0.0/ruby/ruby.h:125:14: error: size of array 'ruby_check_sizeof_voidp' is negative
In file included from c:/Ruby200/include/ruby-2.0.0/ruby.h:33:0,
from ../fbuffer/fbuffer.h:5,
from generator.c:1:
I got a similar error when running bundle and it was fixed by agreeing to the Xcode license. I had recently updated Xcode and it turns out that I needed to re-agree to the license in order to use the command line tools successfully.
Just run
xcodebuild -license
Mine was also an xcode issue and I'm using a Mac. I had to use sudo though to give permission via the shell.
sudo xcodebuild -license
This worked for me.
Related
I'm not able to install json gem on my M1 MacBook. This is the command I'm running.
sudo gem install json -v '2.6.2'
This is the error I'm getting. I'm guessing it because it's picking up Xcode 14.1 Beta 3, but I'm not sure how to have it use a different version of Xcode or if that's the problem.
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.6.0/gems/json-2.6.2/ext/json/ext/generator
/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 ./siteconf20221018-37799-1wcwkww.rb extconf.rb
creating Makefile
current directory: /Library/Ruby/Gems/2.6.0/gems/json-2.6.2/ext/json/ext/generator
make "DESTDIR=" clean
current directory: /Library/Ruby/Gems/2.6.0/gems/json-2.6.2/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:
In file included from ./../fbuffer/fbuffer.h:5:
In file included from /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby.h:33:
/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/ruby.h:24:10: fatal error: 'ruby/config.h' file not found
#include "ruby/config.h"
^~~~~~~~~~~~~~~
/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/ruby.h:24:10: note: did not find header 'config.h' in framework 'ruby' (loaded from '/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks')
1 error generated.
make: *** [generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/json-2.6.2 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-21/2.6.0/json-2.6.2/gem_make.out
The issue here is:
Assuming you're trying to install a modern 2.x version of JSON, this error is because it can't see the ruby development tools.
This is because MacOS doesn't include ruby development tools for its base-level version of ruby. That version of ruby is used for some very core-level things on Mac and they lock it down pretty intensely.
The solution is to use rbenv to install a new, user-controlled copy of ruby. This answer has a good step-by-step of how to do that, but the TLDR; is get brew, run brew install rbenv ruby-build, and then run rbenv install 2.6.10 && rbenv global 2.6.10 && rbenv rehash. Then restart your terminal.
Now gem install commands should target the copy of ruby you just installed. (You can validate this by running ruby --version and making sure it lists the version you installed in step 3.) This should fix your issue installing json, whether via gem install or bundle install.
resolved by CocoaPods/CocoaPods#10286
curl -sSL https://get.rvm.io | bash -s stable
close and reopen terminal
rvm install ruby#latest
rvm use ruby-3.0.0 --default
This issue was already reported here, https://github.com/rubygems/bundler/issues/4462.
Can you try bundle update && bundle install.
bundle update will install all of your dependencies, but if you dont want to update all dependencies, try bundle update json only.
I have written small script project on windows, I have three gems in my gem file
I am using Travelling ruby on ubuntu to create its package but in the rake task when script try to dowload the gems these three gems gives error because I think its window specific gems and look for some dependencies
I kept these gems with in the project and referenced in gem file , The script created zip file well, but when I run that on windows the errors that the win32... gems not found
rake package:win32 outputs when it try to fetch gems
```shell
Fetching gem metadata from http://rubygems.org/............
Fetching version metadata from http://rubygems.org/.
Resolving dependencies...
Using jmespath 1.3.1
Using ffi 1.9.14
Using mini_magick 4.3.6
Installing win32-api 1.4.8 (was 1.6.0) with native extensions
Using bundler 1.13.5
Using aws-sdk-core 2.6.10
Using rautomation 0.17.0
Using win32-clipboard 0.6.4
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/home/vishalgarg/.rvm/rubies/ruby-2.1.5/bin/ruby -r ./siteconf20161019-3963-1e9bkxl.rb extconf.rb
checking for strncpy_s()... no
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling win32/api.c
win32/api.c:2:21: fatal error: windows.h: No such file or directory
#include <windows.h>
^
compilation terminated.
make: *** [api.o] Error 1
make failed, exit code 2
```
So Finally I got the answer, So Travelling ruby does't work for me because some of its limitations
So its good to go with Ocra Gem (https://github.com/larsch/ocra)
Simple install the gem on windows (I have made app on window)
and run the command
ocra <Ruby file name > --verbose --gem-full --no-dep-run --add-all-core --gemfile Gemfile
It will generate the exe file and you are ready to run it on any windows
I'm trying to install Ruby/JSON on Mac OS X 10.11.
However, the gem install command gives the error message:
smcho#macho ruby-rails-sample> gem install json
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
/Users/smcho/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20151025-39148-au2m2x.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling generator.c
linking shared-object json/ext/generator.bundle
ld: warning: directory not found for option '-L/Users/haven/.sm/pkg/active/lib'
make "DESTDIR=" install
./install -m 0755 generator.bundle ./.gem.20151025-39148-i7g03f/json/ext
make: ./install: No such file or directory
make: *** [install-so] Error 1
make install failed, exit code 2
Gem files will remain installed in /Users/smcho/.rvm/gems/ruby-2.2.1/gems/json-1.8.3 for inspection.
Results logged to /Users/smcho/.rvm/gems/ruby-2.2.1/extensions/x86_64-darwin-14/2.2.0-static/json-1.8.3/gem_make.out
The message says make: ./install: No such file or directory, but I'm not sure how to fix this issue.
Is this a known issue, or is there a way to bypass this one?
This is my system version. I executed gem update --system to get the latest version.
> ruby -v
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
> gem -v
2.4.8
I should have used the latest ruby (2.2.3) not the old one (2.2.1)
ruby-rails-sample> rvm --default use 2.2.3
Using /Users/smcho/.rvm/gems/ruby-2.2.3
smcho#macho ruby-rails-sample> gem install json
Building native extensions. This could take a while...
Successfully installed json-1.8.3
Parsing documentation for json-1.8.3
Installing ri documentation for json-1.8.3
Done installing documentation for json after 1 seconds
1 gem installed
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
When I try installing rails version 3.1 I get an error in the terminal:
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/Users/alonbond/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
creating Makefile
make
sh: make: command not found
Gem files will remain installed in /Users/alonbond/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/json-1.6.3 for inspection.
Results logged to /Users/alonbond/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/json-1.6.3/ext/json/ext/parser/gem_make.out
and then I try using a rails command:
Alon-Weissfelds-MacBook-Pro:~ alonbond$ rails -v
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
Try to install Xcode from Mac App Store or GCC compiler https://github.com/kennethreitz/osx-gcc-installer.
Usually Xcode solves all those problems. The GCC is not 100% compliant with all gems.