Unix/Linux Software Installation

  

Unix/Linux Software Installation First of all, we understand that on Unix like machines, a set of software does not only have one program, but a bunch of program code files. For example, main.c, haha.c, sin_value.c are three source code files.

1. Program source code

1.1 Manual compilation with gcc and other compiler tools #What is gcc tool? GNU's gcc tool is a very general C compiler. Gcc -c main.c gcc -c haha.c gcc -c sin_value.c gcc -c cos_value.c Generates main.o, haha.o, sin_value.o, cos_value.o 4 compiled files. Connect several .o files and add the libm math function to generate the main executable. Gcc -o main main.o haha.o sin_value.o cos_value.o \\ -lm -L/usr/lib -L/lib # Then we can run the main executable. [padep@cnsz081003 fwy]$ ./main Please input your name: fengweiyuan Please enter the degree angle (ex> 90): 110 Hi, Dear fengweiyuan, nice to meet you. The Sin is: 0.94 The Cos is: -0.34< Br>

1.2 Compile the source code with tools such as configure and make. /configure Check the user environment and check if the OS is suitable. Then the makefile text file will be generated.

1. Whether there is a suitable compiler, you can compile the program source code of this software.

2. Is there a function library or other dependent software required for this software?

3.OS platform, including kernel version, is suitable for this software.

4. The kernel's header definition file exists. The makefile records information about how the source code is compiled. For information about this step, you can refer to the README and INSTALL files. Makeclean doesn't have to be needed, but it's safer to execute. If there is already a .o file that was compiled last time, it is better to clear it, so we can determine that the newly compiled executable file can be determined to be compiled using our own machine. Make will search for the text file of makefile in the current directory, use makefile to compile the source code, compile it into an executable file, and put it in the current directory. (This process is like generating the .o file in 1.1 above, connecting the .o files together and adding the function library). Make will automatically determine if the source code has changed and automatically update the executable file. Make install If there is an option for install in the makefile, the file compiled in the previous step will be installed to the default directory to complete the installation. These steps are one by one, the previous ones are not successful, and the latter ones cannot be executed. Summarize due to the different OS's library path, or the function library file name definition, or the default installed compiler, and the kernel version is different. In theory, the binary file compiled on CentOS 5.x (the binary executable file contains the path information of the function library on the OS) cannot be executed on SuSE. Therefore, the same set of software must be executed on different platforms, and must be compiled repeatedly, so the source code is required.

2. The compiled file

2.1 The binary distribution directly selects the compiled binary distribution, which needs to be selected from the website according to the operating system version. In fact, on a specific operating system, the compiled binary files, we directly copy and use.

2.2rpm package to install the software, pre-compiled, and then packaged into rpm installation package. Baotou will have software dependency information. Before installing the rpm package, rpm will first check the environment according to the information recorded by the rpm header. If it is not satisfied, it will not be installed. When installing, the software information will be written to the local RPM database for future query, verification and anti-installation. Therefore, the rpm package is not cross-platform. To install the rpm package, the platform must be identical or equivalent to the host environment in which the software file was originally created. Srpm package. **.src.rpm

Copyright © Windows knowledge All Rights Reserved