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
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.
When I try to install the websocket-driver-0.7.3 gem, I get this message on CMD:
Fetching websocket-driver 0.7.3
Installing websocket-driver 0.7.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/websocket-driver-0.7.3/ext/websocket-driver
C:/Ruby27-x64/bin/ruby.exe -I C:/Ruby27-x64/lib/ruby/2.7.0 -r
./siteconf20201109-15264-1prb1qx.rb extconf.rb
creating Makefile
current directory:
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/websocket-driver-0.7.3/ext/websocket-driver
make "DESTDIR=" clean
current directory:
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/websocket-driver-0.7.3/ext/websocket-driver
make "DESTDIR="
make failedNo such file or directory - make "DESTDIR="
Gem files will remain installed in
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/websocket-driver-0.7.3 for inspection.
Results logged to
C:/Ruby27-x64/lib/ruby/gems/2.7.0/extensions/x64-mingw32/2.7.0/websocket-driver-0.7.3/gem_make.out
I'm using ruby 2.7.0. Please help!
According to similar issue on github repo, you should do the following:
install MSYS2 DevKit
run ridk install
for further information refer to the issue on github.
and ruby installer for windows.
rvm install ruby-3.0.1 --with-gcc
I'm failing to install Jekyll using gem in Ruby. Here's the output messages:
D:\Ruby21\bin>gem install jekyll
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
D:/Ruby21/bin/ruby.exe extconf.rb
creating Makefile
make "DESTDIR=" clean
Makefile:238: *** multiple target patterns. Stop.
make "DESTDIR="
Makefile:238: *** multiple target patterns. Stop.
make failed, exit code 2
Gem files will remain installed in D:/Ruby21/lib/ruby/gems/2.1.0/gems/redcarpet-3.2.0 for inspection.
Results logged to D:/Ruby21/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/redcarpet-3.2.0/gem_make.out
D:\Ruby21\bin>
Unlike the other issue here, where the error breaks in the Makefile on line 222, mine breaks in the Makefile on line 238.
I can tell it has nothing to do with spaces in my installation path (since I installed Ruby in the root of my D drive). But anything from there is beyond my scope.
I'm using Windows Vista x86. I have installed Ruby 2.1.0 stable.
Does anyone know how to fix this?
Nevermind, I didn't solve the problem, but rather I used a workaround.
I installed Cygwin-x86 on my laptop, then installed Ruby and Rubygem, finally installed Jekyll and managed to go past the redcarpet-v3.2.0 build error.
To install Jekyll in Cygwin:
Run cygwin-setup.exe.
Install appropriate packages: Ruby, rubygem, make, gcc, git, libxslt, libxml2. Some more packages may be required here.
Install jekyll using gem install jekyll. Wait.
Type in command: vim ~/.bashrc
Scroll to the end and add export PATH=$PATH:".gem/ruby/gems/jekyll-2.4.0/bin"
That's how the Jekyll is installed on Cygwin.
Later on, you may need the following:
Subversion
bzip2
apt-cyg
patch
curl
rvm
jemoji
jekyll-sitemap
And have to do a lot of ~/.bashrc editing, calling source $HOME/path/to/rvm and PATH fixing.
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.
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