Build an RPM for the first time | bc > lesson in frustration

While the previous labs went smoothly, I spent a good portion of my weekend working on building these RPMs. My main issue was not understanding what error messages meant, and having to track down the solution to the issue. After completing the rpm build set up (which I will not go into, since those steps are outline in the lab), I will begin with the first package I built, bc.

Once there was a blank spec file in the appropriate directory, I decided to simply run rpmbuild -ba bc.spec to find out what would happen. I received the following error:

error: line 2: Empty tag: Version:

Obviously I needed to fill in some of the fields.

Name: bc
Version: 1.06.95
Release: 10%{?dist}
Summary: A calculator

License: GPLv2+
URL: http://www.gnu.org/software/bc/
Source0: ftp://alpha.gnu.org/pub/gnu/bc/bc-%{version}.tar.bz2

-ba’ing it again, I receive:
/bin/sh: line 9: makeinfo: command not found
/bin/sh: line 9: makeinfo: command not found

Doing some research, it seems a package is required to run the makeinfo command. To install the necessary package, I ran: yum install texinfo.x86_64. There isn’t much information out there stating that this is the package required for the makeinfo command, so some digging was required. Since, I need to install texinfo to perform the build, I added texinfo to the .spec file under BuildRequires.

-ba’ing it again!, I received:
error: Installed (but unpackaged) file(s) found:
/usr/bin/bc
/usr/bin/dc
/usr/share/info/bc.info.gz
/usr/share/info/dc.info.gz
/usr/share/info/dir
/usr/share/man/man1/bc.1.gz
/usr/share/man/man1/dc.1.gz

RPM build errors:
Installed (but unpackaged) file(s) found:
/usr/bin/bc
/usr/bin/dc
/usr/share/info/bc.info.gz
/usr/share/info/dc.info.gz
/usr/share/info/dir
/usr/share/man/man1/bc.1.gz
/usr/share/man/man1/dc.1.gz

At first I simply cut and pasted these lines under the %files tag, but then remembered Chris Tylers recommendation on using macros, so I ended up adding the following lines:

%{_bindir}/bc
%{_bindir}/dc
%{_infodir}/*
%{_mandir}/*/*

-ba’ing once again, the build completed with exit code 0 (or SUCCESS!). Now onto the lint tests. I did not run into any serious errors (disregarding changelog errors for now) until I tested the binary. Below is the output of rpmlint for .spec, src and the binary:


spec:
0 packages and 1 specfiles checked; 0 errors, 0 warnings.

src:
bc.src: E: no-changelogname-tag
1 packages and 0 specfiles checked; 1 errors, 0 warnings.

rpm:
bc.x86_64: E: no-changelogname-tag
bc.x86_64: E: info-dir-file /usr/share/info/dir
1 packages and 0 specfiles checked; 2 errors, 0 warnings.

To get more information on the bc.x86_64: E: info-dir-file /usr/share/info/dir error, I ran rpmlint with the -i trigger. The resulting message was thus:

bc.x86_64: E: info-dir-file /usr/share/info/dir
You have /usr/info/dir or /usr/share/info/dir in your package. It will cause
conflicts with other packages and thus is not allowed. Please remove it and
rebuild your package.


After some more research and reading the -i error message word for word, I realized that lint was requesting to delete that directory. Referencing blog posts from previous SBR600 students, I found that I needed to add rm -f $RPM_BUILD_ROOT/%{_infodir}/dir after %make_install. After this was added, the rpmlint roller went over spec file and the three RPMs with only the change log error. Upon adding an entry into the change log section and -ba’ing it again, I received the following for each lint test:

[shkim33@zeus SPECS]$ rpmlint bc.spec
0 packages and 1 specfiles checked; 0 errors, 0 warnings.

[shkim33@zeus SPECS]$ rpmlint /home/shkim33/rpmbuild/SRPMS/bc-1.06.95-10.fc19.src.rpm
1 packages and 0 specfiles checked; 0 errors, 0 warnings.

[shkim33@zeus SPECS]$ rpmlint /home/shkim33/rpmbuild/RPMS/x86_64/bc-1.06.95-10.fc19.x86_64.rpm
1 packages and 0 specfiles checked; 0 errors, 0 warnings.

[shkim33@zeus SPECS]$ rpmlint /home/shkim33/rpmbuild/RPMS/x86_64/bc-debuginfo-1.06.95-10.fc19.x86_64.rpm
1 packages and 0 specfiles checked; 0 errors, 0 warnings.

My second package was which. The process for building this pretty much went the same as the building process for bc. However, I ran into an error that I spent several hours on trying to correct.

which-debuginfo.x86_64: E: incorrect-fsf-address /usr/src/debug/which-2.20/getopt.h
which-debuginfo.x86_64: E: incorrect-fsf-address /usr/src/debug/which-2.20/tilde/xmalloc.h
which-debuginfo.x86_64: E: incorrect-fsf-address /usr/src/debug/which-2.20/tilde/tilde.c
which-debuginfo.x86_64: E: incorrect-fsf-address /usr/src/debug/which-2.20/bash.c
which-debuginfo.x86_64: E: incorrect-fsf-address /usr/src/debug/which-2.20/tilde/tilde.h

The second hit on google pointed to the fedoraproject where this error was on the Common Rpmlint issues. After speaking with the professor over IIRC, he provided a YouTube video link on how to fix the issue, but also stated that I should treat it as a warning. Wanting to remove the error from the list, I attempted to follow the instructions verbatim, however, I could not find the files in the locations specified. Speaking with the professor in class, it seems that the file with the errors in located elsewhere until another name. I will leave it for now, but I plan on revisiting the issue to get some hands on experience on doing it.

Links to the files are below:
WHICH:
which.spec
which-2.20-6.fc19.src.rpm
which-2.20-6.fc19.x86_64.rpm
which-debuginfo-2.20-6.fc19.x86_64.rpm

BC:
bc.spec
bc-1.06.95-10.fc19.src.rpm
bc-1.06.95-10.fc19.x86_64.rpm
which-debuginfo-2.20-6.fc19.x86_64.rpm

Trackbacks / Pingbacks

  1. Package vs tarball | sspaleta - September 19, 2013

Leave a comment