Problems installing Thin on windows 7 x86 - windows

I'm having problems getting thin working on my Windows 7 machine (I've already installed eventmachine v0.8.1):
>gem install thin --ignore-dependencies
checking for main() in -lc... no
creating Makefile
make
'make' is not recognized as an internal or external command, operable program or batch file.
Are there not meant to be precompiled binaries available for thin?

Apparently, there aren't any pre-built binaries.
You will need a C compiler installed. If you installed Ruby via the RubyInstaller, that is going to be really easy, if you used the One-Click Installer, it's goint to be a PITA.
See also: problems installing thin on Windows, which contains an answer by the RubyInstaller and One-Click Installer maintainer.

There actually are pre-built binaries for particular versions of Thin but you need to know which ones. To get the latest pre-built win32 version do the following:
Go to the RubyGems Thin page
Look under the "Versions" section for a version that has "x86-mswin32" to the right of it. (As of today versions 1.2.11, 1.2.10, etc all have win32 binaries)
Run the following following "gem install" command with the version of Thin included with the "-v" flag:
gem install thin -v 1.2.11
Here are the results from my installation:
c:\>gem install thin -v 1.2.11
Successfully installed thin-1.2.11-x86-mswin32
1 gem installed
Installing ri documentation for thin-1.2.11-x86-mswin32...
Updating ri class cache with 3611 classes...
Installing RDoc documentation for thin-1.2.11-x86-mswin32...

I've worked around the lack of precompiled binaries by installing a compiler:
I iInstalled MinGW to C:\MinGW (see here for installation instructions)
I then installed MSYS to C:\msys\1.0
I then added c:\MinGW\bin and C:\msys\1.0\bin to my %PATH%
Finally I ran gem install thin and amazingly it all worked!
I hope this helps out some other poor Windows ruby developer! :-)

A binary for thin is in fact available (and apparently one has been since ver 1.2.2).
However, I couldn't install thin on Windows 7 with Ruby 1.9.2 (p290) because of its dependency on EventMachine.
Running gem install thin --ignore-dependencies was what was needed to get thin itself installed.
Just wanted to add this note for some other ruby on Windows user.

Related

Error installing jekyll: ERROR: Failed to build gem native extension

I use github+jekyll to build blog, i try to install jekyll to local(windows 10), while it failed when i rungem install jekyll and the stack trace is
C:\Developments\FrontEnd\rubygems-2.7.7>gem install jekyll
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
current directory: C:/Developments/FrontEnd/Ruby25-x64/lib/ruby/gems/2.5.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
C:/Developments/FrontEnd/Ruby25-x64/bin/ruby.exe -r ./siteconf20180806-33956-l8y76h.rb extconf.rb
creating Makefile
current directory: C:/Developments/FrontEnd/Ruby25-x64/lib/ruby/gems/2.5.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
make "DESTDIR=" clean
'make' is not recognized as an internal or external command,
operable program or batch file.
current directory: C:/Developments/FrontEnd/Ruby25-x64/lib/ruby/gems/2.5.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
make "DESTDIR="
'make' is not recognized as an internal or external command,
operable program or batch file.
make failed, exit code 1
what i do is:
1. install ruby, path variable was set, version: ruby 2.5.1p57 (2018-03-29 revision 63029) [x64-mingw32].
2. install rubygems, version: 2.7.7.
3. install MSYS2.
4. install jekyll, gem install jekyll, then the above error occurs and i'm not sure the reason.
i have tried to install devkit and it not works, i think my ruby version is 2.5+, so don't need devkit and i have uninstalled it.
Anyone could help me?
Although they made the Ruby+DevKit an "optional" download for the RubyInstaller on Windows, if you plan to install gems, it is practically a necessity. A large percentage of the most popular gems are C extension that will need built on your machine when being installed.
The DevKit is a handy toolchain that supplies everything you need for this to be done, automatically without you needed to do anything more than type gem install XXXXX. Without it, you either cannot use C extension gems, or must have already installed MSYS and MingW, have them configured properly, which is all not a user-friendly experience, even for those who familiar with the process.
So even if DevKit is optional, it is still required to make the most of Ruby on Windows.
Solution re-install ruby with rubyinstaller-devkit-2.5.5-1-x64
and issue
gem install bundler
gem install jekyll
I got the same error message. It turned out that the culprit was the ffi gem. I got it to work using this solution.
I had the same issue. I was able to resolve it (in Windows 11 x64) via:
winget install -e --id RubyInstallerTeam.RubyWithDevKit
(I.e., reinstall Ruby with the DevKit)

'ruby' is not recognized as an internal or external command

I'm trying to install rubygems on my windows7 pc. I've download the rubygems-2.4.1.zip from https://rubygems.org/pages/download. Now I'm trying to install rubygems through the command:
ruby setup.rb
But I see the error:
'ruby' is not recognized as an internal or external command
How can I use 'ruby' command on my pc?
Downloaded rubygems-2.4.1.zip does not contain any exe file, through which I can install it. I'm a beginner. Please help me.
Try RubyInstaller on Win32 Platforms
Rubygems is a package manager for Ruby, which is a per-requisite that you may or may not have properly installed on your OS. Installing Ruby on Windows properly is tricky; your best bet is to use RubyInstaller to install Ruby and Rubygems, and make sure to read the RubyInstaller FAQ.
Good luck!

Which sources were used to compile gem native extensions

I compiled pg gem with postgres 8.4 sources, but I have reinstalled postgres to 9.0. I have reinstalled pg, but I'm not sure if native extensions were reinstalled. How do I check this?
You did not provide any context like your OS and how are you managing your gems. Usually the native extension will be built when installing the gem, therefore the gem installation would have failed if the building of the native extension did not succeed.
Assuming you are using rvm and ruby-1.8.7-p352 version of ruby, look for the compiled extension:
$HOME/.rvm/gems/ruby-1.8.7-p352/gems/pg-0.11.0/lib/pg_ext.so
Note that .so is the extension on Linux. To check what is on your OS do:
ruby -e "require 'rbconfig'; puts RbConfig::CONFIG['DLEXT']"
If you did not use rvm, in Linux you can find system ruby and its gems in a path like this one (may be different in your distro)
/usr/lib64/ruby/gems/1.8/gems

Installing Sproutcore with RubyGems fails at the haml gem

I am trying to install sproutcore on a windows xp vm (virtualbox), for development, using RubyGems. When gems reaches haml-3.0.25.gem it stops with the error:
gem install sproutcore -V
...
ERROR: While executing gem ... (Zlib::DataError)
invalid stored block lengths
I have tried both Ruby 1.8.7 and 1.9.2 as well as RubyGems 1.7.1 and 1.8.1.
I tried downloading haml 3.1.1 with git and installing it manually, but the rake would not install. It said something about 'lib/haml' not found. The directory did exist.
Other gems install just fine under all the combinations I tried. I even tried installing it under my host OS (Win 7 32-bit), but it gave the same error. Installing haml by itself changes the error message only slightly:
gem install haml -V
...
ERROR: While executing gem ... (Zlib::DataError)
invalid code lengths set
Zlib compresses and decompresses data streams from what I have read, so it sounds like the haml gem might be corrupt (although I doubt).
I am at my wits end and could find no helpful advice anywhere.
Special thanks to #saner for his contribution. After a lot of frustration, this is how I finally installed sproutcore on a Windows XP VM running on a Windows 7 host.
1) Download and install Ruby 1.9.2-p180 (remember to tick the option to include the bin directory in the PATH variable).
2) Download DevKit 4.5.1 and extract it.
3) Open a command prompt and cd to the extracted directory.
4) Run:
ruby dk.rb init
ruby dk.rb review
ruby dk.rb install
5) Download RubyGems 1.7.2 and run setup.rb
6) From the command prompt run
gem install haml -v 3.0.24
gem install eventmachine --pre
gem install sproutcore --pre
Thats it.
Enjoy.
I was able to install SproutCore on Ruby 1.9.2:
Install Ruby 1.9.2-p180
gem install sproutcore --pre
gem install eventmachine --pre
gem uninstall thin
gem install mongrel
I needed to remove thin because starting sc-server ended with errors, SproutCore will use mongrel instead of thin.
Update:
I didn't mention that I use RubyGems 1.7.2 and I have installed DevKit and Cygwin.
I removed all versions of SproutCore, Mongrel and Haml, then I typed:
gem install sproutcore --pre, SproutCore v1.6.0.beta.1 was installed.
eventmachine --pre, eventmachine (1.0.0.beta.3 x86-mingw32) was installed
SproutCore works with this setup, using mongrel was not necessary.
My configuration: sproutcore (1.6.0.beta.1), ruby 1.9.2p180, gem 1.7.2, thin (1.2.11 x86-mingw32), eventmachine (1.0.0.beta.3 x86-mingw32), haml (3.0.25), gcc version 4.5.0 (GCC)
I know this is a really old question, but since I just experienced the same problem, I've decided to add my insights on it.
So, it happened while I was trying to install the same set of gems on two different machines with different architectures, with different locations and respectively in different networks. I.e. - my home mac and a remote linux server.
So, one particular gem (dm-sqlite-adapter) failed installing on both machines, and I even tried it couple of times, but always with the same result:
$ gem install dm-sqlite-adapter
ERROR: While executing gem ... (Zlib::DataError)
invalid code lengths set
Then I spent few minutes browsing the network for a solution, including reading this thread.
Since I didn't find any satisfying answer and I wasn't pleased with the idea of reinstalling everything, decided to act dumb and tried gem install one more time.. And it worked. Then tried the other machine - worked like a charm.
So as a conclusion I'd just guess that the problem came from the remote repo and maybe the gem hadn't even downloaded at all (I forgot to check that prior to succeeding installing it). But as I said - it's just a guess..

install bcrypt-ruby on windows

I have copy the make.bat to bin\ folder,when run the command gem install bcrypt-ruby,
it shows the bash.exe is not the internal or external command.
How to solve it?
I was trying to install "bcrypt-ruby" on Windows 8, 64 bit .
Tried a lot of configurations, ranging from different versions of the gem, direct from git, platform ruby etc.
But nothing worked
At the end installed DEVKIT compatible to my ruby version and thats it.
Steps
Install Devkit compatible to your ruby version
Link : http://rubyinstaller.org/downloads/
Download under
C:/Ruby Folder/devkit
Then on command line go to above path
C:/Ruby Folder/devkit
then say
gem install bcrypt-ruby
This should install it,
Post this, you need to add the gem to your Gemfile and say
bundle install
bundle update
bundle install
This should work fine. Also solves update issues related to active_record etc.
The same should work for WIN 64, WIN 32 also.

Resources