How to install the Linux source code package

Source: Internet
Author: User

As Linux became increasingly popular and Microsoft began to worry about it, the windows 7 system was released to attract users. Linux is becoming more and more popular. Do you know about Linux? Are you an application of Linux? This article describes how to install the Linux source code package in detail, which plays a certain role in learning how to install the Linux source code package.

1. decompress the package

A software package can be obtained by downloading or other means. Generally, it is a compressed file, most of which may be archived and compressed. These files generally use. tar. gz as the extension.

First copy it to a directory, and then untar and gunzip unzip it. Usually this command is

Tar xzvf filename [filename is the name of the software file]

The decompressed file is generally named after the package name in the subdirectory that is created in the current directory. You can also use this command to view the result tar tzvf filename in advance and display the unzipped files in the package.

If the source file is in the new bzip2 (.bz2) format, you can use bzip2-cd filename | tar xvf-, or a simpler tar xyvf filename. This is a good tar command that is constantly improved.

Note:

A: Sometimes some files must be installed in the user's home directory, or more in A fixed directory, such as/,/usr/src, or/opt. Therefore, you must carefully read the configuration information of the installation package. If the config and Makefiles files exist in a software package, you are advised to edit them. The installation instructions and instructions are provided here. Tip: Changing makefile will lead to different results. Most software packages allow the use of make install to automatically process placement of binary files in the appropriate system location.

B: You may have encountered some shared files, shell archive files, especially source code newsgroups on the Internet. They are retained because they are user-friendly and allow newsgroups to buffer and filter and remove Unqualified ones through them. They may be decompressed using the unshar filename. shar command.

C: some source code files are archived using non-standard DOS, Mac, or other compressed files such as zip, arc, lha, arj, zoo, rar, and shk.

D: Sometimes, you may need to use a patch or display the changed diff file to upgrade or fix the archived source code file. This doc file or README file will tell you how to use it. A good command to call with standard syntax is patch <patchfile.

2. rpm installation package

Some Linux users are afraid to manually install the software package by using the source code, but now there is a convenient rpm, deb, or new grid-type slp package. For example, the rpm installation runs smoothly and fast, and is installed on several famous operating systems as a software.

As a convenient RPM package, there are also many disadvantages, such:
A: To learn more about the software, you must understand it in binary instead of rpm packages.

B: install an rpm package. If dependency is required, the installation may fail.

C: When rpm requests libraries of different versions in your system, the installation will not continue unless you create a connection symbol for the wrong library location to the correct location.

Note: You must use root to install rpm and deb. Because it requires the required write permission.

The simplest way is to run the command rpm-I packagename. rpm and dpkg -- install packagename. deb to automatically unpackage and install packagename. deb.

3. Problems and Solutions for installing the Linux package

Suppose there is a link error in make failure:-lX11: No such file or directory, which is called exactly after xmkmf, which may mean that Imake cannot be completely created. Check the line of the first Makefile file as follows:

LIB =-L/usr/X11/lib
INCLUDE =-I/usr/X11/include/X11
LIBS =-lX11-lc-lm

The-L and-I switches tell the compiler where to find the library and include files respectively. In this example, the X11 library should be in the/usr/X11/lib directory, and the X11 file should be in the/usr/X11/include/X11 directory. If this error occurs on your machine, modify the Makefile and make it again.

No mathematical library functions are declared, such as the following:
/Tmp/cca011551.o (. text + 0x11): undefined reference to 'cos'

To fix it, you need to explicitly link to the matched library and add a-lm to lib or LIBS mark in Makefile (see the previous example.

Try other methods
If it still fails, refer to the following script:
Make-DUseInstalled-I/usr/X386/lib/X11/config

The category of this direct method is equivalent.

In a few examples, running ldconfig with root may solve the problem:
# Ldconfig updates the Shared Library Link symbol.

Some Makefiles use unrecognized library aliases in your system. In an example, the build may require libX11.so. 6, but the file or link does not exist in/usr/X11R6/lib. However, there is libX11.so. 6.1. The solution is to run ln-s/usr/X11R6/lib/libX11.so. 6.1/usr/X11R6/lib/libX11.so. 6 with root, and then run ldconfig.

Some packages require you to install an upgraded version of one or more libraries. Copy one or more libraries to the appropriate directory, delete the old library, and reset the dynamic link library.

4. Handle some other problems

Install a shell script if the following error message is displayed: No such file or directory. This is to check the File Permission to determine whether the file is executable, and check the file header to determine whether the shell or program is called at the specified position by the script. For example, this script may start like this:

#! /Usr/local/bin/EDEN

For example, if the actual installation location of EDEN is in your/usr/bin directory, replace it with one/usr/local/bin.

This script cannot be executed in two ways!

A: Change the file header #! /Usr/bin/EDEN

B: or add a link, ln-s/usr/bin/EDEN.

5. A typical example: Xloadimage

The following example is a technical example of a foreign website. I have translated and organized it here.

This example shows a simple problem. The xloadimage program is a useful addition to the adjustment settings of my graphics tools. Copy the file from the source code directory and decompress the file with tar xzvf. However, an annoying error occurred while running make and the file was stopped.

 
 
  1. gcc -c -O -fstrength-reduce -finline-functions -fforce-mem  
  2. -fforce-addr -DSYSV -I/usr/X11R6/include  
  3. -DSYSPATHFILE="/usr/lib/X11/Xloadimage" mcidas.c  
  4. In file included from /usr/include/stdlib.h:32,  
  5. from image.h:23,  
  6. from xloadimage.h:15,  
  7. from mcidas.c:7:  
  8. /usr/lib/gcc-lib/i486-linux/2.6.3/include/stddef.h:215:  
  9. conflicting types for `wchar_t'  
  10. /usr/X11R6/include/X11/Xlib.h:74: previous declaration of  
  11. `wchar_t'  
  12. make[1]: *** [mcidas.o] Error 1  
  13. make[1]: Leaving directory  
  14. `/home/thegrendel/tst/xloadimage.4.1'  
  15. make: *** [default] Error 2 

This error message contains the following clues:

View the 23 rows of the image. h file:
# Include

Wchar_t has been redefined in the specified standard include file for xloadimage somewhere in the source code. It tells us to try to comment it out in the 23 rows of image. h. Maybe stdlib. h include does not exist. After all, not all are necessary.

At this point, the benefits of the build come from any fatal error. The xloadimage function is normal now.

6. Summary of installing the Linux package

Insist on handling all Installation Problems by yourself, constantly sum up and study hard, study the problems carefully from the errors, and try to troubleshoot the errors, so as to expand and improve each problem or failure, enhanced skills for installing build software. In this way, you have learned how to install the Linux source code package.

  1. Analysis of Open-source Cisco router virtual machines in Linux
  2. 30 Linux releases
  3. Learning Experience: Linux File lock
  4. Linux Extension File System
  5. Easily create a file system in Linux

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.