[LBo] Compilation problem

Niki Kovacs contact at kikinovak.net
Thu Nov 22 19:54:56 CET 2007


Robin a écrit :

> Thanx Niki,am gonna try lookup that now. and see whether i can get it to
> work, maybe a quick one is it like a tool or u mean like .rpm ext?

No, source RPM's or SRPM's. I'll explain by example. I use CentOS 5.0 on 
many desktops here. Once in a while, I need a package that's not 
included in the distribution. So what I do is check on 
http://rpm.pbone.net if I can find an SRPM for Fedora Core 6 (which is 
essentially RHEL5's beta :oD). I'll download and install that SRPM like 
this:

# rpm -ivh foo-1.0-src.rpm

This installs me 1) the sources of foo in /usr/src/redhat/SOURCES, and 
2) foo.spec in /usr/src/redhat/SPECS. A spec file is basically a script 
that automates the compilation process.

Then I build the package:

# rpmbuild -bb --clean foo.spec

After the build process, I get a nice (binary) RPM in 
/usr/src/redhat/RPMS, which I can install simply with rpm -ivh.

Of course, more often than not, I have to hunt down some dependencies, 
either with yum, or I have to build the dependencies (again) from SRPM's.

Beware: if you use SuSE, only use SuSE SRPMs. If you use Mandriva, 
Fedora or PLD SRPM's, you're in for a lot of trouble.

Ah, yes:

1) To be able to build SRPMs on my machine, it's a good idea to install 
gcc, gcc-c++, rpm-build and kernel-devel.

2) In fact, I described a simplified build process to you: I use a 
tweaked process where I can build packages as a simple user. This avoids 
wrecking my system in case a spec file is badly written :o|

My advice: check the docs for building RPMs from SRPMs on your distro. 
It's really worth it. An afternoon of experimenting, and then a whole 
lot less trouble afterwards.

cheers,

Niki


More information about the QnA mailing list