我正在尝试使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: }
ruby安装工作正常,我不确定是什么原因造成的。所有不需要devkit工作的宝石,但devkit只是不工作…
从事物的外观来看,您要么非常接近并且已经完成了大部分工作,或者您在PATH
中有gcc
,这不是DevKit,但我将解释整个过程,如果我要这样做,我会如何做到这一点。注意:我不想,永远。= (
这个答案非常密集,因为所有正在发生的事情。
换句话说,你必须真的想让它工作。
DevKit使用绝对路径"安装"。如果你想改变它,你将不得不做一些真正的肮脏的工作使它工作。
加载DevKit的rb
文件实际上位于<ruby>/lib/ruby/site_ruby/devkit.rb
,假设<ruby>
是根安装目录。所以你需要打开它。
然后假设devkit
文件夹位置与ruby
文件夹位置相同,例如: E:folderAruby
和E:FolderAdevkit
你需要改变它看起来像这样:
# 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中的extconf.rb
生成的Makefile
有关。在这种情况下,你必须在gem
中修复这个问题,如果你觉得慈善的话,可能会打开一个PR。但也可能是其他很多地方出了问题,所以本质上是YMMV