Tuesday, January 19, 2010

Install Ruby 1.9.1 p378 on Windows using MinGW #1

In previous post, I install Ruby 1.9.1 p243 using MinGW one-click installer. And now, ruby 1.9.1 p378 was released. So I try to build and install ruby 1.9.1 p378 for windows with MinGW by myself.

At first, I try to build with same approach as in Linux.
Youhei@3935-CF61 ~ $ tar -jxvf ruby-1.9.1-p378.tar.bz2
Youhei@3935-CF61 ~ $ cd ruby-1.9.1-p378
Youhei@3935-CF61 ~/ruby-1.9.1-p378 $ ./configure --prefix=/opt/ruby-1.9.1 --enable-shared
Youhei@3935-CF61 ~/ruby-1.9.1-p378 $ make
But error like below occured in make process.
In file included from ../ruby_1_9/signal.c:531:
C:\Qt\2009.05\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../mingw32/include/pthread.h:307:
error: redefinition of 'struct timespec'

Similar error has already reported in ruby-core mailing list(23577, 23578).
It's the reason that struct timespec definition is duplicated at include/ruby/missing.h and C:\Qt\2009.05\mingw\mingw32\include\pthread.h
include/ruby/missing.h
#if !defined(HAVE_STRUCT_TIMESPEC)
struct timespec {
time_t tv_sec; /* seconds */
long tv_nsec; /* nanoseconds */
};
#endif
C:\Qt\2009.05\mingw\mingw32\include\pthread.h
#ifndef HAVE_STRUCT_TIMESPEC
#define HAVE_STRUCT_TIMESPEC 1
struct timespec {
long tv_sec;
long tv_nsec;
};
#endif /* HAVE_STRUCT_TIMESPEC */
So I replace struct timespec definition in include/ruby/missing.h with one in C:\Qt\2009.05\mingw\mingw32\include\pthread.h, then I retry to build. Error of struct timespec definition has been solved, but another error occured. to be continued...

1 comment:

Roger Pack said...

so which one is right?
Thanks!
-rp

Post a Comment