Three commands that may be used to create a deb package

Source: Internet
Author: User
The three commands that may be used to create the deb package-Debian information of the Linux release-are described below. When creating a deb package, it is often difficult to know the dependencies required by the package. Now, there are several command problems to solve.
1. ldd: used to view the shared libraries required for running the program. It is often used to solve some problems that the program cannot run due to a lack of library files.
2. dpkg-S: This is a dpkg command with parameters to query which software package a file belongs.
3. apt-file: if you do not like the dpkg-S command with parameters. You can also use the apt-file command. It works the same as dpkg-S.
With these commands, it is much easier to create a deb package. First, use ldd to view which shared libraries are required for a file. Then, you can use dpkg-S or apt-file to view which software package a shared library file belongs. Finally, you can write the dependency of the software package in the control file.
Appendix 1: ldd command principle (from network)
1. ldd is not an executable program, but a shell script.
2. ldd can display the dependency of the executable module. The principle is to set a series of environment variables, such as LD_TRACE_LOADED_OBJECTS, LD_WARN, LD_BIND_NOW, LD_LIBRARY_VERSION, and LD_VERBOSE. When the LD_TRACE_LOADED_OBJECTS environment variable is not empty, when any executable program is running, it only displays the dependency of the module, and the program is not actually executed. Or you can test it on the shell terminal as follows:
(1) export LD_TRACE_LOADED_OBJECTS = 1
(2) execute any program, such as ls, and check the running result of the program.
3. ldd shows the dependency working principle of the executable module. Its essence is realized by ld-linux.so (loader of elf dynamic library. We know that the ld-linux.so module will work prior to the executable module program and gain control, so when those environment variables above are set, the ld-linux.so selects the dependency that shows the executable module.
4, in fact can directly execute the ld-linux.so module, such as:/lib/ld-linux.so.2 -- list program (which is equivalent to ldd program)
Appendix 2: How to Use the ldd command (from ldd -- help)
Name ldd-print the dependency of the Shared Library
Outline ldd [Option]... file...
Describes the shared libraries required for each program or shared library specified by ldd output on the command line.
Option
-- Version
Print the version number of ldd.
-V -- verbose
Print all information, such as the version information of the symbol.
-D -- data-relocs
Execute the symbol re-deployment and report the missing target object (only applicable to the ELF format)
-R -- function-relocs
Redeploy the target object and function and report the missing target object and function (applicable only to the ELF format)
-- Help usage information
Note:
The standard version of ldd is provided together with glibc2. Libc5 and earlier versions are available in some systems. Long options are not supported in libc5. On the other hand, glibc2 does not support the-V option, but only provides the equivalent -- version option.
If the given library name in the command line contains '/', the libc5 version of this program uses it as the Library name; otherwise, it searches for the library in the standard location. Run a shared library under the current directory with the prefix "./".
Error:
Ldd cannot work on a. out shared library.
Ldd cannot work on some very old a. out programs that have been created before the release of ldd compilers. If you use ldd in this type of program, the program will try the running mode of argc = 0, and the result is unpredictable.
Appendix 3: apt-file
Apt-file is a software package search tool. You can find the files contained in the software package and the installation location.
· Apt-file update
Update the file library of the software package. It must be run once after the first use or apt-get update.
· Apt-file search file_name
Find the packages in which the file exists.
· Apt-file list package_name
Displays the file of the software package.
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.