【问题标题】:Standalone RedCloth on WindowsWindows 上的独立 RedCloth
【发布时间】:2011-06-12 01:00:33
【问题描述】:

上下文

我最近参与了一个软件开发项目,我希望使用文本标记来编写技术文档(适合在代码存储库中与代码一起跟踪)。因为该项目已经在使用Redmine,所以我想使用Textile,从而避免其他开发人员学习另一种标记语言。我知道实现有所不同,因此本着POLS 的精神,我想使用Redmine 内部使用的RedCloth

我们正在开发和部署到多个操作系统,包括 Windows。为方便起见,以及仅使用 Windows 的非技术、非开发人员用户,我希望能够使用独立工具编译所述技术文档,最好部署为 单个安装程序

我是 100% 的 Ruby 新手,所以请耐心等待。我不打算为这个项目使用 Ruby 进行开发,我只想在 Windows 上进行有效安装,我会从那里处理其余的工作。

帮助想要

我不是在开发 Rails 应用程序,这是用于桌面安装的,所以不要告诉我“只在 Linux 上使用它”。我已经安装了 DevKit,它安装了 makeg++ 等,并被 ./configure 脚本接受为“健全的开发环境”。

我有一个简单的问题,我正在寻找一个简单的解决方案。谷歌搜索这个问题已经向has been reported before 显示了这个问题,我只找到了切换到 Linux 的建议,并且有人告诉我它“就像宣传的那样工作”。

我需要一些实际的帮助,即使它只是我可以检查的可能故障点清单的形式。

环境

此问题发生在 Windows 7、64 位机器上,之前没有 Ruby 安装历史。我目前无法访问 32 位。

Linux 安装不是问题。

问题

我刚刚下载了 Ruby Installer for Windows Ruby 1.9.2-p136Ruby Development Kit DevKit-tdm-32-4.5.1-20101214-1400-sfx.exe,这是编译 RedCloth 所必需的。两者都是目前在 Windows 上部署 Ruby 的推荐版本(或者我已经阅读过)。

我正在按照说明进行操作,到目前为止一切顺利。 Ruby 和 DevKit 都安装在默认路径中(文件夹名称中没有空格)。 config.yml 正确指向新安装,仅此而已。 ruby dk.rb install 运行良好。现在,我可以在 Ruby 安装文件夹中看到一个名为 lib/ruby/site_ruby/devkit.rb 的文件,我认为,这是在编译 Ruby gem 时设置 DevKit 路径的编译预挂钩。正如预期的那样,代码指向正确的文件夹。

当我使用推荐的 gem install rdiscount --platform=ruby 命令测试安装时,我得到了这个:

C:\DevKit>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:/Ruby192/bin/ruby.exe" extconf.rb

这有点令人困惑,所以我开始四处寻找,我可以找到文件lib/ruby/gems/1.9.1/gems/rdiscount-1.6.5/ext/extconf.rb 文件。通过该文件夹中的ruby extconf.rb 运行它会给我:

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:/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:/Ruby192/lib/ruby/1.9.1/mkmf.rb:678:in `flush': Broken pipe (Errno::EPIPE)
    from c:/Ruby192/lib/ruby/1.9.1/mkmf.rb:678:in `message'
    from c:/Ruby192/lib/ruby/1.9.1/mkmf.rb:690:in `checking_for'
    from c:/Ruby192/lib/ruby/1.9.1/mkmf.rb:796:in `have_func'
    from extconf.rb:5:in `<main>'

我在某处(现在找不到指向它的链接)读到 rdiscount 无法在 Windows 上编译,因此我继续从源存储库 (git clone git://github.com/jgarber/redcloth.git 获取 RedCloth 的源代码),按照指示。

当我从给定目录尝试rake install 时,我收到缺少gem 的错误(diff-lcs 和其他),所以我使用gem install diff-lcs --version '=...' 安装它们,然后我可以开始真正的安装。

当我到达那里时,rake 失败了以下消息:

(in c:/Users/carona/Desktop/redcloth)
rake aborted!
No such file or directory - gem build c:/Users/carona/Desktop/redcloth/redcloth.gemspec 2>&1
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.8/lib/bundler/gem_helper.rb:138:in ``'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.8/lib/bundler/gem_helper.rb:138:in `block in sh_with_code'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.8/lib/bundler/gem_helper.rb:137:in `chdir'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.8/lib/bundler/gem_helper.rb:137:in `sh_with_code'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.8/lib/bundler/gem_helper.rb:129:in `sh'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.8/lib/bundler/gem_helper.rb:42:in `build_gem'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.8/lib/bundler/gem_helper.rb:53:in `install_gem'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.8/lib/bundler/gem_helper.rb:31:in `block in install'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:634:in `call'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:634:in `block in execute'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:629:in `each'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:629:in `execute'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:595:in `block in invoke_with_call_chain'
c:/Ruby192/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:581:in `invoke'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2041:in `invoke_task'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `block (2 levels) in top_level'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `each'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `block in top_level'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2013:in `top_level'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:1992:in `run'
c:/Ruby192/bin/rake:31:in `<main>'

但是,c:/Users/carona/Desktop/redcloth/redcloth.gemspec 文件确实存在,所以我不知道该怎么做。

【问题讨论】:

  • 作为额外说明,当我启动 DevKit 提供的所有 32 位可执行文件(makels 等)时,它们都会冻结。 MSYS 安装中的等效工具工作正常。
  • 您能显示 mkmf.log 吗?此外,我在我的 Windows 7 机器上成功安装了 RedCloth(和 rdiscount),安装了 ruby​​ 1.9.2p0 (2010-08-18) [i386-mingw32] 和 DevKit。
  • 感谢您的提示,我用它来查找文件的 /C/... 路径,这正确地指出我在安装 gems 时从 bash 切换到 cmd.exe

标签: ruby windows redcloth


【解决方案1】:

我将问题归结为两件事,第二件事是我的“错误”。

  1. 随 DevKit 4.5.1 分发的 MinGW 工具在 Windows 7 64 位上无法运行。他们似乎有一个旧版本的 MinGW 出现了这个问题。安装最新的 MinGW 工具并使用允许编译的工具。
  2. 我最初使用 Git Bash 运行 gem install RedCloth,这导致 Makefile 中的一些路径被转换为 /C/... 而不是 C:/。显然,g++ 和朋友无法打开任何给定的文件。从cmd.exe 运行rubygem 重新安装已解决所有问题。

我现在有一个快乐的安装。我还向 RubyInstaller 团队报告了第一个问题。

【讨论】:

  • 您好,除了Git bash假设外,其他都是错误的。 MinGW 确实在 Windows 7 x64 上工作,因为 Windows 用于生成您首先使用的安装程序 :-) 路径 /c/ 与该问题无关。你能把这个话题带到 RubyInstaller 组吗?我想查看问题的完整回溯
  • 在讨论了 RubyInstaller 邮件列表和我的测试之后,一切都开箱即用,但仅在使用 cmd.exe 时。 Git bash 将一些环境变量修改为/c/... 语法,而原生Ruby 扩展生成的Makefile 包含了这样的修改路径。使用cmd.exe 可以解决问题。
猜你喜欢
  • 2014-08-06
  • 2023-03-21
  • 2012-03-22
  • 2014-03-24
  • 1970-01-01
  • 1970-01-01
  • 2011-08-17
  • 1970-01-01
相关资源
最近更新 更多