Rebuilding a Package

Rebuilding a package is necessary if you can't find a prebuilt binary for your CPU architecture. It can sometimes help resolve dependency problems, too. If a package depends on newer versions of software than you have installed, rebuilding the package may work around that problem. Such dependencies sometimes originate in the source code, in which case rebuilding the package won't help; but if the dependency is an artifact of the chance fact that the original-build computer had a later library than you've got, then rebuilding will help.

With RPM versions 4.0 and earlier, you can rebuild a package using the -rebuild option to rpm. RPM 4.1, though, splits this functionality into a separate tool, rpmbuild. Other than the name of the executable, the procedure is identical. In its simplest form, you pass the name of the source RPM file to the RPM rebuilding utility:

# rpmbuild -rebuild manydep-2.31-6mdk.src.rpm

This command rebuilds the manydep package. The process takes anywhere from a few seconds to several hours, depending on the package size and your CPU speed. The result is a file for your architecture, such as manydep-2.31-6mdk.i586.rpm, stored in /usr/src/distname/RPMS/arch, where distname is a distribution-specific name (RPM for Mandrake, redhat for Red Hat, or packages for SuSE) and arch is a CPU architecture code. Once you've rebuilt a binary package, you can install it just like any other RPM.

Note You can rebuild most packages as an ordinary user, but only if that user has write permissions in the /usr/src/distname directory tree. Most distributions ship with this directory tree writeable only to root.

Unfortunately, rebuilding a package doesn't always work. One common source of problems is missing development tools or libraries. Typically, you'll see an error message shortly before the build operation completes complaining about the lack of a library. With luck, you'll be able to locate it and install it using the RPM Find database or a search of your installation media. In most cases, you'll need to install a package with devel in the name. For instance, if the build aborts and complains about the lack of obscurelib, you'll need to install both obscurelib and obscurelib-devel.

Team LiB

Team LiB

^ previous

0 0

Post a comment