Whole document tree
    

Whole document tree

RPM-for-Unix HOW-TO: Compiling RPM Next Previous Contents

4. Compiling RPM

After building Berkeley DB3 and gcc, compile rpm program now. Get rpm source code from one of the following two sources:

If you downloaded rpm*.tar.gz file:


bash$ mkdir my_temp_build
bash$ cd my_temp_build
bash$ tar zxvf rpm*.tar.gz
bash$ cd rpm-4.0.2
bash$ export LIBS='-L/usr/local/BerkeleyDB.3.1/lib'
bash$ export CPPFLAGS='-I/usr/local/BerkeleyDB.3.1/include'
bash$ ./configure
bash$ make

If you downloaded rpm source code file follow the steps below. But you may need rpm2cpio program, which is packaged in rpm package. Get rpm package (may be old version like 3.0) from Unix packages .


bash$ mkdir my_temp_build
bash$ cd my_temp_build
bash$ rpm2cpio rpm-4.0.2-8.src.rpm | cpio -dimv 
bash$ tar zxvf rpm*.tar.gz
bash$ cd rpm-4.0.2
bash$ export LIBS='-L/usr/local/BerkeleyDB.3.1/lib'
bash$ export CPPFLAGS='-I/usr/local/BerkeleyDB.3.1/include'
bash$ ./configure
bash$ make

4.1 Troubleshooting RPM Compile

If you encounter any problem in compiling rpm program, you may have to do some minor corrections.

In case of Solaris 8 and rpm v4.0.2, I got these problems:

  • Error db3/db.h not found in lib/db3.c. Solution is - create a soft link:
    bash# ln -s /usr/local/BerkeleyDB.3.1.17/include  /usr/include/db3
    
    Or edit the file lib/db3.c and change 
    #include <db3/db.h> 
    to 
    #include <db.h> 
    

  • Edit Makefile and put -L before libmisc.a at line 186

  • Compile error in file rpmsort.c: Function errx() not found. Solution is - edit the file rpmsort.c and copy and paste the function errx() from misc/err*.c. Or comment out line having errx() and put fprintf(stderr, "Error encountered - blah, blah"); exit(0);

Next Previous Contents