尝试使用MSYS2在Windows上编译Ruby 2.4.2,但无济于事...... 在./configure并在终端输入make后,这是我收到的错误消息:
qnexus@quad MSYS ~/dev/ruby-2.4.2
$ make
CC = gcc
LD = ld
LDSHARED = ld
CFLAGS = -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wno-maybe-uninitialized -std=gnu99
XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidden -fexcess-precision=standard -DRUBY_EXPORT -fPIE
CPPFLAGS = -I. -I.ext/include/i686-msys -I./include -I. -I./enc/unicode/9.0.0
DLDFLAGS = -fstack-protector -pie
SOLIBS =
gcc (GCC) 6.3.0
...
compiling ruby.c
ruby.c: In function ‘push_include_cygwin’:
ruby.c:320:2: error: #error no cygwin_conv_path
#error no cygwin_conv_path
^~~~~
...
make: *** [Makefile:365: ruby.o] Error 1
以下是ruby.c文件中的C函数,其中编译器生成此错误:
static void
push_include_cygwin(const char *path, VALUE (*filter)(VALUE))
{
const char *p, *s;
char rubylib[FILENAME_MAX];
VALUE buf = 0;
p = path;
while (*p) {
unsigned int len;
while (*p == ';')
p++;
if (!*p) break;
for (s = p; *s && *s != ';'; s = CharNext(s));
len = s - p;
if (*s) {
if (!buf) {
buf = rb_str_new(p, len);
p = RSTRING_PTR(buf);
}
else {
rb_str_resize(buf, len);
p = strncpy(RSTRING_PTR(buf), p, len);
}
}
#ifdef HAVE_CYGWIN_CONV_PATH
#define CONV_TO_POSIX_PATH(p, lib) \
cygwin_conv_path(CCP_WIN_A_TO_POSIX|CCP_RELATIVE, (p), (lib), sizeof(lib))
#else
# error no cygwin_conv_path
#endif
if (CONV_TO_POSIX_PATH(p, rubylib) == 0)
p = rubylib;
push_include(p, filter);
if (!*s) break;
p = s + 1;
}
}
使用安装了开发工具的MSYS2:
pacman -S - 需要base-devel msys2-devel
我想编译ruby然后在Windows上安装rails。
如何配置make以便在Windows上使用MSYS2进行编译? 有没有一步一步的指导如何在Windows上用MSYS2编译ruby?