如何在 Cygwin 中使用 Rails

发布于 2024-08-09 06:45:23 字数 145 浏览 1 评论 0原文

我已经使用 ruby​​stack 安装了 Rails 并设置了 env 路径,因此我可以在 cmd 中使用它。当我尝试将它与 cygwin 一起使用时,我无法工作(它不应该),如何使该 Rails 在 Windows 和 cygwin env 上工作,或者我必须单独安装它。

I have installed rails using rubystack and set env path, so I can use it in cmd. When I try to use it with cygwin I doesn't work (it shouldn't), how to make this rails work on both windows and cygwin env or I have to install it separately.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

清风挽心 2024-08-16 06:45:23

如果您只是想安装以便可以在 cmd 中使用它,那么您无需使用 Cygwin 即可完成此操作。您可以在 Windows 中下载并安装 ruby​​ 和 ruby​​gems,然后使用 ruby​​gems 安装 Rails 和您需要的任何其他 gem。然后,您只需正确设置路径以包含 ruby​​ 安装的 bin 目录,您应该能够在 Windows 中通过 cmd 使用 ruby​​。我知道这并不能直接回答你的问题,但如果你只是在cmd中寻找rails,我希望它有帮助。

If you are just looking to install so you can use it in cmd, then you can do this without having to use Cygwin. You can download and install ruby and rubygems in windows and then use rubygems to install rails and any other gems you need. You then just have to set the path properly to include the bin directory of the ruby installation and you should be able to use ruby from cmd in windows. This doesn't directly answer your questions I know, but if you are just looking for rails in the cmd, I hope it is helpful.

养猫人 2024-08-16 06:45:23

更新:我发现两个项目解决了我在下面概述的问题。

首先

  • 运行 Cygwin 的 setup.exe 并搜索“make”
  • 等待搜索结果
  • 安装出现的所有项目(您可以通过单击附近来执行此操作) “树”的顶部)

其次

  • 运行 Cygwin 的 setup.exe 并安装 rebase 包。
  • 使用 Windows cmd 行(是的,它必须是 Windows cmd 行,而不是 cygwin!),运行 \cygwin\bin\ash
  • 在 ash 提示符下,运行 /bin/rebaseall

重新启动 Windows。运行 cygwin。运行:gem install Rails


我已经通过 cygwin 安装文件安装了 Ruby。我还安装了“make”、“sqlite”和“openssl/openssh”。

然后,我通过从网站下载、cd 到 /cygwin/bin/ ,然后进入临时目录,然后运行 ​​ruby​​ setup.rb 成功安装了 Gems。

这一切都安装得很完美。

现在我运行gem install Rails。它失败并产生以下错误。我找不到更多这方面的信息。非常感谢任何帮助。

gem install rails
cygwin warning:
  MS-DOS style path detected: C:\ProgramData/gemrc
  Preferred POSIX equivalent is: /cygdrive/c/ProgramData/gemrc
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
Building native extensions.  This could take a while...
      0 [main] ruby 524 C:\cygwin\bin\ruby.exe: *** fatal error - unable to remap \\?\C:\cygwin\lib\ruby\1.8\i386-cygwin\etc.so to same address as parent: 0x230000 != 0x330000
      0 [main] ruby 524 C:\cygwin\bin\ruby.exe: *** fatal error - unable to remap \\?\C:\cygwin\lib\ruby\1.8\i386-cygwin\etc.so to same address as parent: 0x230000 != 0x330000
Stack trace:
Frame     Function  Args
023FAEF8  6102796B  (023FAEF8, 00000000, 00000000, 00000000)
      1 [main] ruby 2736 fork: child 524 - died waiting for dll loading, errno 11
023FC218  61004F1B  (611A7FAC, 61243684, 00230000, 00330000)
End of stack trace
      1 [main] ruby 2736 fork: child 524 - died waiting for dll loading, errno 11
1049214 [main] ruby 6948 C:\cygwin\bin\ruby.exe: *** fatal error - unable to remap \\?\C:\cygwin\lib\ruby\1.8\i386-cygwin\etc.so to same address as parent: 0x230000 != 0x3D0000
1049214 [main] ruby 6948 C:\cygwin\bin\ruby.exe: *** fatal error - unable to remap \\?\C:\cygwin\lib\ruby\1.8\i386-cygwin\etc.so to same address as parent: 0x230000 != 0x3D0000
Stack trace:
Frame     Function  Args
023FAEF8  6102796B  (023FAEF8, 00000000, 00000000, 00000000)
023FB1E8  6102796B  (6117EC60, 00008000, 00000000, 61180977)
023FC218  61004F1B  (611A7FAC, 61243684, 001055653 [main] ruby 2736 fork: child 6948 - died waiting for dll loading, errno 11
230000, 003D0000)
End of stack trace
1055653 [main] ruby 2736 fork: child 6948 - died waiting for dll loading, errno 11
2095819 [main] ruby 6924 C:\cygwin\bin\ruby.exe: *** fatal error - unable to remap \\?\C:\cygwin\lib\ruby\1.8\i386-cygwin\etc.so to same address as parent: 0x230000 != 0x360000
2095819 [main] ruby 6924 C:\cygwin\bin\ruby.exe: *** fatal error - unable to remap \\?\C:\cygwin\lib\ruby\1.8\i386-cygwin\etc.so to same address as parent: 0x230000 != 0x360000
Stack trace:
Frame     Function  Args
023FAEF8  6102796B  (023FAEF8, 00000000, 00000000, 00000000)
023FB1E8  6102796B  (6117EC60, 00008000, 00000000, 61180977)
023FC218  61004F1B  (611A7FAC, 61243684, 00230000, 00360000)2103039 [main] ruby 2736 fork: child 6924 - died waiting for dll loading, errno
11

End of stack trace
2103039 [main] ruby 2736 fork: child 6924 - died waiting for dll loading, errno 11
ERROR:  Error installing rails:
        ERROR: Failed to build gem native extension.

        /usr/bin/ruby.exe extconf.rb
creating Makefile

make
gcc -I. -I/usr/lib/ruby/1.8/i386-cygwin -I/usr/lib/ruby/1.8/i386-cygwin -I.   -g -O2    -c bcrypt_ext.c
make: gcc: Command not found
make: *** [bcrypt_ext.o] Error 127


Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/bcrypt-ruby-3.0.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/bcrypt-ruby-3.0.1/ext/mri/gem_make.out

供您参考,我的 ruby​​ 和 gem 版本如下:

$ ruby --version
ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-cygwin]

$ gem -v
1.8.10

Update: I found two items which fixed the problem I outlined below.

Firstly

  • Run Cygwin’s setup.exe and search for "make"
  • Wait for search results
  • Install all items which appear (you can do this by clicking near the top of the "tree")

Secondly

  • Run Cygwin’s setup.exe and install the rebase package.
  • Using the Windows cmd line (yes, it must be the Windows cmd line not cygwin!), run \cygwin\bin\ash
  • At the ash prompt, run /bin/rebaseall

Restart Windows. Run cygwin. Run: gem install rails


I have installed Ruby via the cygwin setup file. I've also installed "make", "sqlite" and "openssl/openssh".

I've then sucessfully installed Gems by downloading from website, cd into /cygwin/bin/ and then into a temp directory and then running ruby setup.rb.

This all installed perfectly.

Now I run gem install rails. It fails producing the following error. I can't find any more info on this. Any help much appreciated.

gem install rails
cygwin warning:
  MS-DOS style path detected: C:\ProgramData/gemrc
  Preferred POSIX equivalent is: /cygdrive/c/ProgramData/gemrc
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
Building native extensions.  This could take a while...
      0 [main] ruby 524 C:\cygwin\bin\ruby.exe: *** fatal error - unable to remap \\?\C:\cygwin\lib\ruby\1.8\i386-cygwin\etc.so to same address as parent: 0x230000 != 0x330000
      0 [main] ruby 524 C:\cygwin\bin\ruby.exe: *** fatal error - unable to remap \\?\C:\cygwin\lib\ruby\1.8\i386-cygwin\etc.so to same address as parent: 0x230000 != 0x330000
Stack trace:
Frame     Function  Args
023FAEF8  6102796B  (023FAEF8, 00000000, 00000000, 00000000)
      1 [main] ruby 2736 fork: child 524 - died waiting for dll loading, errno 11
023FC218  61004F1B  (611A7FAC, 61243684, 00230000, 00330000)
End of stack trace
      1 [main] ruby 2736 fork: child 524 - died waiting for dll loading, errno 11
1049214 [main] ruby 6948 C:\cygwin\bin\ruby.exe: *** fatal error - unable to remap \\?\C:\cygwin\lib\ruby\1.8\i386-cygwin\etc.so to same address as parent: 0x230000 != 0x3D0000
1049214 [main] ruby 6948 C:\cygwin\bin\ruby.exe: *** fatal error - unable to remap \\?\C:\cygwin\lib\ruby\1.8\i386-cygwin\etc.so to same address as parent: 0x230000 != 0x3D0000
Stack trace:
Frame     Function  Args
023FAEF8  6102796B  (023FAEF8, 00000000, 00000000, 00000000)
023FB1E8  6102796B  (6117EC60, 00008000, 00000000, 61180977)
023FC218  61004F1B  (611A7FAC, 61243684, 001055653 [main] ruby 2736 fork: child 6948 - died waiting for dll loading, errno 11
230000, 003D0000)
End of stack trace
1055653 [main] ruby 2736 fork: child 6948 - died waiting for dll loading, errno 11
2095819 [main] ruby 6924 C:\cygwin\bin\ruby.exe: *** fatal error - unable to remap \\?\C:\cygwin\lib\ruby\1.8\i386-cygwin\etc.so to same address as parent: 0x230000 != 0x360000
2095819 [main] ruby 6924 C:\cygwin\bin\ruby.exe: *** fatal error - unable to remap \\?\C:\cygwin\lib\ruby\1.8\i386-cygwin\etc.so to same address as parent: 0x230000 != 0x360000
Stack trace:
Frame     Function  Args
023FAEF8  6102796B  (023FAEF8, 00000000, 00000000, 00000000)
023FB1E8  6102796B  (6117EC60, 00008000, 00000000, 61180977)
023FC218  61004F1B  (611A7FAC, 61243684, 00230000, 00360000)2103039 [main] ruby 2736 fork: child 6924 - died waiting for dll loading, errno
11

End of stack trace
2103039 [main] ruby 2736 fork: child 6924 - died waiting for dll loading, errno 11
ERROR:  Error installing rails:
        ERROR: Failed to build gem native extension.

        /usr/bin/ruby.exe extconf.rb
creating Makefile

make
gcc -I. -I/usr/lib/ruby/1.8/i386-cygwin -I/usr/lib/ruby/1.8/i386-cygwin -I.   -g -O2    -c bcrypt_ext.c
make: gcc: Command not found
make: *** [bcrypt_ext.o] Error 127


Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/bcrypt-ruby-3.0.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/bcrypt-ruby-3.0.1/ext/mri/gem_make.out

For your info my ruby and gem versions are below:

$ ruby --version
ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-cygwin]

$ gem -v
1.8.10
蹲在坟头点根烟 2024-08-16 06:45:23

请访问此站点:

http: //www.pluitsolutions.com/2006/03/30/install-ruby-on-rails-ror-on-cygwin

但是,如果您有其他问题,请发表评论,我们会查看。

Please visit this site:

http://www.pluitsolutions.com/2006/03/30/install-ruby-on-rails-ror-on-cygwin

However, if you have a different issue leave a comment and we will have a look.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文