Difference between revisions of "SBR600 Build-from-Source Lab"
Chris Tyler (talk | contribs) (Created page with 'Category:SBR600 Labs = Building from Source Code = Source code is the human-readable code used to write software. It usually consists of text files, and may include related …') |
(No difference)
|
Revision as of 17:47, 8 January 2011
Building from Source Code
Source code is the human-readable code used to write software. It usually consists of text files, and may include related data (graphics, sample data, fonts, and so forth).
Source code may be:
- Executed by an interpreter (such as bash), which reads the text of the source code and performs the relevant operations.
- Compiled into machine code, which can then be directly executed by a computer (either directly by the CPU, or by a virtual machine). Files containing machine code are called binaries, executables, or bytecode.
Preparing to Build
Before you attempt to build on a system, you will need to install the development tools (compilers, linkers, and so forth) and development libraries needed for that particular package. You can install a foundation set of development tools on a Fedora system with this command:
yum groupinstall "Development Tools" "Development Libraries"
You may need to install additional tools or libraries to meet the needs of the package you are building. Refer to the documentation for that package for specific details. Do not install tools or libraries from source code -- install them using the yum
command.
Timing Commands
Bash provides the built-in time command to determine how long a command takes to execute. To use it, just type time
in front of the other command:
$ time make real 1m39.716s user 1m20.144s sys 0m15.076s
Note that the output shows three different times:
- real - the actual time taken to run the command
- user - the amount of time the CPU was running the command
- sys - the amount of time the CPU was performing kernel operations which were initiated by this command
In the example above, the make command took 1 minute 39.716 seconds to execute, of which 1 minute 20.144 seconds was spent executing the software and 15.076 seconds was spent running kernel code. During the remaining 4.496 seconds, make was not being executed -- either because the CPU was busy running other processes, or because make was waiting for input/output (I/O) -- for example, waiting for data to be read from disk.
Steps
- Select two packages from the GNU software collection.
- Download the code.
- Build each package on your Fedora system, noting each command used and the length of time taken.
The steps required to build a package vary, but generally include some combination of these steps:
- Unpack the tarball (
tar xvzf ...
) or zip file (unzip ...
) - Change to the directory containing the unpacked files. At this point, it's a good idea to read the build instructions, which are typically in a file named
INSTALL
orREADME
. - Run a script that configures the build for our particular system (typically
./configure
) - Run a script to build the software (typically
make
) - At this point, the software would usually be installed -- avoid doing this to avoid overwriting files on your system.
- Test the software by running it (if it can be run without installation) - you will have to find the binary.
If something goes wrong, read the error messages carefully to see if a tool or library needs to be installed.
Deliverable
Create a blog post describing your experience. Include:
- Notes on what you did, and what worked and didn't work.
- How long the process took.
- The results, including a link to the software you built.
Consider including relevant command output from the build process and/or screenshots of the freshly-built software.