Ruby DevKit not working for RedCloth and other gems on WindowsXP

妖精的绣舞 提交于 2019-12-11 08:06:56

问题


I'm a completely new to RoR and don't have much web development experience. I usually give up at this point, but I need a RoR dev environment for a job and I can't pick the brain of the site's creator because he's someone outside of the company and made it clear that he's completely unfamiliar with Windows (he develops on a mac and I'm starting to see why...). This is my first time posting so be kind...

Goal: Be able to view a RoR based site on local machine, preferably using a pre-existing XAMMP Server, but using the rails server would be fine too.


Environment: Windows XP Xammp 1.7.3 Ruby 9.1.2 DevKit 4.5.0.

What I've tried: I started with following the directions in this tutorial (Install Xampp and Rails on a Windows Machine http://www.grapethinking.com/getting-rails-to-work-on-a-windows-machine-running-xampp). I got through all the steps successfully and was able to create a rails app and see the "Welcome Aboard" page.

I got a local copy of the site off of heroku (http://heroku.com/), the ror hosting service that they use. I modified the apache configuration file to point to the public folder of the site as described in step 5 of the Xampp and Rails tutorial. At this point I got the following message when going to localhost:3000

Access forbidden!

You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.

If you think this is a server error, please contact the webmaster.
Error 403
localhost
11/4/2010 2:19:12 PM
Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1

I wasn't sure how to change permissions on a windows machine or if this was even the problem. I tried running "rails s" which complained:

Could not find RedCloth-4.2.3 in any of the sources, Try running 'bundle install'.

So I found this post which described my situation (http://www.ruby-forum.com/topic/204455) which led to me downloading the DevKit. At this point I uninstalled ruby and reinstalled it with the correct installer. I installed the devkit following the instructions on their site (https://github.com/oneclick/rubyinstaller/wiki/Development-Kit).

The DevKit is not working. The config.yml file automagically had the location where I installed ruby (in ....xampp/ruby/Ruby192) and it ran without complaining, except during step 5 where you test to see if it actually worked with the command "gem install rdiscount --platform=ruby" which produced the following error:

C:\RubyDevKit>gem install rdiscount --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing rdiscount:
        ERROR: Failed to build gem native extension.

"C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/XAMPP_Install
/xampp/ruby/Ruby192/bin/ruby.exe" extconf.rb
checking for random()... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010
/XAMPP_Install/xampp/ruby/Ruby192/bin/ruby
        --with-rdiscount-dir
        --without-rdiscount-dir
        --with-rdiscount-include
        --without-rdiscount-include=${rdiscount-dir}/include
        --with-rdiscount-lib
        --without-rdiscount-lib=${rdiscount-dir}/lib
C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/XAMPP_Install/
xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed t
o generate an executable file. (RuntimeError)
You have to install development tools first.
        from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X
AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:435:in `try_link0'
        from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X
AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:440:in `try_link'
        from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X
AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:552:in `try_func'
        from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X
AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:797:in `block in have_fun
c'
        from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X
AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking
_for'
        from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X
AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels)
in postpone'
        from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X
AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in `open'
        from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X
AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone
'
        from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X
AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in `open'
        from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X
AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
        from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X
AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
        from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X
AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:796:in `have_func'
        from extconf.rb:5:in `<main>'


Gem files will remain installed in C:/Documents and Settings/Lyla/My Documents/n
ew/XAMPP_Server_2010/XAMPP_Install/xampp/ruby/Ruby192/lib/ruby/gems/1.9.1/gems/r
discount-1.6.5 for inspection.
Results logged to C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2
010/XAMPP_Install/xampp/ruby/Ruby192/lib/ruby/gems/1.9.1/gems/rdiscount-1.6.5/ex
t/gem_make.out

So it does have the "Temporarily enhancing PATH to include DevKit..." but nothing else works. A similar error occurs when trying to install RedCloth.

I found this post which seems very related, but it's for getting dbd-odbc gem, whatever that is, to work and the solution seems somewhat specific to that: I can't get the ruby development kit working for Windows XP

I wasn't sure what he was talking about with the modifying the fstab file...maybe that would help me? Unfortunately I can't find the fstab file, I don't have a msys folder in my devkit root folder. I can't find gcc.bat, make.bat, or sh.bat in my ruby install's bin folder or in the various bin folders in devkit.

There's also this post (http://www.ruby-forum.com/topic/186191) which suggests some stuff I can't really follow...it's also all from 2009 so I figured it might be old.

help and thank you!


回答1:


To be completely honest, I would actually not bother with setting it up on Windows. It can be completely unmanageable and beyond frustrating at times (I know this from experience). There is a reason that there is a very small community of Rails developers that use Windows. Most everyone else uses OS X or a flavor of Linux.

Create an Ubuntu virtual machine with something like VirtualBox (free) and set up the Rails stack on there. It's a much more pain-free environment, and you won't look back. Alternatively, if you don't want to do all the setup yourself, use the BitNami RubyStack. It's a preconfigured Ruby/Rails environment that you can either use as a virtual machine, or install on your computer (I'd opt for the former).

Hope that helps!




回答2:


Here's what I did for anyone who might be interested:

Platform: Windows 7 Rails 4 Ruby 1.9.2p0

  1. Installed Ruby via rubyinstaller.org
  2. Downloaded DevKit
  3. From the Ruby enhanced CMD prompt, "ruby dk.rb init", followed by "ruby dk.rb install"
  4. Downloaded the SQLLite DLL files from here: sqlite.org, copied them into the C:\Windows directory
  5. From the Ruby enhanced CMD prompt, "Gem install RedCloth"
  6. Added "Gem RedCloth" to gemfile
  7. "bundle install"

These steps worked for me! I don't understand why people have such a hard time with Ruby on Windows. That's all I develop on and it works fine.



来源:https://stackoverflow.com/questions/4100267/ruby-devkit-not-working-for-redcloth-and-other-gems-on-windowsxp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!