0

我正在尝试使 Ruby 开发环境可移植,并且在本地化 DevKit 时遇到了一些问题。它安装得很好,但是当我尝试安装需要它的 gem 时(在这种情况下,wdm)。的内容mkmf.log可以在下面找到:

"gcc -o conftest.exe -IE:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/i386-mingw32 -IE:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/backward -IE:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64   -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat conftest.c  -L. -LE:/Resources/Windows/Software/Ruby/RubyPortable/lib -L.      -lmsvcrt-ruby230  -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi  "
In file included from E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby.h:33:0,
                 from conftest.c:1:
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:131:14: error: size of array 'ruby_check_sizeof_voidp' is negative
In file included from E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby.h:33:0,
                 from conftest.c:1:
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h: In function 'rb_obj_freeze_inline':
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:1360:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:1361:2: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:1362:6: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:1362:27: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h: In function 'rb_data_object_get':
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:1400:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h: In function 'rb_data_object_make':
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:1414:5: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h: In function 'rb_data_typed_object_make':
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:1421:5: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h: In function 'rb_num2char_inline':
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:1587:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:1587:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:1587:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:1587:41: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:1587:41: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:1587:41: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:1588:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:1588:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:1588:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h: In function 'rb_class_of':
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:1949:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h: In function 'rb_type':
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:1966:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
In file included from E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby.h:33:0,
                 from conftest.c:1:
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h: In function 'rb_clone_setup':
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:1997:56: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:1998:33: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:1999:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:1999:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h: In function 'rb_dup_setup':
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:2005:42: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:2006:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:2006:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h: In function 'rb_array_len':
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:2012:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:2013:2: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:2013:24: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h: In function 'rb_array_const_ptr':
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:2027:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:2027:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:2027:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h: In function 'rb_struct_len':
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:2034:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:2035:2: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:2035:26: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h: In function 'rb_struct_const_ptr':
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:2041:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:2041:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
E:/Resources/Windows/Software/Ruby/RubyPortable/include/ruby-2.3.0/ruby/ruby.h:2041:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(int argc, char **argv)
6: {
7:   return 0;
8: }

红宝石安装工作正常,我不确定是什么原因造成的。所有不需要 devkit 的 gem 都可以正常工作,但 DevKit 只是不工作......

4

1 回答 1

1

从外观上看,您要么非常接近并且已经完成了大部分工作,要么您gccPATH某个不是 DevKit 的地方,但我将解释整个过程,如果我打算这样做,我会怎么做. 注意:我不想,永远。=(

由于所有正在发生的事情,这个答案真的很密集。
换句话说,你必须真的想要完成这项工作。
不要指望在不了解发生了什么的情况下复制/粘贴代码和工作。

DevKit 使用绝对路径“安装”。如果你想改变它,你将不得不做一些非常肮脏的工作来让它发挥作用。

rb加载DevKit的文件实际上位于<ruby>/lib/ruby/site_ruby/devkit.rb假设<ruby>是根安装目录。所以你需要打开它。
注意:此文件在安装过程的不同部分加载。

然后假设devkit文件夹位置与您的文件夹位于同一位置ruby例如 E:\folderA\rubyE:\FolderA\devkit您需要将其更改为如下所示:

# enable RubyInstaller DevKit usage as a vendorable helper library
devkit_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..', 'devkit'))
msys_bin_path = File.join(devkit_root, 'bin').gsub(File::SEPARATOR, File::ALT_SEPARATOR)
mingw_bin_path = File.join(devkit_root, 'mingw', 'bin').gsub(File::SEPARATOR, File::ALT_SEPARATOR)

unless ENV['PATH'].include?(mingw_bin_path) then
  phrase = 'Temporarily enhancing PATH to include DevKit...'
  if defined?(Gem)
    Gem.ui.say(phrase) if Gem.configuration.verbose
  else
    puts phrase
  end
  puts "Prepending ENV['PATH'] to include DevKit..." if $DEBUG
  ENV['PATH'] = "#{msys_bin_path};#{mingw_bin_path};" + ENV['PATH']
end
ENV['RI_DEVKIT'] = devkit_root.gsub(File::SEPARATOR, File::ALT_SEPARATOR)
ENV['CC'] = 'gcc'
ENV['CXX'] = 'g++'
ENV['CPP'] = 'cpp'

如果位置不同,则必须更改devkit_root相对连接。
如果要确认路径存在,则可以使用realpath代替expand_path.

现在,如果所有这些看起来都相似,那么它可能与您尝试安装的 gem 中的Makefile生成有关。extconf.rb在这种情况下,你必须在 中解决这个问题,gem如果你觉得自己是慈善的,可能会打开一个 PR。但这也可能是很多其他事情出错了,所以本质上是YMMV

于 2016-09-02T05:16:00.900 回答