Compiling

From Lustre Wiki
Jump to: navigation, search

This is an unfinished guide to compiling Lustre beginning with retrieving the source tree from a git repository.

Checking out the code

Bootstrapping

Straight from the git repository the Lustre source tree is not ready to be built. First we must bootstrap the build system into place before any configuration, compilation, and/or packaging can take place.

Autotools (autoconf, automake, libtool) form the basis of Lustre's build system. The bootstrapping step is a requirement for any system built on autotools. When it comes to storing your source code in a source repository, there are two schools of thought when it comes to what to do with the products of the bootstrapping process: refresh and commit the bootstrap products to the source repository every time a build system file is modified, or never commit the products and just bootstrap before building. There are advantages and disadvantages to both approaches. Lustre chose the latter; we do not check the bootstrap products into the repository.

The name of Lustre's bootstrapping scripts is autogen.sh. After checking out a fresh copy of the Lustre tree, run the following command from the base of the tree:

sh autogen.sh

Once autogen.sh is run, the tree will now contain, among other things, the generated configure file, Makefiles and autoMakefiles. These files are all ignored by git because we have listed them in the appropriate .gitignore files. As mentioned earlier, it is our policy to never commit the bootstrap products into the repository.

Now we can procedure to the configuration step.

Configuration

The configure script, generated by automake during the bootstrapping step.

Configuring for development

Configuring for packaging

If our end goal is to generate packages ready for general distribution, we will want to approach the configuration step a little differently than we would if we were configuring as part of an individual developer's work flow. Immediately after bootstrapping we want to generate the canonical full tarball of the source code.

It is very important at this step to not make any decisions during the configuration step at this point that would in change the contents of the tarball. That tarball must include the full sources. (The decisions about kernel choice, which OSD, etc. will be made later when the tarball is unpacked and configure is run again to actually test the environment and make decisions about how the sources need to be built.) Since we are not making decisions about the environment yet, we can bypass most of the normal checks that we do when we run configure. In lustre we do that like so:

./configure --enable-dist

To make the canonical tarball, we employ the dist make target. The dist target is generated by the autotools in the bootstrapping step. The Makefiles themselves are generated by autotools as well. Even though we are not yet at the stage when we we want to determine the configuration settings for a specific build environment, we need to run configure to allow us to run make dist. When we run the command, it will generate the cannonical tarball of the source code, ready for distribution (hence the name dist).

Now, we can finally generate the canonical tarball with the following command:

make dist


Configure the build system

Compile the code

Packaging Lustre

Preparing for packaging

Building RPM Packages