How to solve the problem of dependency source packages installation

Whether novice Linux initially entered the temple, or experts with years of experience, more or less in the process of installing or compiling the package will encounter package dependency problems, resulting in the installation process can not continue, such as Administrator when installing LAMP, package needs libgd.so file, and this file belongs GD package. But when you install GD packages, the package with other packages may in turn have dependencies, but also need to install additional software packages for the job. Then some administrators will lose patience. In the face of this Linux package dependency problems, how to solve it? Before turning to the specific measures, to begin with talk about the Linux system software dependencies.

  First, what is dependent

  Shared libraries the program depends on the program code, so that they can issue a system call is sent to the output device or the like to open the file (that share inventory many ways, not limited to system calls). No shared libraries, each programmer to develop a new program, every programmer needs to be rewritten from scratch these basic system operations. When compiling the program, the programmer will be his code to link to these libraries. If the link is static, shared libraries compiled object code is added to the program executable file; if it is dynamic, shared libraries compiled object code only when it is loaded at run time by the programmer. Dynamic executable file depends on the correct shared libraries or shared objects to operate. rpm-dependent try to install a shared object needs to enforce dynamic executable, so that in the future when the program runs with no dynamic linking processes related to any problems.

  Note: There is another type of dependency, which is based on explicit entry, rpm by the programmer imposes rpm-dependent configuration file, but we do not care about this type of dependence, this dependency is relatively easy solve. Here we will focus on more complex shared object dependencies rpm enforced.

  Second, the dynamic executables and shared objects

  Initially used when compiling and linking programs using dynamic shared object executable file name of the library to look for shared objects. They look at several criteria minority position, such as in / lib and / usr / lib directory and in the LD_LIBRARY_PATH environment variable (primarily used to specify the shared library to find, for example, we specify the path when you install Oracle, exportLD_LIBRARY_PATH = $ ORACLE_HOME / lib: / lib: / usr / lib: / usr / local / lib) directory specified. By the way, these shared objects found in the library catalog files may not be true; they may be located in a symbolic link pointing to a real library file in other locations (but usually still in a directory standard library directory). Usually there is no relationship between the name and the name of the shared library file is used to create at least a shared library files from the system administrator's point of view shared library package. For example, GLIBC2.3 libc.so.6 software package used to create the shared library files. Also note from this example, to add a version number (.6) the end of the shared library file name to create its version number (2.3) for nothing to do with. This is a shared library package developers intentionally done so that the new version of GLIBC can reuse the same shared library file name libc.so.6. This allows you to load a new version of GLIBC on the system without interrupting dynamically linked to all programs lib.so.6 shared library files, of course, assumes that the new version of the old GLIBC backwards and dynamic version of the executable file was originally linked GLIBC compatible. Therefore, even if the library or shared object files have a version number associated with them, these version numbers can not help you determine which version they share package from the.

  Note: When whatprovides option rpm query command, you can get information about using the rpm package is loaded into an existing shared object system. This confusion is caused by the following facts: a single shared library files may support shared library packages a range of versions. For example, to check the library soname /lib/libc.so.6 support GLIBC shared library package, run the following command:

  #objdump--all-headers/lib/libc.so.6|less

  Scroll down this report until it reaches Versiondefinitions: section to see libc.so.6 shared library file support which version GLIBC:

  Versiondefinitions:

  10x010x0865f4e6libc.so.6

  20x000x0d696910GLIBC_2.0

  30x000x0d696911GLIBC_2.1

  GLIBC_2.0

  40x000x09691f71GLIBC_2.1.1

  GLIBC_2.1

  50x000x09691f72GLIBC_2.1.2

  GLIBC_2.1.1

  60x000x09691f73GLIBC_2.1.3

  GLIBC_2.1.2

  70x000x0d696912GLIBC_2.2

  GLIBC_2.1.3

  80x000x09691a71GLIBC_2.2.1

  GLIBC_2.2

  90x000x09691a72GLIBC_2.2.2

  GLIBC_2.2.1

  100x000x09691a73GLIBC_2.2.3

  GLIBC_2.2.2

  110x000x09691a74GLIBC_2.2.4

  GLIBC_2.2.3

  120x000x09691a76GLIBC_2.2.6

  GLIBC_2.2.4

  130x000x0d696913GLIBC_2.3

  GLIBC_2.2.6

  140x000x09691972GLIBC_2.3.2

  GLIBC_2.3

  150x000x09691973GLIBC_2.3.3

  GLIBC_2.3.2

  160x000x09691974GLIBC_2.3.4

  GLIBC_2.3.3

  170x000x0d696914GLIBC_2.4

  GLIBC_2.3.4

  180x000x0d696915GLIBC_2.5

  GLIBC_2.4

  190x000x0963cf85GLIBC_PRIVATE

  GLIBC_2.5

  200x000x0b792650GCC_3.0

  In this example, 1ibc.so.6 dynamic shared libraries to support all of the executable file for the previous version 2.0 to 2.5 GLIBC developed. Note: You can also use command objdump soname to extract from the shared library file, the command is as follows:

  #objdump--all-headers/lib/libcrypto.so.0.9.8b|grepSONAME

  SONAMElibcrypto.so.6

  objdump:/lib/libcrypto.so.0.9.8b:norecognizeddebugginginformation

  Next, when the package is to discuss how the generated rpm, rpm package for installation on a new system, these co-dependent libraries are already known.
Three, Rpm packages and shared libraries dependencies

  When the programmer to generate rpm package, ldd command is used to report dynamic shared libraries all executable files in the package all the dynamic executable files. Another confusion is caused by the following facts: the same package of different dynamic executable may be linked to different versions of the same shared library package. For example, Heartbeat package of different programs may have been developed, and dynamically linked to different versions libc.so.6sonmae GLIBC shared library files. Use -q and --requires parameters on the command rpm, you can see the complete list of the rpm package required shared libraries. For example, to see all of the required dependencies Heartbeatrpm packages, use the command:

  #rpm-q--requires-pheartbeat-1.x.x.i386.rpm

  This produces the following report:

  sysklogd

  /bin/sh

  /bin/sh

  /usr/bin/python

  ld-linux.so.2

  libapphb.so.0

  libc.so.6

  libc.so.6(GLIBC_2.0)

  libc.so.6(GLIBC_2.1)

  libc.so.6(GLIBC_2.1.3)

  libc.so.6(GLIBC_2.2)

  libc.so.6(GLIBC_2.3)

  libccmclient.so.0

  libdl.so.2

  libglib-1.2.so.0

  libhbclient.so.0

  libpils.so.0

  libplumb.so.0

  libpthread.so.0

  librt.so.1

  libstonith.so.0

  Note that in this report, libc.so.6soname is needed, this shared library must support the use of shared GLIBC dynamic executable package version number 2.0,2.1,2.1.3,2.2 and 2.3 were linked. This is determined by the following facts: Heartbeat software package executable file is a different dynamic link for each version of the different versions of libc.so.6 library. In the understanding of the dynamic executables, shared objects, after the package is related to how the shared library soname and each other, prepare the following look at an example like this: when trying to install the rpm package, and it failed because of a dependency error, What will happen. yum can be automatically downloaded from the server specified RPM package and install, it can be handled automatically dependencies and install all of the software packages depend, again without cumbersome download, install.

  Fourth, manually resolve the dependency problem

  Normally, when you try to install the release version is not included in the package (and its dependencies can not be resolved automatically by the software package like up2date, apt-get or like Yum update tool), you will encounter rpm-dependent error. For example, if you try to use rpmivh * rpm command on older Linux distributions, for example, all Heartbeatrpm package, then the installation process may get the following error:

  error:faileddependencies:

  libc.so.6(GLIBC_2.3)isneededbyheartbeat-1.x.x

  libc.so.6(GLIBC_2.3)isneededbyheartbeat-pils-1.x.x

  libcrypto.so.0.9.6isneededbyheartbeat-stonith-1.x.x

  libsnmp-0.4.2.6.soisneededbyheartbeat-stonith-1.x.x

  Note, rpm command does not interfere with each GLIBC shared library package version number required to report - the highest number of reporting only the desired version number (GLIBC_2.3). (Assuming that the original package developers are not the same as the executable file in the package is linked to an incompatible version of a shared library packages) All these faults are required to report the name or shared library soname (instead of a file name, soname has always been to "lib" to start). But you can delete rpm added to the end of the report soname version number, and a quick check to see if the use of the locate command to install these systems in a shared library (assuming that you locate database is up to date. For more information, please refer to locate or slocate manual page). For example, to find the shared library files libcrypto to enter:

  #locatelibcrypto

  [root@localhost~]#locatelibcrypto

  /lib/libcrypto.so.0.9.8b

  /lib/libcrypto.so.6

  /root/.Trash/vmware-tools-distrib/lib/lib32/libcrypto.so.0.9.8

  /root/.Trash/vmware-tools-distrib/lib/lib32/libcrypto.so.0.9.8/libcrypto.so.0.9.8

  /root/.Trash/vmware-tools-distrib/lib/lib64/libcrypto.so.0.9.8

  /root/.Trash/vmware-tools-distrib/lib/lib64/libcrypto.so.0.9.8/libcrypto.so.0.9.8

  /usr/lib/libcrypto.a

  /usr/lib/libcrypto.so

  /usr/lib/pkgconfig/libcrypto.pc

  /usr/lib/vmware-tools/lib32/libcrypto.so.0.9.8

  /usr/lib/vmware-tools/lib32/libcrypto.so.0.9.8/libcrypto.so.0.9.8

  /usr/lib/vmware-tools/lib64/libcrypto.so.0.9.8

  /usr/lib/vmware-tools/lib64/libcrypto.so.0.9.8/libcrypto.so.0.9.8

  If this command does not find a libcrypto shared library files on the system, the need to go to the Internet and find out which shared library package contains the shared library files. A quick and easy way to accomplish this tool is that as long as the http://rpmfind.net name on the shared library into the search field. If the text libcrypto.so Chen entered in this search, the shared library will soon know this is provided by openssl package.

129949111402420560_new.jpg

If the old version of the shared library data package has been installed on the system, you can use the following command to confirm this software includes a shared library files you need:

  #rpm-q--providesopenssl

  [root@localhost~]#rpm-q--providesopenssl

  config(openssl)=0.9.8b-10.el5

  lib4758cca.so

  libaep.so

  libatalla.so

  libchil.so

  libcrypto.so.6

  libcswift.so

  libgmp.so

  libnuron.so

  libssl.so.6

  libsureware.so

  libubsec.so

  openssl=0.9.8b-10.el5

  This command reports all of the content provided in this package rpm (this includes the shared library soname package provided). Note: As previously noted, the shared library package version number is not and should not have any correspondence between the version number of the shared library file (soname). We are not discussed here in this area, since soname symbolic link may point to a different version of the shared library file, which is done in the case to avoid disrupting existing dynamic executable files when installing a new version of the shared package.
Fifth, the fault automatically resolve dependencies

  When you use the rpm package to build, upgrade or add new features to the system, dependent failures could quickly become a nightmare. Just by using your distribution vendor upgrade services or tools, you can avoid this nightmare. For example, when selecting rpm package to install, RedHat up2date tool to automatically download and install all the dependencies rpm RedHat. Here's a list of free points on several methods to accomplish the same thing of community support: http://www.rpm.org/ . Further below we will only see one of these automatic update tools: Yum.

  1. Yum to install using the rpm package

  Yum (YellowdogUpdater, Modified) program can be downloaded from the following URL: http://yum.baseurl.org/download/3.4/yum-3.4.3.tar.gz

  After downloading this package, you can use the following command like any other rpm package as install it:

  #rpm-ivhyum*

  You may need to update your repository want to download the rpm package. Listing available about Fedora Yum repository in http://www.fedoratracker.org To switch to a different repository, a file download these files, and the file as /etc/yum.conf files are installed. You can now tell Yum reports are stored with the following command in the Yum repository, can be used to install all packages:

  #yumlist

  [root@localhost~]#yumlist|more

  ThissystemisnotregisteredwithRHN.

  RHNsupportwillbedisabled.

  Loading"security"plugin

  Loading"rhnplugin"plugin

  InstalledPackages

  Deployment_Guide-en-US.noarch5.2-9installed

  Deployment_Guide-zh-CN.noarch5.2-9installed

  Deployment_Guide-zh-TW.noarch5.2-9installed

  GConf2.i3862.14.0-9.el5installed

  GConf2-devel.i3862.14.0-9.el5installed

  ImageMagick.i3866.2.8.0-4.el5_1.1installed

  MAKEDEV.i3863.23-1.2installed

  MySQL-python.i3861.2.1-1installed

  NetworkManager.i3861:0.6.4-8.el5installed

  NetworkManager-glib.i3861:0.6.4-8.el5installed

  2. Install the new rpm packages with Yum

  In the present example, the installation of the new software package GLIBC. Install the latest GLIBC and all its dependencies with a single command:

  #yumupdateglibc

  If all goes well, Yum will automatically detect, download and install all the latest GLIBC package rpm package required (GLIBC package here for your distribution constructed, not necessarily the latest available version of the software package GLIBC (using a release approved GLIBC shared library or adventure package version number installed without the use of normal system operation GLIBC dynamic executable package version required). You can also list the parameters for Yum grep command to find and to installation packages for example, to find the name of an SNMP package, enter:

  #yumlist | grepsnmp

  This command returns the following report:

  ThissystemisnotregisteredwithRHN.

  RHNsupportwillbedisabled.

  net-snmp.i3861:5.3.1-24.el5installed

  net-snmp-libs.i3861:5.3.1-24.el5installed

  net-snmp-perl.i3861:5.3.1-24.el5installed

  net-snmp-utils.i3861:5.3.1-24.el5installed

  Now you can easily use YUM to download and install all of these rpm packages.

  Six proposals for the upgrade Gilbc

  Glibc library is the underlying Linux runtime, its performance has important implications for the operation of the entire system. Glibc library contains a large number of functions, which can be roughly classified into two functions, one is to communicate with the operating system kernel system call interface, which is called as a functional function, to provide packaging with a pretreatment of the Linux operating system call. Another class of generic function object, which provides an implementation of frequently used functions, used as a tool type function. In practice, there are a lot of software is dependent on the Glibc version to install and run, that white version requirements for Glibc version is not high, not to low. Application of these compilation environment and other programs also must have the same operating environment, I often encounter server administrator to install the latest Linux distributions in production, the result of the application software is not installed go up, because the wrong version of Glibc , some written in upgrading some downgrading the original release version of glibc, the result is actually the collapse of the entire system, experience tells me that you only select Linux distributions in the corresponding glibc, for example in the development of an application rhel3.0 when our unit and then you have to release corresponding, for the other it is hard to say, any upgrade or downgrade their own application software to suit Glibc practices are not desirable, the final solution to the problem is to find a dress to resolve the RHEL3 a. In a table, I put a few Glibc version of linux distributions are listed first wife, for your reference.

Click image to view larger image

129949112147253162_new.jpg

Glibc provides the core functional components

  Figure 1 illustrates the:

  GCC depends on glibc

  binutils depends on glibc (binutils provides a series to create, manage and maintain utility binary object files, such as assembly (as), connection (ld), static library archives (ar), disassembly)

  make depend on glibc

  Header files gcc compiler when needed, but are themselves text files, so there is no need operating environment.

  Common tools rely on glibc and need to use a variety of dynamic libraries.

  The following table shows the situation a number of important Linux distribution of Glibc

  Glibc version of the Linux distributions

  Redhat9glibc-2.3.2-5

  Fedora1glibc-2.3.2

  RedhatEnterpriseLinuxAs3glibc-2.3.2-95

  RedhatEnterpriseLinuxAs4glibc-2.3.4

  RedhatEnterpriselinux5glibc-2.5-24

  RedhatEnterpriselinux6glibc-2.9

  Centos5.xglibc-2.5

  SuseLinuxEnterpriseServer9glibc-2.3.2-92

  SuseLinuxenterpriseServer10glibc-2.4.31.54

  SuseLinuxEnterpriseServer11glibc-2.9

Click image to view larger image

129949112530785099_new.jpg

Linux distributions glibc (32) bit

  Here are several methods of inquiry glibc version number:

  #ls�al/lib/libc*

  Or with the following command can be achieved

  #rpm�qp|grepglibc

  debian-based system by dpkgl | greplibc6 also can be found, in short, is generally in / usr / share / doc directory can see information about the glibc.

  VII Summary

  In most cases, in the face of package dependency problems, the file name of the operating system provides and the package name will have a direct link. It is possible to file name is the name of the package. But the name and the name of the package file would sometimes far. At this point most of the system administrator may file name alone you can not find the corresponding package. At this point you can first find the installation CD, if then the best option is to find, and then you need the help of some of the above mentioned author professional website to query the name of the package. When a system administrator to install the software, if the dependencies between software packages exist, it is best to take a book or recorded by other means. So that the next convenient and practical, pay attention to the accumulation of work, I believe most of the problems will be solved package dependencies.

This article comes from " Li Chenguang original technology blog " blog, be sure to keep this source http://chenguang.blog.51cto.com/350944/1034095

Reproduced in: https: //my.oschina.net/chenguang/blog/613914

Guess you like

Origin blog.csdn.net/weixin_33834628/article/details/92045187