Install error in win

when i install jekyll in win, i meet the following error, dose anyone have idea to solve it?

C:\Users__hao>gem install jekyll
Temporarily enhancing PATH for MSYS/MINGW…
Building native extensions. This could take a while…
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.

current directory: D:/ruby/Ruby26-x64/lib/ruby/gems/2.6.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser

D:/ruby/Ruby26-x64/bin/ruby.exe -I D:/ruby/Ruby26-x64/lib/ruby/site_ruby/2.6.0 -r ./siteconf20191216-12868-1ul5dum.rb extconf.rb
creating Makefile

current directory: D:/ruby/Ruby26-x64/lib/ruby/gems/2.6.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
make “DESTDIR=” clean

current directory: D:/ruby/Ruby26-x64/lib/ruby/gems/2.6.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
make “DESTDIR=”
generating ruby_http_parser-x64-mingw32.def
compiling ruby_http_parser.c
In file included from D:/ruby/Ruby26-x64/msys64/mingw64/x86_64-w64-mingw32/include/crtdefs.h:10,
from D:/ruby/Ruby26-x64/msys64/mingw64/x86_64-w64-mingw32/include/stddef.h:7,
from D:/ruby/Ruby26-x64/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/9.2.0/include/stddef.h:1,
from D:\mingw\include/stdio.h:69,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby/defines.h:123,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby/ruby.h:29,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby.h:33,
from ruby_http_parser.c:1:
D:/ruby/Ruby26-x64/msys64/mingw64/x86_64-w64-mingw32/include/corecrt.h:40:18: error: expected ‘;’ before ‘typedef’
40 | __MINGW_EXTENSION typedef unsigned __int64 size_t;
| ^~~~~~~~
| ;
D:/ruby/Ruby26-x64/msys64/mingw64/x86_64-w64-mingw32/include/corecrt.h:50:18: error: expected ‘;’ before ‘typedef’
50 | __MINGW_EXTENSION typedef __int64 ssize_t;
| ^~~~~~~~
| ;
D:/ruby/Ruby26-x64/msys64/mingw64/x86_64-w64-mingw32/include/corecrt.h:67:18: error: expected ‘;’ before ‘typedef’
67 | __MINGW_EXTENSION typedef __int64 intptr_t;
| ^~~~~~~~
| ;
D:/ruby/Ruby26-x64/msys64/mingw64/x86_64-w64-mingw32/include/corecrt.h:80:18: error: expected ‘;’ before ‘typedef’
80 | __MINGW_EXTENSION typedef unsigned __int64 uintptr_t;
| ^~~~~~~~
| ;
D:/ruby/Ruby26-x64/msys64/mingw64/x86_64-w64-mingw32/include/corecrt.h:93:18: error: expected ‘;’ before ‘typedef’
93 | __MINGW_EXTENSION typedef __int64 ptrdiff_t;
| ^~~~~~~~
| ;
D:/ruby/Ruby26-x64/msys64/mingw64/x86_64-w64-mingw32/include/corecrt.h:128:18: error: expected ‘;’ before ‘typedef’
128 | __MINGW_EXTENSION typedef __int64 __time64_t;
| ^~~~~~~~
| ;
In file included from D:\mingw\include/stdio.h:94,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby/defines.h:123,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby/ruby.h:29,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby.h:33,
from ruby_http_parser.c:1:
D:\mingw\include/sys/types.h:123:21: error: conflicting types for ‘ssize_t’
123 | typedef _ssize_t ssize_t;
| ^~~~~~~
In file included from D:/ruby/Ruby26-x64/msys64/mingw64/x86_64-w64-mingw32/include/crtdefs.h:10,
from D:/ruby/Ruby26-x64/msys64/mingw64/x86_64-w64-mingw32/include/stddef.h:7,
from D:/ruby/Ruby26-x64/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/9.2.0/include/stddef.h:1,
from D:\mingw\include/stdio.h:69,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby/defines.h:123,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby/ruby.h:29,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby.h:33,
from ruby_http_parser.c:1:
D:/ruby/Ruby26-x64/msys64/mingw64/x86_64-w64-mingw32/include/corecrt.h:50:35: note: previous declaration of ‘ssize_t’ was here
50 | __MINGW_EXTENSION typedef __int64 ssize_t;
| ^~~~~~~
In file included from D:\mingw\include/stdio.h:541,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby/defines.h:123,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby/ruby.h:29,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby.h:33,
from ruby_http_parser.c:1:
D:\mingw\include/locale.h:51:42: error: conflicting types for ‘_locale_t’
51 | typedef struct __mingw_opaque_locale_t *_locale_t;
| ^~~~~~~~~
In file included from D:/ruby/Ruby26-x64/msys64/mingw64/x86_64-w64-mingw32/include/crtdefs.h:10,
from D:/ruby/Ruby26-x64/msys64/mingw64/x86_64-w64-mingw32/include/stddef.h:7,
from D:/ruby/Ruby26-x64/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/9.2.0/include/stddef.h:1,
from D:\mingw\include/stdio.h:69,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby/defines.h:123,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby/ruby.h:29,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby.h:33,
from ruby_http_parser.c:1:
D:/ruby/Ruby26-x64/msys64/mingw64/x86_64-w64-mingw32/include/corecrt.h:444:20: note: previous declaration of ‘_locale_t’ was here
444 | } _locale_tstruct,*_locale_t;
| ^~~~~~~~~
In file included from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby/defines.h:125,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby/ruby.h:29,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby.h:33,
from ruby_http_parser.c:1:
D:\mingw\include/sys/types.h:149:23: error: conflicting types for ‘time_t’
149 | typedef __time32_t time_t;
| ^~~~~~
In file included from D:/ruby/Ruby26-x64/msys64/mingw64/x86_64-w64-mingw32/include/crtdefs.h:10,
from D:/ruby/Ruby26-x64/msys64/mingw64/x86_64-w64-mingw32/include/stddef.h:7,
from D:/ruby/Ruby26-x64/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/9.2.0/include/stddef.h:1,
from D:\mingw\include/stdio.h:69,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby/defines.h:123,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby/ruby.h:29,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby.h:33,
from ruby_http_parser.c:1:
D:/ruby/Ruby26-x64/msys64/mingw64/x86_64-w64-mingw32/include/corecrt.h:143:20: note: previous declaration of ‘time_t’ was here
143 | typedef __time64_t time_t;
| ^~~~~~
In file included from D:\mingw\include/windef.h:269,
from D:\mingw\include/windows.h:42,
from D:\mingw\include/winsock.h:52,
from D:\mingw\include/winsock2.h:62,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby/win32.h:41,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby/defines.h:345,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby/ruby.h:29,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby.h:33,
from ruby_http_parser.c:1:
D:\mingw\include/winnt.h:2434:2: error: #error “undefined processor type”
2434 | #error “undefined processor type”
| ^~~~~
D:\mingw\include/winnt.h:2436:9: error: unknown type name ‘CONTEXT’
2436 | typedef CONTEXT *PCONTEXT, *LPCONTEXT;
| ^~~~~~~
In file included from D:\mingw\include/windows.h:44,
from D:\mingw\include/winsock.h:52,
from D:\mingw\include/winsock2.h:62,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby/win32.h:41,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby/defines.h:345,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby/ruby.h:29,
from D:/ruby/Ruby26-x64/include/ruby-2.6.0/ruby.h:33,
from ruby_http_parser.c:1:
D:\mingw\include/winbase.h:2389:56: error: unknown type name ‘CONTEXT’
2389 | WINBASEAPI BOOL WINAPI SetThreadContext (HANDLE, const CONTEXT *);
| ^~~~~~~
make: *** [Makefile:244锛歳uby_http_parser.o] 閿欒� 1

make failed, exit code 2

Gem files will remain installed in D:/ruby/Ruby26-x64/lib/ruby/gems/2.6.0/gems/http_parser.rb-0.6.0 for inspection.
Results logged to D:/ruby/Ruby26-x64/lib/ruby/gems/2.6.0/extensions/x64-mingw32/2.6.0/http_parser.rb-0.6.0/gem_make.out

You should have installed ridk when installing Ruby.
Enable it for current terminal window by running:

ridk enable

If you didn’t install the program, try installing it by:

ridk install

If that fails, you may need to re-install Ruby and ensure that you run ridk install as the final step of installing.
Then retry installing jekyll:

gem install jekyll

hi ashmaroli, i try your solution, but it don’t work.
i also try to re-install Ruby, and it still error.

there are three option when i use
ridk install
and i input
1,2,3
is it right?

1 - MSYS2 base installation
2 - MSYS2 system update (optional)
3 - MSYS2 and MINGW development toolchain

I’m still puzzling through this myself, but this guide seems helpful. TL;DR looks like installing the Chocolatey packet manager first is a must.

Hope this helps