在 Ubuntu 10.04 上安装 Mercurial 1.5.4

在 Ubuntu 10.04 上安装 Mercurial 1.5.4

我已经下载了源代码并尝试按照 README 说明进行安装:

sudo make install

但我收到以下错误:

python setup.py  build
running build
running build_mo
warning: hgbuildmo: could not find msgfmt executable, no translations will be built
running build_py
running build_ext
building 'mercurial.base85' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c mercurial/base85.c -o build/temp.linux-x86_64-2.6/mercurial/base85.o
mercurial/base85.c:12:20: error: Python.h: No such file or directory
mercurial/base85.c: In function ‘b85prep’:
mercurial/base85.c:23: warning: implicit declaration of function ‘memset’
mercurial/base85.c:23: warning: incompatible implicit declaration of built-in function ‘memset’
mercurial/base85.c: At top level:
mercurial/base85.c:28: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
mercurial/base85.c:76: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
mercurial/base85.c:147: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘methods’
mercurial/base85.c:156: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘initbase85’
error: command 'gcc' failed with exit status 1
make: *** [build] Error 1

请记住,我知道我可以使用以下方式安装:

sudo apt-get install mercurial

但这让我得到了一个旧版本(1.4.3-1)。

发生什么了?

答案1

来自以下行:

mercurial/base85.c:12:20: error: Python.h: No such file or directory

看来您没有 python 的开发工具。使用以下方法解决:

sudo apt-get install python-dev

答案2

您无需手动构建 Mercurial 即可在 Ubuntu 上获取最新版本。PPA 存储库位于https://launchpad.net/~mercurial-ppa/+archive/releases

sudo add-apt-repository ppa:mercurial-ppa/releases
sudo apt-get update
sudo apt-get install mercurial

顺便说一句。TortoiseHG 还有一个 PPA,它提供了 Mercurial 功能与 Nautilus 的良好集成:https://launchpad.net/~tortoisehg-ppa/+archive/releases

sudo add-apt-repository ppa:tortoisehg-ppa/releases
sudo apt-get update
sudo apt-get install tortoisehg-nautilus

答案3

您需要为 msgfmt 安装 gettext:

apt-get install gettext

相关内容