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

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 hereinstallwatch.c:3080: error: conflicting types for 'scandir'/usr/include/dirent.h:252: note: previous declaration of 'scandir' was hereinstallwatch.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 directoryThis is due to typo in &quot;checkinstall&quot;: 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 -Poption:
    LINE 471: $TAR --no-recursion -C &quot;${root}&quot; -cphf - $files | $TAR -f - -xvpPC \LINE 474: $TAR --no-recursion -C &quot;${root}&quot; -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 &quot;$SPEC_PATH&quot; &amp;&gt; ${TMP_DIR}/rpmbuild.log
  • I ended up messing with the $truefile variable to get tar the needed files:
    LINE 1775:  $TAR --no-recursion -C &quot;${TRANSLROOT}&quot; -cpPf - &quot;$truefile&quot; \LINE 1778: $TAR --no-recursion -C &quot;${TRANSLROOT}&quot; -cphPf - &quot;$truefile&quot; \
  • Remove line 1770 and insert:
    echo ${file} | grep symlink &gt; /dev/nullif [ $? -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.

From:http://www.patrickmin.com/linux/tip.php?name=checkinstall_fedora_13

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值