Revision [32131]

This is an old revision of compiling made by PageStep007 on 2018-09-22 16:02:29.

 

HomePage > ComponentHowTo Components and HowTos > CompilingIndex Compiling

Compiling


What is compiling?

It is the process of getting a program organized to work on a particular system.

Overview

There are many operating systems in use today in computing. Many programs are written for a particular system and are system specific. However more and more, programs are being written for various operating systems at the same time. These are cross-platform programs. It is therefore necessary to back up a little and first write the program with no system in mind, then have a system whereby the program will install on any of the systems. The 'no-system-in-mind' code, is 'Source Code'.

The programmer writes in a text editor, in a code language of choice, and to be more efficient, often use code other people have written. These are often called libraries. In Linux they have an .so extension and in windows they have .dll extension. The programmer may assume you already have the libraries on your system. This is particularly true if they are writing for a specific system, but they may use open source libraries. The source code package therefore gets to look like a huge jumble of files, but they include files which organize and check for you, in the installation process, as well as the files needed to run the program. This jumble will not run in this state. It needs to be 'compiled'.


Compiling

Source code is the basic code for a program before taking into account what system it is going to run on. The program won't run unless the files are first organized in a language that your system can use and into the right directories where the program can find them. You need a program to do that for you. This program is called a 'compiler'.
Generally Puppy systems don't come with a program to make that happen. You need a compiling program to do that, for example devx_slacko_5.7.0.sfs. has the 'make' program in it. Different code writers occasionally have different procedures in compiling and so source packages may vary in their organization and execution. Read and help files are usually included in the package to give some sort of idea on these variations. Usually you need to do the compiling process through a terminal (console) with typed commands such as cmake, make, install, etc. You need to download a compiler which is sometimes specific to your particular puppy.
This compiling is done from the Console /terminal/Shell. Although recent versions of CMake do have a GUI (Graphical User Interface).

There are about six steps in the overall compiling process

1. Downloading the sources,
2. Unpacking the sources,
3. Creating a makefile, or configuring
4. Compiling,
5. Installing,
6. Deleting the sources.

The first two can be done from the terminal or from the file browser. Downloading, you obviously download your source package from wherever you are getting it from. It might be something that ends in a .tar.gz . Then you extract it. It is easier to just click on the downloaded package and the XArchiver opens it, you choose 'select all', then 'extract'. It will usually make a directory in the same place unless you tell it to extract to somewhere else. The result will be a collection of files and directories in that Directory. That was the easy part.

The next three steps are:

1. configuration.
The source package needs to be configured. A program needs to be run which goes and checks your system to see what it is, how it is structured, and what resources that the source is interested in, are present on the system . It will make some files with that information noted. Often that is in a makefile.txt file. If the source comes already configured, it is likely to have the makefile.txt file. It may come with a file called 'configure', in which case the command ./configure can be typed. (the dot means 'this directory', the slash means 'run or execute' a file, 'configure' means the file with the name 'configure'. That command will run the configure program. There may be a file called 'bootstrap' or even both. Bootstrap will do the same. If there is an 'autogen.sh' file, it also does basically the same as 'configure', (the .sh means it is a linux executable script . sh basically stands for shell so it is a script the terminal can run with its built in commands.)

2.Compile/build.
The compiling program (gcc ,make, CMake) will build or 'make' the program customized for your system, in doing so it makes a directory and writes, rewrites, and otherwise organizes the program according to what the configure program found. ( With this done a .pet can be made here)

3.Install.
The 'configured' and 'compiled/built/made' program, can be installed, usually with a 'make install' (without the quotes and a space between the two words) command in the terminal

Then all the source and intermediate files can be deleted as they have done their job.

Problems

Problems can arise if the configuration process does not find all of the required files on your system that it expects to find, and they are not included in the source package. The program depends on these files. Therefore they are called Dependencies . If the configuration process does not find them, the compilation process most probably won't work.
Due to Puppy being a very lean operating system, many libraries are not included in the Puppy. Depending on how you look at this, it is good, or not good. It is good, because the Puppy comes with everything it needs to run, and it is mind bogglingly small due to this. There is no 'junk' included. (Windows on the other hand includes just about everything the world might need, and it comes very bloated with often unused junk.) However, the down side or trade off is, there are few libraries that other larger linux systems include in their systems, and therefore many package installations come up short, and then a Sherlock Holmes process ensues. Any missing Libraries need to be tracked down on the internet and installed so that the source package configuration and compilation processes can use them.



Also on the wiki




Categories
CategoryDevelopment
There are 5 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki