如何在Windows上安装Ruby Gems使用MinGW进行制作和编译?

时间:2021-04-13 07:14:40

Trying to update some gems on a Windows machine and I continually get this error output for gems that do not have pre-compiled binaries:

试图更新Windows机器上的一些宝石,我不断获得没有预编译二进制文件的宝石的错误输出:

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
    --srcdir=.
    --curdir
    --ruby=c:/server/ruby/bin/ruby

These are configuration options that are provided to the extconf.rb ruby file during the installation of the gem.

这些是在安装gem期间提供给extconf.rb ruby​​文件的配置选项。

I have installed MinGW so I should have everything I need to install, make and compile these gems.
However, I do not know how to change the configuration for RubyGems so that when extconf.rb is called it includes the appropriate options pointing to the MinGW include directory.

我安装了MinGW,所以我应该拥有安装,制作和编译这些宝石所需的一切。但是,我不知道如何更改RubyGems的配置,以便在调用extconf.rb时它包含指向MinGW include目录的相应选项。

5 个解决方案

#1


3  

There's a DevKit that could well be what you're after.

有一个DevKit可能就是你想要的。

#2


1  

I don't know if this works with the native Windows Ruby, but if you use the Cygwin version and have a full Cygwin installed (compilers etc) then you shouldn't have any problems - we've been able to use a lot of gems that require compiled stuff.

我不知道这是否适用于本机Windows Ruby,但如果您使用Cygwin版本并安装了完整的Cygwin(编译器等),那么您应该没有任何问题 - 我们已经能够使用很多需要编译东西的宝石。

#3


1  

Yardboy,

Too bad you didn't mention which gem are you trying to update, you only put there the options output.

太糟糕了,你没有提到你想要更新哪个宝石,你只把那里的选项输出。

Also, some of these gems needs development headers and libraries, not just the compiler (MinGW).

此外,其中一些宝石需要开发头和库,而不仅仅是编译器(MinGW)。

Plus, MinGW is going to work as long the Ruby build you have is created with MinGW.

此外,MinGW将使用MinGW创建您的Ruby构建。

There is some work being done to ease this, but compiler, headers and library requirements are needed on all the platforms, not just Windows.

正在做一些工作来简化这一过程,但是在所有平台上都需要编译器,头文件和库需求,而不仅仅是Windows。

You can find more info and resources on my blog

您可以在我的博客上找到更多信息和资源

Cheers.

#4


0  

I had just the same problem.

我有同样的问题。

The only way I found to get gems that did not have pre-compiled binaries - such as parsetree - to run on windows was to recompile the Ruby source using Mingw as well as copy several libraries and applications from the visual c++ install I already had. What I copied included the zlib library as well as the iconv library and application.

我发现获得没有预编译二进制文件的宝石(例如parsetree)在Windows上运行的唯一方法是使用Mingw重新编译Ruby源代码,以及从我已经拥有的visual c ++安装中复制几个库和应用程序。我复制的内容包括zlib库以及iconv库和应用程序。

Note: I am using this setup as a test configuration. I would not use such a setup for production (since who knows what happens when you a library from one distribution to another).

注意:我使用此设置作为测试配置。我不会将这样的设置用于生产(因为谁知道当你从一个发行版到另一个发行版时会发生什么)。

#5


-1  

In general, in my experience, code designed for a unix system can be very hard to make work on MinGW. For a quick port, use CygWin. Or do a full port of the software to Windows host, including using native windows shell and OS API -- which is pretty darn expensive in terms of time, but it pays of if you plan to support Windows long term.

总的来说,根据我的经验,为unix系统设计的代码很难在MinGW上完成。对于快速端口,请使用CygWin。或者为Windows主机执行软件的完整端口,包括使用本机Windows shell和OS API - 这在时间上相当昂贵,但如果您计划长期支持Windows,则需要付出代价。

Not familiar with this particular software package, this is just a general observation on trying to port some other dastardly pieces of code to Windows.

不熟悉这个特定的软件包,这只是试图将一些其他卑鄙的代码移植到Windows上的一般观察。

#1


3  

There's a DevKit that could well be what you're after.

有一个DevKit可能就是你想要的。

#2


1  

I don't know if this works with the native Windows Ruby, but if you use the Cygwin version and have a full Cygwin installed (compilers etc) then you shouldn't have any problems - we've been able to use a lot of gems that require compiled stuff.

我不知道这是否适用于本机Windows Ruby,但如果您使用Cygwin版本并安装了完整的Cygwin(编译器等),那么您应该没有任何问题 - 我们已经能够使用很多需要编译东西的宝石。

#3


1  

Yardboy,

Too bad you didn't mention which gem are you trying to update, you only put there the options output.

太糟糕了,你没有提到你想要更新哪个宝石,你只把那里的选项输出。

Also, some of these gems needs development headers and libraries, not just the compiler (MinGW).

此外,其中一些宝石需要开发头和库,而不仅仅是编译器(MinGW)。

Plus, MinGW is going to work as long the Ruby build you have is created with MinGW.

此外,MinGW将使用MinGW创建您的Ruby构建。

There is some work being done to ease this, but compiler, headers and library requirements are needed on all the platforms, not just Windows.

正在做一些工作来简化这一过程,但是在所有平台上都需要编译器,头文件和库需求,而不仅仅是Windows。

You can find more info and resources on my blog

您可以在我的博客上找到更多信息和资源

Cheers.

#4


0  

I had just the same problem.

我有同样的问题。

The only way I found to get gems that did not have pre-compiled binaries - such as parsetree - to run on windows was to recompile the Ruby source using Mingw as well as copy several libraries and applications from the visual c++ install I already had. What I copied included the zlib library as well as the iconv library and application.

我发现获得没有预编译二进制文件的宝石(例如parsetree)在Windows上运行的唯一方法是使用Mingw重新编译Ruby源代码,以及从我已经拥有的visual c ++安装中复制几个库和应用程序。我复制的内容包括zlib库以及iconv库和应用程序。

Note: I am using this setup as a test configuration. I would not use such a setup for production (since who knows what happens when you a library from one distribution to another).

注意:我使用此设置作为测试配置。我不会将这样的设置用于生产(因为谁知道当你从一个发行版到另一个发行版时会发生什么)。

#5


-1  

In general, in my experience, code designed for a unix system can be very hard to make work on MinGW. For a quick port, use CygWin. Or do a full port of the software to Windows host, including using native windows shell and OS API -- which is pretty darn expensive in terms of time, but it pays of if you plan to support Windows long term.

总的来说,根据我的经验,为unix系统设计的代码很难在MinGW上完成。对于快速端口,请使用CygWin。或者为Windows主机执行软件的完整端口,包括使用本机Windows shell和OS API - 这在时间上相当昂贵,但如果您计划长期支持Windows,则需要付出代价。

Not familiar with this particular software package, this is just a general observation on trying to port some other dastardly pieces of code to Windows.

不熟悉这个特定的软件包,这只是试图将一些其他卑鄙的代码移植到Windows上的一般观察。