Method of compiling and installing from ruby source code under win7

Time:2021-11-4

Ruby C API needs to be embedded in C + + code, but the compilation fails in vs project, so now find the reason by manually compiling Ruby from the source code (previously installed with rubyinstaller).

First download Ruby Version 2.4.1 from the official website, https://www.ruby-lang.org/en/downloads/

As can be seen from the installation instructions, the official only provides the compilation and installation steps under the Linux platform, https://www.ruby-lang.org/en/documentation/installation/#building -from-source

The operations performed under windows are slightly different, as described below:

1. Enter the downloaded Ruby root directory and execute Win32 \ configure.bat i686-mswin32

2. Implement nmake

3. Execute nmake rubyw.exe

4. Execute namke test to check whether it passes the test

After execution, the ruby executable file has been generated and needs to be installed to the target path, assuming C: \ opt \ ruby. Execute the following command:

5.nmake DESTDIR=C:\opt\ruby install

After execution, add C: \ opt \ ruby \ bin to the path variable to complete the compilation and installation of ruby.

The above method of compiling and installing from ruby source code under win7 is all the content shared by Xiaobian. I hope it can give you a reference and support developepper.