Ruby 未能构建本机 gem
Ruby failed to build native gem
我正在尝试使 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 的 gem 都能正常工作,但 DevKit 无法正常工作...
从外观上看,您要么非常接近并且已经完成了大部分工作,要么您的 PATH
中的 gcc
不是 DevKit,但我会解释整个过程,如果我要去的话,我会怎么做。 注意:我不想,永远。 =(
由于正在发生的所有事情,这个答案真的很密集。
换句话说,你必须真的想要完成这项工作。
不要期望 copy/paste 代码和事情在不了解发生了什么的情况下工作。
具有绝对路径的 DevKit "installs"。如果你想改变它,你必须做一些真正的肮脏的工作才能让它发挥作用。
加载 DevKit 的 rb
文件实际上位于 <ruby>/lib/ruby/site_ruby/devkit.rb
假设 <ruby>
是根安装目录。所以你需要打开它。
注意:此文件在安装过程的不同部分加载。
然后假设 devkit
文件夹位置与您的 ruby
文件夹位于同一位置,例如 E:\folderA\ruby
和 E:\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 中 extconf.rb
的 Makefile
一代有关正在尝试安装。在这种情况下,您必须在 gem
中解决这个问题,如果您愿意的话,也许可以打开一个 PR。但这也可能是很多其他事情出错的原因,所以本质上 YMMV.
我正在尝试使 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 的 gem 都能正常工作,但 DevKit 无法正常工作...
从外观上看,您要么非常接近并且已经完成了大部分工作,要么您的 PATH
中的 gcc
不是 DevKit,但我会解释整个过程,如果我要去的话,我会怎么做。 注意:我不想,永远。 =(
由于正在发生的所有事情,这个答案真的很密集。
换句话说,你必须真的想要完成这项工作。
不要期望 copy/paste 代码和事情在不了解发生了什么的情况下工作。
具有绝对路径的 DevKit "installs"。如果你想改变它,你必须做一些真正的肮脏的工作才能让它发挥作用。
加载 DevKit 的 rb
文件实际上位于 <ruby>/lib/ruby/site_ruby/devkit.rb
假设 <ruby>
是根安装目录。所以你需要打开它。
注意:此文件在安装过程的不同部分加载。
然后假设 devkit
文件夹位置与您的 ruby
文件夹位于同一位置,例如 E:\folderA\ruby
和 E:\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 中 extconf.rb
的 Makefile
一代有关正在尝试安装。在这种情况下,您必须在 gem
中解决这个问题,如果您愿意的话,也许可以打开一个 PR。但这也可能是很多其他事情出错的原因,所以本质上 YMMV.