Building a debug version of the Ruby interpreter on Windows/MSYS2

72 views
Skip to first unread message

Stephan Mühlstrasser

unread,
Sep 30, 2020, 6:45:44 AM9/30/20
to RubyInstaller
Hi,

originally I had asked my question on the ruby-talk mailing list, and there it was pointed out that the RubyInstaller list might be a better place to get an answer:


So I will repeat the question here:

How can I build Ruby on Windows with MSYS2 so that I can modify and debug the interpreter? I read the instructions in the Ruby GitHub repository about building Ruby, and I tried the build using autoconf, configure and make, and this fails with the following error:

compiling cont.c
In file included from cont.c:19:
coroutine/ucontext/Context.h:12:10: fatal error: ucontext.h: No such file or directory
   12 | #include <ucontext.h>
      |          ^~~~~~~~~~~~

This happens on Windows 10 version 2004 in a bash shell started from the MSYS2 environment that came with Ruby 2.7.1.

$ ruby --version
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x64-mingw32]
 $ gem --version
3.1.2

I attached the 'config.log' output, compressed with gzip.

I then made an attempt to build Ruby with rubyinstaller2 from https://github.com/oneclick/rubyinstaller2. This apparently does work because it produces an installable package, but it is unclear how I could use this build system to get a debuggable Ruby installation where I also can make modification to the sources.

The background is that I need to analyze a problem with a gem that embeds a C library and also curl for HTTP transfers. We wrap this C library including curl for several programming languages, and only in the context of Ruby on Windows there is a problem with network transfers via curl. So the current hypothesis is that there is some interaction between the Ruby interpreter and the embedded curl library that causes these problems. 

Thanks
Stephan
config.log.gz

Stephan Mühlstrasser

unread,
Sep 30, 2020, 11:39:26 PM9/30/20
to RubyInstaller
Stephan Mühlstrasser schrieb am Mittwoch, 30. September 2020 um 12:45:44 UTC+2:

How can I build Ruby on Windows with MSYS2 so that I can modify and debug the interpreter? I read the instructions in the Ruby GitHub repository about building Ruby, and I tried the build using autoconf, configure and make, and this fails with the following error:

compiling cont.c
In file included from cont.c:19:
coroutine/ucontext/Context.h:12:10: fatal error: ucontext.h: No such file or directory
   12 | #include <ucontext.h>
      |          ^~~~~~~~~~~~


I switched now to Ruby 2.6.6, and with that I was now able to build Ruby from source using the Git tag "v2_6_6". It is unclear why the same steps didn't work with the Ruby 2.7.1 source...

Best regards
Stephan
Reply all
Reply to author
Forward
0 new messages