How to compile correctly ruby interpreter

Usually we compile the source code from a ruby interpreter, encounter problems can not find some C extensions. Here I record these issues from the source code compiler ruby interpreter encountered and how to solve these problems.

Compile a ruby interpreter is actually very simple, just need to extract the ruby code to open and then into the extracted directory, to compile the interpreter, execute the compiler command:

./configure --prefix = / usr / local / ruby
the make
the make the Test

and then compile extension library, because c extensions present in the system need to rely on some of the c library, so if the system does not have the c library, then the compiler ruby interpreter when it will
skip some ruby extension library compilation and installation. Such as zlib extension libraries, we need c expanded library support.

1, after the completion of the translation, whether it contains zlib, etc. c extensions?
A: Not necessarily, if the system has been dependent on the c library, it will automatically compile and install the compiler interpreter when otherwise necessary to extra c compiler extensions.
Install c library (download from http://www.zlib.net/zlib-1.2.3.tar.gz, make, make install),
and then to the next ext directory, make, make install.

For the curses is the same given, from http://ftp.gnu.org/pub/gnu/ncurses/ download, install APT-GET G ++,
the make, the make install, Ruby extconf.rb, the make, the make install.

Mysql extension with respect to the mounting gem, need ruby extconf.rb --with-mysql-dir = / usr / local / mysql / mysql to specify the installation path.
Then make, make install can be.
Published 46 original articles · won praise 7 · views 80000 +

Guess you like

Origin blog.csdn.net/yangbo_hr/article/details/1968030