centos 6.9 安装checkinstall 的正确方法

一、解压

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

二、make编译
  可能会出现下面错误

            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

  解决办法:(红色部分是要改的)
  在第101行:

            static int (*true_scandir)( const char *,struct dirent ***,
            int (*)(const struct dirent *),
            int (*)(const void *,const void *));
                改成
            static int (*true_scandir)( const char *,struct dirent ***,
            int (*)(const struct dirent *),
            int (*)(const struct dirent **,const struct dirent **));

                第121行:

            static int (*true_scandir64)( const char *,struct dirent64 ***,
            int (*)(const struct dirent64 *),
            int (*)(const void *,const void *));
                改成
            static int (*true_scandir64)( const char *,struct dirent64 ***,
            int (*)(const struct dirent64 *),
            int (*)(const struct dirent64 **,const struct dirent64 **));

                第2941行:

            #if (GLIBC_MINOR <= 4)
                改成
            #if (0)
                第3080行:
            int scandir( const char *dir,struct dirent ***namelist,
            int (*select)(const struct dirent *),
            int (*compar)(const void *,const void *) ) {
                改成
            int scandir( const char *dir,struct dirent ***namelist,
            int (*select)(const struct dirent *),
            int (*compar)(const struct dirent **,const struct dirent **) ) {

                第3692行:
            int scandir64( const char *dir,struct dirent64 ***namelist,
            int (*select)(const struct dirent64 *),
            int (*compar)(const void *,const void *) ) {
                改成
            int scandir64( const char *dir,struct dirent64 ***namelist,
            int (*select)(const struct dirent64 *),
            int (*compar)(const struct dirent64 **,const struct dirent64 **) ) {

  

                    修改完成后再make安装

三、修改源文件夹下的checkinstall文件
  
行495:
CHECKINSTALLRC=${CHECKINSTALLRC:-${INSTALLDIR}/checkinstallrc}
改成
CHECKINSTALLRC=${CHECKINSTALLRC:-${INSTALLDIR}/lib/checkinstall/checkinstallrc}

            行2466:
        $RPMBUILD -bb ${RPM_TARGET_FLAG}${ARCHITECTURE} "$SPEC_PATH" &> ${TMP_DIR}/rpmbuild.log
            改成
        $RPMBUILD -bb ${RPM_TARGET_FLAG}${ARCHITECTURE} --buildroot $BROOTPATH "$SPEC_PATH" &> ${TMP_DIR}/rpmbuild.log

四、最后执行:make install

猜你喜欢

转载自blog.51cto.com/fanyk/2414590