(024) Linux compiler program

Source: Internet
Author: User

Fundamentals of the ten-year OPS series-Linux

Zeng Lin

Contact: [Email protected]

Website: www.jplatformx.com

Copyright: Please do not reprint the article without permission

First, Introduction

This chapter describes how to generate executable programs from source code. Open source is a necessary factor for Linux free and open source, and the development of the entire Linux system relies on free communication between developers. For most desktop users, compiling is a lost art. Although the compilation technique was once very common, the release publisher now maintains a large precompiled binary library for users to download and use.

So why compile the software? There are two reasons for this:

    • Availability: Although some distributions already contain some of the precompiled programs in the repository, they do not contain all the applications that users may need. In this case, the only way for users to get the software they need is to compile the source code.
    • timeliness: While some distributions focus on some of the cutting-edge versions of the program, most do not. This means that to get the latest version of the program, compiling is essential.

Second, what is the compilation

Simply put, compiling is the process of translating source code (a human-readable program description written by programmers) into a language that can be recognized by a computer processor.

The computer processor (or CPU) works on a very basic level and only runs programs called Machine languages. The machine language is actually some numeric code, it describes some very small operations, such as "Add a certain byte", "point to a place in memory" or "copy a certain byte" and so on, and each of these instructions are in the form of binary (0 and 1) is represented. The first computer program was written in such a numeric code.

The emergence of assembly language solves this problem because it replaces those numeric codes with easier mnemonics such as cpy (copy) and MOV (transfer), and assembly-language programs are processed by assembler (assembler) into machine language. Today, assembly language is still used in some specialized programming tasks, such as device drivers and embedded systems.

Later, high-level language programming, known as high-level languages, was introduced because they allowed programmers to focus less on the details of the processor's operations and focus more on solving the problem at hand.

Programs written in high-level languages are converted to machine languages by the compiler. Some compilers convert high-level language programs to assembly language, and then use a assembler (assembler) to convert them to machine languages.

The steps that are often used in conjunction with compilation are links. Programs perform a number of common tasks. For example: Open a file that many programs will need to do. It is a waste if each program implements the function in its own way. Writing a single program for opening a file and allowing other programs to share it makes more sense. The library, which provides this universal task support, contains a number of routines, each of which is a common task that many programs can share. In the/lib and/usr/lib directories, we can find a lot of such programs. The linker (linker) program can implement a link between the output of the compiler and the libraries required by the compiler. The final result of this operation is to generate an executable file for use.

(024) Linux compiler program

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.