Development of LL languages such as Ruby / Python can be started easily, and many convenient libraries (formally modules, so the following modules) have been developed. For example, the following is an example.
Ruby module: Nokogiri
Usage example: http://shgam.hatenadiary.jp/entry/2013/11/09/192509
Python module: NumPy
Example of use: http://qiita.com/wellflat/items/284ecc4116208d155e01
By using such a module, development is possible in a short time. However, unlike the ease of getting started with the LL language, I think that the introduction of modules is not easy to compliment. I often get an error when installing a module and look for a solution based on that message. Even if a solution is found, there are often cases where "I don't know, but somehow this has fixed it", and such information alone cannot be applied.
Module installation is basically a simple task, so it's easy once you get used to it. However, there seems to be no cohesive information to be able to solve the problem on my own, so I will record it.
OS: * nix system Language: Ruby / Python Reader: Anyone who has installed Ruby or Python and started writing programs
The purpose of this post is to document the basic knowledge of module installation in Ruby / Python and how to deal with possible troubles in the future.
As the reader knows, the module is loaded in the source code as follows.
(Example 1)
Ruby:
require "some_module"
Python:
import "somemodule"
The module is loaded in this way, but it can be divided into the following two patterns for explanation depending on the file actually loaded.
In this case, the file loaded in (Example 1) is in the module search target directory. Ruby: some_module.rb Python: somemodule.py is. If you haven't loaded any additional modules other than the standard library in these files, that file completes the dependency. It's plain Ruby / Python code, so as you can imagine, it's very easy to install.
In this case, the file loaded in (Example 1) is also in the module search target directory. Ruby: some_module.so Python: somemodule.so is. This is the module that is easy to trip over during installation.
This file is (essentially) a program compiled in C or C ++. Therefore, in order to use such an extension module, it is necessary to compile the C or C ++ source code during the installation process. Of course, it is not necessary if the compiled file (binary) is provided. However, there are not many cases provided, and most of the time you need to compile.
In other words, solving problems and dependencies that occur during compilation during installation is the solution to Ruby / Python module installation problems.
I'd like to summarize the solution briefly, but in order to solve it on my own, I would like to summarize where the problems at module compilation occur and where the dependencies occur.
(2014.06.17) The content of "Module type" was added.
Recommended Posts