Linux tip, Fedora tip / howto: Compiling checkinstall for Fedora 13/15/17 x86_64, and for RHEL6 x86_64

 
Note that these tips are mostly outdated


back to notes and tips index

Try my online puzzle page with Calcudoku, Killer Sudoku and online Sudoku.

Compiling checkinstall for Fedora 13/15/17 x86_64, and for RHEL6 x86_64

It's a pity there isn't just a checkinstall RPM in a repository somewhere, getting this to compile and run under Fedora 13 (x86_64) was a pain. Notes for RHEL6 are at the bottom of this page.

First, get the source, which was version 1.6.2 as of this writing.

Then:
tar zxvf checkinstall-1.6.2.tar.gz
cd checkinstall-1.6.2

If you then run make, as the INSTALL file tells you to do, you run into compilation errors:

installwatch.c:2942: error: conflicting types for 'readlink' /usr/include/unistd.h:828: note: previous declaration of 'readlink' was here installwatch.c:3080: error: conflicting types for 'scandir' /usr/include/dirent.h:252: note: previous declaration of 'scandir' was here installwatch.c:3692: error: conflicting types for 'scandir64' /usr/include/dirent.h:275: note: previous declaration of 'scandir64' was here To fix these, load the file installwatch/installwatch.c into an editor, and modify these lines:
  • at line 101, change: static int (*true_scandir)( const char *,struct dirent ***, int (*)(const struct dirent *), int (*)(const void *,const void *)); to: static int (*true_scandir)( const char *,struct dirent ***, int (*)(const struct dirent *), int (*)(const struct dirent **,const struct dirent **)); (i.e. just change the types in the last line from const void * to const struct dirent **)
  • at line 121, change: static int (*true_scandir64)( const char *,struct dirent64 ***, int (*)(const struct dirent64 *), int (*)(const void *,const void *)); to: static int (*true_scandir64)( const char *,struct dirent64 ***, int (*)(const struct dirent64 *), int (*)(const struct dirent64 **,const struct dirent64 **)); (i.e. same change with 64 added)
  • at line 2941, change:
    #if (GLIBC_MINOR <= 4)
    to:
    #if (0)
  • at line 3080, change: int scandir( const char *dir,struct dirent ***namelist, int (*select)(const struct dirent *), int (*compar)(const void *,const void *) ) { to: int scandir( const char *dir,struct dirent ***namelist, int (*select)(const struct dirent *), int (*compar)(const struct dirent **,const struct dirent **) ) {
  • at line 3692, change: int scandir64( const char *dir,struct dirent64 ***namelist, int (*select)(const struct dirent64 *), int (*compar)(const void *,const void *) ) { to: int scandir64( const char *dir,struct dirent64 ***namelist, int (*select)(const struct dirent64 *), int (*compar)(const struct dirent64 **,const struct dirent64 **) ) {

Make sure you have rpm-build and rpmdevtools installed:
yum install rpm-build rpmdevtools (as root)

Now, in the checkinstall-1.6.2 directory, run:
make

Next, edit the file checkinstall itself:

  • at line 495, change: CHECKINSTALLRC=${CHECKINSTALLRC:-${INSTALLDIR}/checkinstallrc}
    to:
    CHECKINSTALLRC=${CHECKINSTALLRC:-${INSTALLDIR}/lib/checkinstall/checkinstallrc}
  • at line 2466, change: $RPMBUILD -bb ${RPM_TARGET_FLAG}${ARCHITECTURE} "$SPEC_PATH" &> ${TMP_DIR}/rpmbuild.log
    to:
    $RPMBUILD -bb ${RPM_TARGET_FLAG}${ARCHITECTURE} --buildroot $BROOTPATH "$SPEC_PATH" &> ${TMP_DIR}/rpmbuild.log
Now, as root, run:
make install

You can now create a checkinstall RPM by running it (note the full path):
/usr/local/sbin/checkinstall

One more error...

As soon as an installation tries to do something with temporary files/directories, checkinstall will fail, for example, when running it for php-5.2.14: Installing PHP CLI binary: /usr/bin/ chmod: changing permissions of `/usr/bin/#INST@10957#': No such file or directory The fix, apparently, is to run checkinstall with the --fstrans=no parameter, so for example:
checkinstall -R -y --fstrans=no

And another...

Roman wrote to me the following (21 October 2011): Another bug, that line occurs in output: cp: cannot stat `//var/tmp/tmp.tcgjDbWwz6/newfiles.tmp': No such file or directory This is due to typo in "checkinstall": it using '/${TMP_DIR}/...' instead '${TMP_DIR}/...' I suggest this fix before making rpm/deb package of checkinstall itself: sed -i '.orig' -e 's/\/${TMP_DIR}/${TMP_DIR}/g' checkinstall


Compiling for Red Hat Enterprise Linux 6 (RHEL6), x86_64

Sean Kenn got checkinstall to work under RHEL6, after these modifications (May 30, 2012) (LINE <nr> refers to the line number in the checkinstall file):
  • just to get rid of the tar message that shows up (tar: Removing leading '/' from member names), add the -P option: LINE 471: $TAR --no-recursion -C "${root}" -cphf - $files | $TAR -f - -xvpPC \ LINE 474: $TAR --no-recursion -C "${root}" -cpf - $files | $TAR -f - -xvpPC \
  • $INSTALLDIR variable was wrong (This could probably be fixed in the followlinks function but I just wrote the path out on this line): LINE 495: CHECKINSTALLRC=${CHECKINSTALLRC:-/usr/local/lib/checkinstall/checkinstallrc}
  • Removed the '/' in front of ${TMP_DIR} on these lines. Also added --buildroot $BROOTPATH: LINE 2466: $RPMBUILD -bb ${RPM_TARGET_FLAG}${ARCHITECTURE} --buildroot $BROOTPATH "$SPEC_PATH" &> ${TMP_DIR}/rpmbuild.log
  • I ended up messing with the $truefile variable to get tar the needed files: LINE 1775: $TAR --no-recursion -C "${TRANSLROOT}" -cpPf - "$truefile" \ LINE 1778: $TAR --no-recursion -C "${TRANSLROOT}" -cphPf - "$truefile" \
  • Remove line 1770 and insert: echo ${file} | grep symlink > /dev/null if [ $? -ne 0 ] ; then truefile=`echo ${file} | sed 's/^\.//' | awk '{print $3}'` else truefile=`echo ${file} | sed 's/^\.//' | awk '{print $4}'` fi


Another fix, for RHEL/CentOS 6.3

An anonymous reader writes:

New rpm version 4.8.0 shows --version in format "RPM-Version 4.8.0" while former versions had e.g. the format "RPM, Version 4.4.2.3". So there is no $3 for awk and the checkinstall script breaks.

change line 2289 (line number is after applying the patch from Sean Kenn !) from:
RPM_VERSION=`rpm --version | awk '{ print $3 }'`
to:
RPM_VERSION=`rpm --version | sed "s/^.* \([0-9]\)/\1/"

He/she provided a patch: checkinstall-1.6.2.patch_for_RHEL6-x86_64.


Another fix, for Fedora 17, x86_64

A user reported that for Fedora 17, x86_64, a line had to be changed in checkinstall-1.6.2/installwatch/Makefile:
line 14, from:
LIBDIR=$(PREFIX)/lib
to
LIBDIR=$(PREFIX)/lib64

Another user reported that this fix was also required for Fedora 15, x86_64. The error message he got when running checkinstall:
ERROR: ld.so: object '/usr/local/lib64/installwatch.so' from LD_PRELOAD cannot be preloaded: ignored.



Another checkinstall issue is described in this tip.


← back to notes and tips index
Please do not copy the text of this tip (© Patrick Min) to your web site.