Difference between revisions of "RPM Package Manager"

From Christoph's Personal Wiki
Jump to: navigation, search
(Usage)
Line 21: Line 21:
  
 
An SRPM is an RPM package with source code. Unlike a [[Tar|tarball]] (or an RPM), an SRPM package can be automatically compiled and installed, following instructions in the .spec file included in the SRPM.
 
An SRPM is an RPM package with source code. Unlike a [[Tar|tarball]] (or an RPM), an SRPM package can be automatically compiled and installed, following instructions in the .spec file included in the SRPM.
 +
 +
==Recompile with -fPIC==
 +
see: [http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&chap=3 HOWTO fix -fPIC errors] for some background.
 +
Some 64-bit packages require the source to be compiled with the <code>-fPIC</code> option. For this example, I will be using LAPACK (64-bit version).
 +
 +
*Step #1: Download the source rpm (e.g., <code>lapack.src.rpm</code>)
 +
*Step #2: Install/unpack the package
 +
rpm -i lapack.src.rpm
 +
*Step #3: Add the <code>-fPIC</code> flag to the .SPEC file
 +
vi /usr/src/rpm/SPECS/lapack.spec
 +
    %define optflags ... -fPIC -DPIC ...
 +
*Step #4: Check that the option was compiled into the libary:
 +
nm /usr/lib64/liblapack.a|more
 +
 +
That should take care of errors that look something like this:
 +
/usr/lib64/liblapack.a: relocation R_X86_64_32 against `a local symbol' can not
 +
be used when making a shared object; recompile with -fPIC
  
 
==See also==
 
==See also==
Line 29: Line 46:
 
==External links==
 
==External links==
 
*[http://fedora.redhat.com/docs/drafts/rpm-guide-en/index.html Red Hat RPM Guide] from the Fedora project.
 
*[http://fedora.redhat.com/docs/drafts/rpm-guide-en/index.html Red Hat RPM Guide] from the Fedora project.
*Fox, Pennington, Red Hat [[2003]]: Fedora Project Developer's Guide: [http://fedora.redhat.com/participate/developers-guide/ch-rpm-building.html Chapter 4. Building RPM Packages]
+
*Fox, Pennington, Red Hat (2003): Fedora Project Developer's Guide: [http://fedora.redhat.com/participate/developers-guide/ch-rpm-building.html Chapter 4. Building RPM Packages]
 
*[http://www.rpm.org/ RPM Package Manager homepage]
 
*[http://www.rpm.org/ RPM Package Manager homepage]
 
*[http://www.redhatmagazine.com/2007/02/08/the-story-of-rpm/ The story of RPM] by Matt Frye in [http://www.redhatmagazine.com/ Red Hat Magazine]
 
*[http://www.redhatmagazine.com/2007/02/08/the-story-of-rpm/ The story of RPM] by Matt Frye in [http://www.redhatmagazine.com/ Red Hat Magazine]
 
*[http://www.hut.fi/~tkarvine/rpm-build-as-user.html RPM Building as a User]
 
*[http://www.hut.fi/~tkarvine/rpm-build-as-user.html RPM Building as a User]
*Bailey, Edward C. [[2000]]: [http://www.rpm.org/max-rpm/ Maximum RPM], an outdated but popular rpm reference
+
*Bailey, Edward C. (2000): [http://www.rpm.org/max-rpm/ Maximum RPM], an outdated but popular rpm reference
*Bailey, Edward C. [[2000]]: [http://rpm.org/max-rpm-snapshot/ Maximum RPM], actualized Maximum RPM edition
+
*Bailey, Edward C. (2000): [http://rpm.org/max-rpm-snapshot/ Maximum RPM], actualized Maximum RPM edition
 
*[http://developer.novell.com/wiki/index.php?title=SUSE_Package_Conventions SUSE Package Conventions]
 
*[http://developer.novell.com/wiki/index.php?title=SUSE_Package_Conventions SUSE Package Conventions]
 
*[http://www.linuxbase.org/spec/refspecs/LSB_1.3.0/gLSB/gLSB/swinstall.html Package File Format - Linux Standards Base]
 
*[http://www.linuxbase.org/spec/refspecs/LSB_1.3.0/gLSB/gLSB/swinstall.html Package File Format - Linux Standards Base]

Revision as of 02:04, 23 August 2007

RPM Package Manager (originally Red Hat Package Manager, abbreviated RPM) is a package management system.

Usage

Example

rpm -qa |grep glibc  # returns 'glibc-version', if installed
rpm -q --whatprovides /lib/libc.so.6  # returns 'glibc-version'
rpm -q --whatrequires python # returns the following
  lib64xml2-python-2.6.27-3mdv2007.1
  tkinter-2.5-4mdv2007.1
  python-imaging-1.1.4-11mdv2007.1
  python-numpy-1.0.1-2mdv2007.1
  python-numeric-24.2-4mdv2007.1
  lib64python2.5-devel-2.5-4.1mdv2007.1
  lib64python2.5-devel-2.5-4.1mdv2007.1

RPM file names normally have the following format:

<name>-<version>-<release>.<arch>.rpm

Source code may also be distributed in RPM packages. Such package labels do not have an architecture part and replace it with "src". E.g.:

libgnomeuimm2.0-2.0.0-3.src.rpm

An SRPM is an RPM package with source code. Unlike a tarball (or an RPM), an SRPM package can be automatically compiled and installed, following instructions in the .spec file included in the SRPM.

Recompile with -fPIC

see: HOWTO fix -fPIC errors for some background.

Some 64-bit packages require the source to be compiled with the -fPIC option. For this example, I will be using LAPACK (64-bit version).

  • Step #1: Download the source rpm (e.g., lapack.src.rpm)
  • Step #2: Install/unpack the package
rpm -i lapack.src.rpm
  • Step #3: Add the -fPIC flag to the .SPEC file
vi /usr/src/rpm/SPECS/lapack.spec
   %define optflags ... -fPIC -DPIC ...
  • Step #4: Check that the option was compiled into the libary:
nm /usr/lib64/liblapack.a|more

That should take care of errors that look something like this:

/usr/lib64/liblapack.a: relocation R_X86_64_32 against `a local symbol' can not 
be used when making a shared object; recompile with -fPIC

See also

External links