萬盛學電腦網

 萬盛學電腦網 >> Linux教程 >> Ubuntu安裝Pacman包管理器的步驟

Ubuntu安裝Pacman包管理器的步驟

  Ubuntu系統操作中,Pacman是一款軟件包管理器,能夠對官方的Arch庫和自己創建的軟件包進行管理,但是有時在安裝Pacman的時候會出錯,下面小編就給大家介紹下Ubuntu如何安裝Pacman。

 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;

  }

  -------------------------------------------------------------------------------

  保存,退出

  8,執行make&& make install,等待安裝完成。

  上面就是Ubuntu安裝Pacman的方法介紹了,通常安裝的時候會在執行make出錯,出錯後按照本文介紹的代碼進行安裝,最後再執行make&& make install完成安裝。

copyright © 萬盛學電腦網 all rights reserved