Installing the source code on a Linux system GTK + 2.0

Source: Internet
Author: User
Tags bz2 cairo gettext gtk new set

Installing the source code on a Linux system GTK + 2.0
==================================================
keywords:gtk+, Install, Linux, Source
Author:whyglinux (whyglinux at Hotmail DOT com)
date:2007-01-07
==================================================
Directory
0. Preface
1.
Binary installation and source installation
2.
GTK + Dependent Packages
3.
View the version number of the software
4. Installation Planning
4.1 GTK + is not installed on the system
4.2 GTK + installed on the system
5. Software download
6. Installation of the Library
6.1 Installation Sequence
6.2 Installation Process
6.2.1 Unpacking
6.2.2 Configuration
6.2.3 Construction
6.2.4 Installation
6.2.5 settings
6.2.5.1 Search Path
6.2.5.2 Compile and connect interface
6.2.5.3 Pkg-config
6.2.5.4 GTK + and its dependent library settings
6.2.5.4.1 settings for compilation and connection purposes
6.2.5.4.2 settings for the purpose of connection and execution
6.3 Installation of other libraries
6.3.1 Installation ATK
6.3.2 Installation Cairo
6.3.3 Installation Pango
6.3.4 Installing GTK +
7. Use of libraries
7.1 Settings prior to library use
7.2 Library Documentation
0. Preface
GTK + 2.0 relies on a number of packages (Programs and libraries) that are more frequently updated, so if you want to build a newer or latest version from the source package provided by GTK +
GTK +
Library, it is often necessary to first update or install a new set of dependent programs or libraries. At the same time, due to the dependencies between the software packages, the package version and installation order have certain requirements, a
You also need to make some necessary settings for the library after installation to use the library. Thus, it can be said that the source code to install GTK + is a very small project. If there is no source code to install GTK +
Experience, it is easy to encounter some problems during the installation process. For beginners, there are installation problems that often do not know how to solve.
This article tries to provide a set of feasible solutions for the source code installation of GTK +, introduces some background knowledge of installing and using the library, and emphasizes the problems in the installation process so that the installation process can be carried out smoothly. This way, even a novice who has never installed GTK + can successfully install GTK + as described here.
1. Binary installation and source installation
The first thing to note is that for Linux systems, especially newer versions of Linux, the release version already contains GTK +
And all supporting software, you can use GTK + directly after installing it by default. If you do not choose to install GTK + at the time of installation, you can also use the system-provided installation tools to
Add GTK + to the system, or download the compiled GTK + version upgrade.
The installation method above uses a compiled package. Since this installation generally automatically resolves dependencies between individual packages, and then installs or updates the corresponding packages, the installation
, the installation of binary packages saves the time required to compile code, avoids the cumbersome and error-prone source installation, and is less demanding for installers, so it is the preferred way to install GTK +.
Binary installation is quick and easy, but it also has its grasp: typically a software binary package version is updated to lag behind its latest version, and some software may not be available as a binary package. So, to use
The latest version is likely the source installation is the only way to choose. Sometimes people also want to experience or learn GTK +
The source of the installation, after all, in the open-source era today, the programmer for the source of the installation is also necessary to pass.
2. GTK + Dependent Packages
GTK + installation requires support for the following programs or libraries (each package can be found in the listed links):

    The
    • C compiler, such as GCC. GCC website)

    • X Window System library (website)

    • Pkg-config Tools (website)

    • GNU make tools (website)

    • JPEG, PNG, and TIFF graphics libraries (dependencies directory in GTK + Source for download pages)

    • FreeType (website)

    • Fontconfig Library (website)

    • GNU Libiconv Library (required when there is no iconv () function on the System) (website)

    • GN U GetText Package (required when there is no GetText () function on the System) ([url=http://www.gnu.org/software/gettext/website [/url])

    • GLib Library (download page GLib source)

    • ATK Library (dependencies directory in GTK + Source of download page)

    • Cairo Library (Download page Dependencies directory in GTK + source for polygons

    • Pango library (download page Pango Source)

    • GTK + library (download page GTK + Source)


At the moment (when writing this article) the latest GTK + is the 2.10.6 version, which we'll take as an example. When you see this article, there may be a new version of GTK +, so be careful to download and install the new version of the package.
Among them, the above 1~9 are some of the more general software, and GTK + relationship is not so close-they are not only used by GTK +, but also by other programs or libraries to use. Even if GTK + is not installed on the system, they may already exist in the system.
10~13 items are closely related to GTK + and are updated quickly, and typically a GTK + version relies on some specific versions of these libraries. For these reasons, it is explained in this article
When GTK + installs, it is considered that the 1~9 item is already installed, so only the installation of the 10~14 item is involved. In other words, the installation of GTK + is essentially
Installation of the five Libraries GLib, ATK, Cairo, Pango, and GTK +.
Of course, there may be no installation in your system 1~9, or there may be a version too low to make GTK +
Conditions that cannot be installed successfully. When these conditions are encountered, the software should be installed or upgraded by reference to the installation instructions in their respective websites. Can be installed directly using the binary package, you can also use the source code mode
Mount The installation of these software in this article will no longer be described.
According to experience, as long as the system has 1~9, and the system is also newer, in order to install GTK + generally there is no need to upgrade them to the latest version, in addition to the
Pkg-config tools. Pkg-config changes, the new version of the GTK + installation requires new Pkg-config
May cause the installation process to fail. Therefore, to check for pkg-config before installing GTK +
The version number. If the version is too low, be sure to update it. As for the minimum version requirement for pkg-config at GTK + installation, you can download the directory in GTK +
Locate the corresponding Pkg-config package in the dependencies directory and obtain confirmation from the version information provided on the package.
3. View the version number of the software
There are two purposes for viewing the version number of the installed software:

    • Check if the software exists

    • Obtain the version number of the software, which can be used to understand the new and old software, is to determine whether the software needs to update the basis


Packages can be broadly divided into two types: programs and libraries. Different types, you can view the version number in different ways.
For a program command that can be run, the way to view the version number is to add the--version parameter after the command is executed. For example, for Pkg-config, the process is this:
$ pkg-config--version
The "$" symbol above indicates a command line prompt.
Note: You should now perform the above command to view the version number of the Pkg-config and check if the minimum version requirements for installing the appropriate GTK + are met as described above. If not, you should first install and update pkg-config before you install the following GTK + and its dependent libraries.
For a library, if it supports the use of pkg-config, you can use Pkg-config to view its version number. For example, for GTK + 2.0 libraries, you can:
$ pkg-config--modversion gtk+-2.0
Note: You may wish to execute the above command to see if the GTK + library is already present in the system, and if it already exists, note its version number. You can also view the compile and connect options when using the GTK + library by executing the following command:
$ pkg-config--cflags--libs gtk+-2.0
By displaying the information in the following path, you can generally know where GTK + and its dependent libraries are installed. See if they are all in the/usr directory.
4. Installation Planning
4.1 GTK + is not installed on the system
With the above check, if you find that GTK + is not installed on your system, the problem becomes simple: Install GTK + and its dependent libraries directly to/usr
Directory (as for how to set the installation directory of each library to/USR, see the installation instructions below). The advantage of this is that because/usr
is the system directory, which requires almost no setup of the installed libraries to be able to use them immediately.
/usr is an important system directory and should be avoided in writing to this directory as much as possible. Therefore, it is recommended to install the source code GTK + do not install it in/USR or other system directory, you can select another directory (see the relevant instructions below).
4.2 GTK + installed on the system
If you have GTK + installed on your system, there are a number of issues to consider when installing a new version of GTK +. Many of the software used on Linux systems are in GTK +
Supported by libraries (such as the GNOME desktop). If the relevant GTK +
Library is damaged, or the version of the library has changed, slightly can cause some programs do not work properly, serious may cause the system to run obstacles (such as access to the desktop environment, and so on. )
As a result, the installation of the new version of GTK + should avoid having an impact on the original GTK + to ensure proper operation of the system. This is easy to do: the new GTK +
installation directory to avoid the same as the existing GTK + directory. For example, if the previous version of GTK + is installed in the/usr directory, the new GTK +
When setting up the installation directory, it is best not to set to/usr.
Some people are not aware of these situations, or the diagram is convenient, the GTK + is installed directly in the/USR to replace the original GTK + library. Because GTK +
and its compatibility library versions, as well as errors that may occur during installation, it is easy to get the problem mentioned above, so it is recommended that you avoid the older version of GTK + when installing the new version of GTK +
The directory where you are located.
What directory does GTK + install as well? In fact, this is not conclusive, you can set the installation directory. However, the default installation directory for the generic source software package is
/usr/local, so you can set this directory to the installation directory of GTK +, or to other directories that you think are appropriate. In the following example installation, the installation directory that we use is
Both the/opt/gtk,gtk+ and its dependent libraries will be installed in this directory.
Installing GTK + and its dependent library settings into the same directory (such as/OPT/GTK), instead of each library occupying a different directory, can be convenient for future library settings. Furthermore, this version of GTK + and its dependent libraries are not needed in the future and can be simply removed by deleting this directory (such as/OPT/GTK).
and installed in the/usr directory, if you install the library into a non-system directory (such as the/OPT/GTK directory we will use), only the library installation is not enough, you must make some necessary settings to use this newly installed library. Specify the settings for the library in the relevant sections below.
5. Software download
Download the five Libraries GLib, ATK, Cairo, Pango, GTK +, respectively, according to the instructions and addresses provided in the "Dependent packages" section above.
In their respective download directories, various versions of the packages are usually listed, and generally each version has a. tar.gz and. tar.bz2
Two different compression formats. Note that depending on the version number of each package or the date of the selection of the latest version of the download, and some libraries under the download directory also use a latest-xxx
The file name tells you what the current version is. Due to the small size of the. tar.bz2 compressed file, it is recommended to download this package; if not, download the. tar.gz format package.
The following is the latest version of the package for each library:

    • glib-2.12.5.tar.bz2

    • atk-1.9.1.tar.bz2

    • Cairo-1.2.0.tar.gz

    • pango-1.14.8.tar.bz2

    • gtk+-2.10.6.tar.bz2


You can create a new directory to hold these downloaded packages.
Since these packages are created using the GNU Autotools tool, the build and install interfaces for each package are the same./configure
&& make && make install. For this reason, we highlight the installation of the Glib library, including GTK +
The other libraries are simply explained, and when installing other libraries, they can be compared with the installation process of the Glib library.
6. Installation of the Library
6.1 Installation Sequence
Depending on the requirements of the dependency relationship, the installation of the library should be carried out in such order: GLib, ATK, Cairo, Pango, GTK +.
Each of these libraries automatically checks to see if the libraries they depend on are properly installed when they are installed, and if the dependent libraries are not installed, or if the installation is unsuccessful, or if they are not set up correctly, the installation will be terminated and
The corresponding error prompt is shown. However, as long as you install each library in the order above and follow the steps below, it is generally easy to successfully complete the installation of each library without any errors.
6.2 Installation Process
The process of installing the source code package can be divided into the following steps:

    • Unpack

    • Configuration

    • Build

    • Installation

    • Set up


The following is an example of the installation of the library in Glib, respectively, to describe each process.
6.2.1 Unpacking
Unpacking is the process of extracting a package from a restore. The first step is to enter the directory in which the package is located, depending on whether the package type is. tar.gz or. tar.bz2, select the appropriate unpacking command.
Decompression and restore of the. tar.bz2 Format Package:
$ tar xjvf glib-2.12.5.tar.bz2
If the package is in the. tar.gz format, this should be decompressed and restored:
$ tar xzvf glib-2.12.5.tar.gz
After the unpacking command is executed, a directory named glib-2.12.5 is generated under the current working directory, and the contents of the glib package are stored in this directory.
The unpacking process for other packages is similar to the above, as long as the package name in the above command is replaced. The directory name generated after the unpacking of each package is typically the name of the. tar.bz2 or. tar.gz removed from the package name, in the format: library name-version number.
6.2.2 Configuration
The purpose and result of the configuration (configure) is to get the software built and installed
Makefile. To do this, the current system is instrumented during the configuration process, obtaining some information needed to build and install the program and ultimately record the Makefile
In Some of these can also be specified by command-line parameters, such as the installation path of the package (the default is to use/usr/local if the installation path is not specifically specified)
As the installation path. )
It's already been planned: we're going to install all the packages under the/OPT/GTK directory, so we can do this:
First go to the package directory you want to install. For example, if you are Glib, you can execute the CD glib-2.12.5 command to enter the directory.
Next, perform the following command configuration (the configuration commands for each of the packages installed later are also the following form):
$./configure--PREFIX=/OPT/GTK
Where configure is a script file (generated by the GNU Autotools tool) included in the package./configure
is to execute the script file and use--prefix to indicate the installation directory of the package. In this way, during the subsequent installation process (make
Install) copies the corresponding file to the directory specified behind it (/OPT/GTK).
Note: You can use the./configure--help command to view the different parameter options and the meaning of each parameter provided in each package configuration.
Note: A library can have two forms of existence: shared libraries (. So) and static libraries (. a). For GTK +
and its dependent library, when the source is installed, its default setting is to generate only shared libraries, and if you need a static library, you should add--enable-static when configuring each package.
Parameters (see./configure--help). When you develop GTK programs, you should generally use their shared libraries, not static libraries.
Since Glib only relies on some of the most basic system libraries, there should be no problem in performing the configuration. However, for
GTK + and other dependent libraries, if the required programs or libraries do not exist during configuration, or if the version does not meet the requirements, the appropriate error message will be displayed after the exception aborts the configuration process. If the configuration is not successful,
You cannot proceed with the following program build process.
For beginners, they often don't know what configuration results are successful and what is failing. Here are two simple ways to check if a configuration is successful:

    • The information that is output during configuration is recorded in a file named Config.log, in addition to being displayed on the screen. Check if there are any in this file
      Configure:exit 0 Such a sentence (usually in the back or last line of the file). If yes, the configuration succeeds; if not (for example,
      Configure:exit 1) indicates that an error occurred during configuration and the configuration failed.

    • Execute echo $ immediately after the./configure command finishes executing. command to check its output. If the output is 0, the configuration is successful; 0
      A number other than that indicates that the configuration failed. On a Linux system, you can use this method to check how much a command or program returns to the system after it ends. General 0 stands for success, not 0
      Indicates that the program exited unexpectedly.


6.2.3 Construction
The process of generating a program from a source code is called build. The "program" here is a generalized concept: it can be either a binary executable program in its general sense, or it can be
In the form of a text executable script, it can also be a library, header file, data, and so on. A package is often included in the
One or more forms of program construction, where binary executable programs and libraries are most common.
For programs written in a compiled language (such as C or C + +) (GTK + and some of its dependent libraries are written in C), the process of building the software is primarily the process of compiling and connecting. On a Linux system, the build is implemented by executing the Make command:
$ make
Make is based on Makefile content to determine how to build the program, and this Makefile is the product of the above configuration. After you execute the make command, the program's compilation process begins. This is a more time-consuming process, especially for large packages such as GTK + and its dependent libraries.
After make is finished, you can also execute echo $? command to check whether make is performing successfully. Generally as long as the configuration has passed, make should not have any problem is.
Make results, for the program, the main generation is executable program files, for the library, the main generated is the library file. The following installation process will copy the required files to the installation directory specified at the time of configuration.
6.2.4 Installation
The installation of a successful build package is done with the install parameter:
$ make Install
This is explained here: on Linux systems, except for root
Users and users with the appropriate permissions, the general user only in their own user directory to write permission, for directories and files other than the user directory, generally can only read and not write. When we configure it, we will
The Setup directory is/OPT/GTK and is read-only for the average user. If this is the case, the make install above
Although it is executed, it cannot be copied to this directory because there is no write permission, so the installation is unsuccessful.
It is generally necessary to switch to the root user first and then install:
$ su
# make Install
The "#" symbol above indicates a command-line prompt in the root state.
You can also use the echo $ after completing the make install? Check whether the installation was successful.
If you look at the/OPT/GTK directory at this point, you will find several subdirectories under this directory, such as bin, include, Lib, share. This is because each library, such as
Glib) and depending on the purpose of the installation files are divided: Bin is the execution file directory, include is the header file directory, Lib is the library file directory, share
Is the library's common directory, including local translation files, various formats of the description of documents and example programs.
Once the installation is complete, you should exit the root user immediately and return to the original user state:
# exit
The root user privilege should only be used when it is actually needed. Many beginners do whatever it takes to root
Carried, and thought so convenient. In fact, for beginners This is the most undesirable, it is easy due to misoperation and damage the system. Even if you're the only one who uses a Linux
System, you should also register an ordinary user, usually as an ordinary user's identity using the system.
6.2.5 settings
Beginners often don't know why to set up the library and what settings to make. To do this, here are some background information about the settings of the library. If you already know this part of the content, or are eager to do the actual setup, you can go directly to the last section, "GTK + and its dependent library settings."
6.2.5.1 Search Path
The above installation has already copied the library's various files to the specified installation directory, and the library can be used by other programs or libraries. The use of libraries mainly consists of two aspects: the use of the header files of the library to
and the use of library files (static libraries or shared libraries). Accordingly, the setting of the library is the question of how to locate the two types of files. Locating files is usually done by using the search path of the setup file to resolve
Of In the process of using the search path to find the order, the first to find the file will be used.
The header file of the library is included in the program and is used only during the program compilation phase, so the default search path for the header file is provided by the compiler. Header files that are in the default search path do not require a search path
Settings can be used directly. Although the default search path for header files provided by each compiler is different, the/usr/include
As one of the default search paths. Using a header file that is outside the default search path requires that the path be specified at compile time through the-I parameter of the compile command. This is the way to locate the opponent file.
Library files are used when connecting (static libraries and shared libraries) and running (limited to programs that use shared libraries), and their search paths are set in the system. The general Linux system puts the/lib and
/usr/lib
Two directories are the default library search paths, so using the libraries in these two directories does not require a set search path to be used directly. For libraries that are outside the default library search path, you need to add the location of the library to
The search path of the library. There are two ways to set the search path for a library file, which can be used as one of the following:

    • Specifies the search path for the library in the environment variable Ld_library_path.

    • Add a search path to the library in the/etc/ld.so.conf file.


It is important to note that the second search path is set up in a way that is sufficient for the location of the library (including shared libraries and static libraries) when the program is connected, but is not sufficient for the execution of programs that use shared libraries. This is
Because in order to speed up the location of the shared library when the program executes, avoid using the search path to find the shared library inefficient, so it is directly read the library list file/etc/ld.so.cache
from which to search. /etc/ld.so.cache is a non-text data file that cannot be edited directly, it is based on/etc/ld.so.conf
The search path set in is generated by the/sbin/ldconfig command to centralize shared library files under these search paths (the Ldconfig command takes root
Permission execution). Therefore, in order to ensure the location of the library during the execution of the program, after setting the library search path in/etc/ld.so.conf, you must also run
The/sbin/ldconfig command updates the/etc/ld.so.cache file before you can.
When a program is connected, the search Paths for library files (static libraries and shared libraries) can be explicitly specified with the-l parameter in addition to the settings above. Because the path set with-L is prioritized, the path to the library to which you want to connect is typically specified in this way when you connect.
Some programs that use shared libraries are successful in compiling and connecting, but there is a problem with the shared library not found at run time because the library's search path is not set or is not set correctly.
6.2.5.2 Compile and connect interface
In general, if the header file of the library is not in the/usr/include directory, then it needs to be compiled with-I
parameter specifies its path. Because the same library may be located in different directories on different systems, users can install the library in different directories, even if using the same library, because the path of the library
, the path to the header file specified with the-I parameter may also be different, resulting in a non-uniform compilation Command interface. If you use the-l
Parameters, it can also cause a non-uniform connection interface. A non-uniform compilation and connection interface can cause problems with library usage.
In order to solve the problem of not unifying the compilation and connection interface, some solutions have been found. The basic idea is to save the location information of the library beforehand, and then use the specific tool to make it useful.
The information is extracted for compilation and connection use. In this way, you can achieve the consistency of the compilation and connection interface. Among them, the most commonly used library information extraction tool is the pkg-config described below.
6.2.5.3 Pkg-config
Pkg-config is a. pc file that is provided through the library to obtain all the necessary information about the library, including version information, compilation, and connection required parameters. This information can be extracted separately from the parameters provided by Pkg-config directly for use by compilers and connectors.
By default, each Pkg-config-enabled library corresponds to a. pc file that is located in the installation directory after installation Lib/pkgconfig
Directory. For example, we have installed Glib in the/OPT/GTK directory above, then the Glib library corresponding to the. pc file is
/opt/gtk/lib/pkgconfig directory under a file called glib-2.0.pc (may wish to look at the contents of this file to get the right. pc
Some perceptual knowledge of the document. )
Using the Pkg-config--cflags parameter gives you the options you need at compile time, and the--libs parameter gives you the option to connect. For example, suppose a sample.c program uses the Glib library, it can be compiled like this:
$ Gcc-c ' pkg-config--cflags glib-2.0 ' sample.c
Then connect like this:
$ gcc sample.o-o sample ' pkg-config--libs glib-2.0 '
Or the above two steps can also be combined to take the next step:
$ gcc sample.c-o sample ' pkg-config--cflags--libs glib-2.0 '
You can see that because the Pkg-config tool is used to get the library's options, you can use the same compilation and connection commands, regardless of the directory in which the library is installed, to unify the compilation and connection interfaces.
There are two basic prerequisites for extracting the compilation and connection parameters of a library using the Pkg-config tool:

    • The library itself must provide a corresponding. pc file at the time of installation. The library description does not support the use of the Pkg-config tool.

    • Pkg-config must know where to look for this. pc file.


GTK + and its dependent libraries support the use of the Pkg-config tool, so the remaining question is how to tell Pkg-config where to find the corresponding. pc file for the library, which is also resolved by setting the search path.
6.2.5.4 GTK + and its dependent library settings
6.2.5.4.1 settings for compilation and connection purposes
For GTK + and its dependent libraries that support the Pkg-config tool, the search path setting for the header file of the library becomes the setting for the. pc File search path: PC
The search path of the file is set by the environment variable Pkg_config_path, and pkg-config will be searched in the order of the set path until the specified
. pc files.
The environment variables in Linux are set in a way that is related to the shell used. Here is an example of bash as a description. If you find that the setting method for the environment variable here is not successful, you should check what shell you are using in your current terminal:
$ ps--no-headers--format Comm $$
Note: If PS is defined as an alias, you may need to perform \ps--no-headers--format comm $$.
It is then set up according to the environment variables of the shell. If there is a bash in the system, you can also switch the shell to bash:
$ bash
This allows you to set the environment variables as described in the following procedure.
After installing Glib, the following settings should be set in bash:
$ export pkg_config_path=/opt/gtk/lib/pkgconfig: $PKG _config_path
You can perform the following command to check whether the/opt/gtk/lib/pkgconfig path is already set in the PKG_CONFIG_PATH environment variable:
$ echo $PKG _config_path
After this is set up, other programs or libraries that use the Glib library are compiled with Pkg-config know first to/opt/gtk/lib/pkgconfig
This directory is looking for glib-2.0.pc (GTK + and other dependent libraries of. pc files will also be copied here, and will first be searched here for their corresponding. PC
files). After that, the compilation and connection parameters of the library can be extracted by Pkg-config for the program to be used in compiling and connecting.
It is also important to note that the settings for the environment variable are valid only for the current terminal window. If you arrive at a terminal window that does not have the above settings, Pkg-config will not find the newly installed glib-2.0.pc file, which may cause subsequent installations (such as the installation of ATK after glib) to fail.
6.2.5.4.2 settings for the purpose of connection and execution
As explained earlier, there are two ways to set up a library search path: Set in environment variable Ld_library_path and in the/etc/ld.so.conf file.
The second setting requires root permission to change the/etc/ld.so.conf file and execute the/sbin/ldconfig
Command. Also, when the system restarts, all GTK2-based programs will use the newly installed GTK + library at run time. Unfortunately, because of the GTK +
Version changes, which can sometimes cause compatibility problems for applications, causing some programs to run abnormally.
To avoid these cases, the setting of the search path for the library during the installation of GTK + and its dependent libraries takes the first approach. This setting does not require root privileges and is simple to set up:
$ export ld_library_path=/opt/gtk/lib: $LD _library_path
You can use the following command to view the contents of the Ld_libray_path settings:
$ echo $LD _library_path
At this point, the two settings for the library are complete.
Because we install GTK + and its dependent library settings in the same directory, the above settings for environment variables Pkg_config_path and Ld_libray_path in a terminal window as long as it is possible to install the other libraries at a later time without the need to set the line.
After the above setup, the use of the Glib program (such as the following to install the ATK) can be based on the Pkg_config_path and
The search path set in Ld_libray_path found the newly installed Glib library. If you do not make the above settings, or if the settings are incorrect, you may find an older version of the
Glib, there may also be errors that cannot be found Glib.
You can now check the version number of Glib by executing the following command:
$ pkg-config--modversion glib-2.0
If the version number shown is the same as the version number in the package you are installing, congratulations! You have successfully completed the installation and setup of the Glib library and can proceed with the installation of other libraries.
Note: The compilation of ATK and other libraries will use the commands in/opt/gtk/bin, so the PATH environment variable should also be set as follows:
$ export Path=/opt/gtk/bin: $PATH
6.3 Installation of other libraries
After confirming that the Glib has been successfully installed, you can install the other libraries sequentially.
6.3.1 Installation ATK
Refer to the "Installing Glib" section for the operation. If you always operate in the same terminal window, the final setup process is not performed. Check the version number of the ATK:
$ pkg-config--modversion ATK
6.3.2 Installation Cairo
Refer to the "Installing Glib" section for the operation. If you always operate in the same terminal window, the final setup process is not performed. Check the version number of the Cairo:
$ pkg-config--modversion Cairo
6.3.3 Installation Pango
Refer to the "Installing Glib" section for the operation. If you always operate in the same terminal window, the final setup process is not performed. Check the version number of the Pango:
$ pkg-config--modversion Pango
Note: Another flag that configures Pango success is: The last line of information displayed in the./configure backends:freetype X
Xft Cairo should have the appearance of Cairo words. If not, like Backends:freetype X Xft, it means
The configuration of the Pango is unsuccessful and the Pango configuration is unsuccessful, stating that its dependent library Cairo is not installed or the Cairo library is not set up correctly.
6.3.4 Installing GTK +
Refer to the "Installing Glib" section for the operation. If you always operate in the same terminal window, the final setup process is not performed. To check the version number of GTK +:
$ pkg-config--modversion gtk+-2.0
7. Use of libraries
7.1 Settings prior to library use
In our installation scenario, we use environment variables to set up GTK + and its dependent libraries, so when the system restarts, or a new terminal window is opened, if you want to use the newly installed
The GTK + library requires the Pkg_config_path and LD_LIBRARY_PATH environment variables to be reset as above.
This method of using GTK + has a process of setting up the library before using it. It's a little cumbersome, but it's one of the safest ways to use the GTK + library, without any impact on the system's already existing programs that use the GTK + library, such as the GNOME desktop.
In order to make the library easier to set up, you can save the following two sentences to a file (such as the set_gtk-2.10 file):
Export Pkg_config_path=/opt/gtk/lib/pkgconfig: $PKG _config_path
Export Ld_library_path=/opt/gtk/lib: $LD _library_path
You can then use the following method to set up the library (where the source command is also available.) instead):
$ source set_gtk-2.10
These settings are only necessary if you are developing an application with the new GTK + library, or if you are running a program that uses the new GTK + library.
If you want to avoid the trouble with the above settings before using the GTK + library, you can set the above two environment variables in the system's configuration file (e.g.
/etc/profile) or your own user profile (such as ~/.bash_profile), the search path for the library can also be set in
/etc/ld.so.conf files, and so on. This setting takes effect when the system starts, resulting in a program using GTK + using the new version of GTK +
Run the library, which may cause some problems. Of course, if you find that using the new version of GTK + instead of the old version is not a problem, it is convenient to use this setup method.
7.2 Library Documentation
Using a library is an unavoidable reference to the library's documentation. The documentation for GTK + and its dependent libraries is also installed, and is stored separately in the share/gtk-doc/html directory of the installation directory. You can open index.html in each directory with your browser, and then add it to your network bookmarks for your reference at any time.
Finish


Installing the source code on a Linux system GTK + 2.0

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.