【问题标题】:Installing Typhoeus on Ruby on Rails on windows xp (32 bit)在 windows xp(32 位)上的 Ruby on Rails 上安装 Typhoeus
【发布时间】:2011-05-19 16:29:23
【问题描述】:

我一直在尝试在我的“Ruby on Rails”应用程序上做一些简单的“rails 服务器”,但是我正在和我的一个使用 linux 的朋友一起工作,我坐在 windows xp(32 位) 一切都很顺利,他实现了名为“curl”和“typhoeus”的 gem,所以为了让我在 localhost:3000 上查看它,我还必须安装 gems。


所以这就是我写的:


D:\>gem install typhoeus
Building native extensions.  This could take a while...
ERROR:  Error installing typhoeus:
        ERROR: Failed to build gem native extension.

C:/Ruby187/bin/ruby.exe extconf.rb
checking for curl/curl.h in C:/Ruby187/lib/ruby/gems/1.8/gems/typhoeus-0.2.4/cro
ss/curl-7.19.4.win32/include... no
need libcurl
*** 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:/Ruby187/bin/ruby


Gem files will remain installed in C:/Ruby187/lib/ruby/gems/1.8/gems/typhoeus-0.
2.4 for inspection.
Results logged to C:/Ruby187/lib/ruby/gems/1.8/gems/typhoeus-0.2.4/ext/typhoeus/
gem_make.out


是的,它看起来不那么漂亮,但显然它要求一个名为“libcurl”的东西,所以我从互联网上下载了适用于 windows xp 32bit 的 curl 版本,我将 exefile 和所有 dll 文件放在 windows 文件夹中.我试图简单地写“curl”来看看它是否有效。这就是我得到的:

D:\>curl
curl: try 'curl --help' or 'curl --manual' for more information

我又写了 gem install typhoeus ,我得到了和上面一样的错误,我错过了什么? libcurl 不附带 curl 吗?我急需帮助,因为我的朋友无法帮助我,因为他是 linux 专家。所以请帮助我 - 告诉我安装 typhoeus 必须做什么! (我也尝试编写 gem install typhoeus-0.2.4 但这抛出了一些其他错误:

ERROR:  Could not find a valid gem 'typhoeus-0.2.4' (>= 0) in any repository

)

我是在 ruby​​ on rails 应用程序的文件夹中写的。所以我迷路了,非常需要帮助!

提前致谢,
哈利

【问题讨论】:

    标签: ruby-on-rails curl libcurl


    【解决方案1】:

    我在 Windows 7 上遇到了类似的问题,问题是 Windows 机器的 extconf.rb 文件中的一些逻辑。以下几行是导致need libcurl 错误消息的原因:

    if Config::CONFIG['target_os'] == 'mingw32'
      header = File.join(ROOT, 'cross', 'curl-7.19.4.win32', 'include')
      unless find_header('curl/curl.h', header)
        abort "need libcurl"
      end
    

    File.join 调用会导致 makefile 查找不包含在 typhoeus 中的目录 (cross/curl-7.19.4.win32/include),因此 makefile 将无法工作。

    我一天中的大部分时间都在网上查看了很多解决方案(this link 帮助最大),最后通过简单地更改File.join() 为我的使用显式文件路径找到了解决方法卷曲宝石。我两次编辑了 extconf.rb 文件,一次在这里:

    if Config::CONFIG['target_os'] == 'mingw32'
      header = File.join('C:\RailsInstaller\Ruby1.9.2\lib\ruby\gems\1.9.1\gems\curl-7.19.4-devel-mingw32', 'include')
      unless find_header('curl/curl.h', header)
        abort "need libcurl"
      end
    

    曾经在这里:

    if Config::CONFIG['target_os'] == 'mingw32'
      find_library('curl', 'curl_easy_init',
                   File.join('C:\RailsInstaller\Ruby1.9.2\lib\ruby\gems\1.9.1\gems\curl-7.19.4-devel-mingw32', 'bin'))
    

    我相信您可能需要安装 DevKit,但我不确定。

    希望这会有所帮助!

    【讨论】:

      【解决方案2】:

      请试试这个分叉:https://github.com/NoKarma/typhoeus/downloads 我在网上找到了不同的解决方案,但只有这个有效。也许有一天他们会最终修复它以在 Windows 下编译。

      【讨论】:

        【解决方案3】:

        RocketR 提供的下载与最新版本的 Typhoeus (0.2.4) 不兼容。 GitHub 上的这条评论为我提供了解决方案 (https://github.com/dbalatero/typhoeus/issues/11#issuecomment-309957)

        less involved workaround for typhoeus
        0.1.29 on ruby 1.9.1 -- just give it what it wants.
        
        ----------- checking for curl/curl.h in C:/path/to/ruby/gems/1.9.1/gems/typhoeus-0.1.29/cross/curl-7.19.4.win32/include... no need libcurl
        -----------
        
        download: http://www.gknw.de/mirror/curl/win32/old_releases/curl-7.19.4-devel-mingw32.zip
        
        mkdir C:/path/to/ruby/gems/1.9.1/gems/typhoeus-0.1.29/cross, extract, rename to curl-7.19.4.win32
        
        gem install typhoeus, as you would normally.
        

        【讨论】:

          【解决方案4】:

          这在 windows vista/7 上的 Ruby193 中不再是问题。 只需安装 typhoeus

          gem 安装 typhoeus

          这在我的 vista 电脑上没有错误。

          确保您可以在任何地方运行 curl.exe,方法是将其放置在不带空格且位置位于用户或系统路径中的路径中。

          在你的脚本中加入 typhoeus 就完成了。

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2015-09-14
            • 1970-01-01
            • 2015-07-03
            • 1970-01-01
            • 2014-10-14
            • 1970-01-01
            • 1970-01-01
            • 2014-08-29
            相关资源
            最近更新 更多