checkinstall Centos6安装

下载最新版本的checkinstall:
 wget http://asic-linux.com.mx/~izto/checkinstall/files/source/checkinstall-1.6.2.tar.gz

tar -xvzf checkinstall-1.6.2.tar.tar
cd checkinstall-1.6.2
直接make 会报错

 
  
  1. installwatch.c:2942: error: conflicting types for 'readlink'  
  2. /usr/include/unistd.h:828: note: previous declaration of 'readlink' was here  
  3. installwatch.c:3080: error: conflicting types for 'scandir'  
  4. /usr/include/dirent.h:252: note: previous declaration of 'scandir' was here  
  5. installwatch.c:3692: error: conflicting types for 'scandir64'  
  6. /usr/include/dirent.h:275: note: previous declaration of 'scandir64' was here  


vim installwatch/installwatch.c

 

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 **));

 

 
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 **));

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
直接make install 虽然不会报错但是在使用checkinstall 的时候,会报错
“checkinstall error: File not found: /root/rpmbuild/BUILDROOT/”这种蛋疼的错误;

vim checkinstall
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

在使用makeinstall 的时候如果报“/root/rpmbuild has no SOURCES driectory”的错误,执行mkdir -p /root/rpmbuild/SOURCES命令;