Ubuntu如何安装pacman

1,wget 'ftp://ftp.archlinux.org/other/pacman/pacman-4.1.2.tar.gz'下载软件包
2,tar xvf pacman-4.1.2.tar.gz,解压缩软件
3,cd pacman-4.1.2/,进入代码,执行./configure,提示没有libarchive
4,执行sudo apt-get libarchive-dev安装libarchive
5,再次执行./configure,通过
6,执行make,出错
-------------------------------------------------------------------------------
  CC       libalpm_la-be_sync.lo
be_sync.c: In function '_alpm_validate_filename':
be_sync.c:499: error: 'PATH_MAX' undeclared (first use in this function)
be_sync.c:499: error: (Each undeclared identifier is reported only once
be_sync.c:499: error: for each function it appears in.)
make[3]: *** [libalpm_la-be_sync.lo] 错误 1
make[2]: *** [all-recursive] 错误 1
make[1]: *** [all-recursive] 错误 1
make: *** [all] 错误 2
--------------------------------------------------------------------------------
7,gedit lib/libalpm/be_sync.c,代码文件,找到代码
-------------------------------------------------------------------------------
static int _alpm_validate_filename(alpm_db_t *db, const char *pkgname,
        const char *filename)
{
    size_t len = strlen(filename);

    if(filename[0] == '.') {
        errno = EINVAL;
        _alpm_log(db->handle, ALPM_LOG_ERROR, _("%s database is inconsistent: filename "
                    "of package %s is illegal\n"), db->treename, pkgname);
        return -1;
    } else if(memchr(filename, '/', len) != NULL) {
        errno = EINVAL;
        _alpm_log(db->handle, ALPM_LOG_ERROR, _("%s database is inconsistent: filename "
                    "of package %s is illegal\n"), db->treename, pkgname);
        return -1;
    }
else if(len > PATH_MAX) {

        errno = EINVAL;
        _alpm_log(db->handle, ALPM_LOG_ERROR, _("%s database is inconsistent: filename "
                    "of package %s is too long\n"), db->treename, pkgname);
        return -1;

    }
    return 0;
}
-------------------------------------------------------------------------------
修改如下
-------------------------------------------------------------------------------
static int _alpm_validate_filename(alpm_db_t *db, const char *pkgname,
        const char *filename)
{
    size_t len = strlen(filename);

    if(filename[0] == '.') {
        errno = EINVAL;
        _alpm_log(db->handle, ALPM_LOG_ERROR, _("%s database is inconsistent: filename "
                    "of package %s is illegal\n"), db->treename, pkgname);
        return -1;
    } else if(memchr(filename, '/', len) != NULL) {
        errno = EINVAL;
        _alpm_log(db->handle, ALPM_LOG_ERROR, _("%s database is inconsistent: filename "
                    "of package %s is illegal\n"), db->treename, pkgname);
        return -1;
    }
/*
else if(len > PATH_MAX) {

        errno = EINVAL;
        _alpm_log(db->handle, ALPM_LOG_ERROR, _("%s database is inconsistent: filename "
                    "of package %s is too long\n"), db->treename, pkgname);
        return -1;

    }
*/
    return 0;
}
-------------------------------------------------------------------------------
保存,退出
7,执行make&& make install,等待安装完成。


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值