SaltyCrane Blog — Notes on JavaScript and web development

How to install Mercurial 1.0 on Ubuntu Hardy

Mercurial 1.0 is out! Mercurial is a next generation "fast, lightweight source control management system" boasting conversions by notable projects NetBeans, OpenJDK, Globulation2, Xine, Mozilla, grml, and OpenSolaris.

From the release notes, version 1.0 has improvements for copying, renaming, removing, and merging. I want to use the most robust version possible, so I decided to upgrade. Ubuntu Gutsy's Mercurial version is 0.9.4, and even Hardy will only have 0.9.5. Luckily, Mercurial 1.0 is easy-installable. That makes it easy to install:


Install Mercurial 1.0
  1. If you don't already have Mercurial 0.9.4 installed, I'd suggest installing it because it will setup /etc/mercurial for using Mercurial extenstions.
    sudo apt-get install mercurial
  2. Install Python Easy Install, build tools, and Python header files.
    sudo apt-get install python-setuptools python-dev build-essential
  3. Install Mercurial 1.0
    sudo easy_install -U mercurial
That was easy! Test it out by typing hg version.
Mercurial Distributed SCM (version 1.0)

Copyright (C) 2005-2008 Matt Mackall  and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Upgrade to 1.0.1
Update 6/2/2008: Mercurial 1.0.1 has been released as a bugfix version. You can upgrade from 1.0 to 1.0.1 using Easy Install:
sudo easy_install -U mercurial

Install hgk extension
If you try the hg view command, you will get a sh: hgk: not found error. To fix this, I copied the hgk executable from the contrib directory in the source package to a directory in my path:
  1. Download and unpack the Mercurial source package.
    cd /tmp
    wget http://www.selenic.com/mercurial/release/mercurial-1.0.tar.gz
    tar zxvf mercurial-1.0.tar.gz
  2. Copy hgk somewhere on your path. E.g.:
    cp mercurial-1.0/contrib/hgk ~/bin
Note, if you get a /usr/bin/env: wish: No such file or directory error, it means you need to install the Tk package:
sudo apt-get install tk8.5

Other Notes
  • hbisect warning
    Per the Upgrade Notes, bisect is now a built-in command and the hbisect extension should not be used. If you get a extension 'hgext/hbisect' overrides commands: bisect warning, remove the hbisect= line from your configuration file (located at /etc/mercurial/hgrc.d/hgext.rc or ~/.hgrc).

  • Where are the files located?
    The hgext and mercurial files should be located at /usr/lib/python2.5/site-packages/mercurial-1.0-py2.5-linux-*.egg

  • stdio.h error during easy_install
    If you got the following error while trying to run easy_install, it probably means you don't have the "build-essential" package installed. $ sudo apt-get install build-essential.
    In file included from /usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h:7,
                     from /usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h:11,
                     from /usr/include/python2.5/Python.h:18,
                     from mercurial/mpatch.c:23:
    /usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h:122:61: error: limits.h: No such file or directory
    In file included from mercurial/mpatch.c:23:
    /usr/include/python2.5/Python.h:32:19: error: stdio.h: No such file or directory
    /usr/include/python2.5/Python.h:34:5: error: #error "Python.h requires that stdio.h define NULL."
    /usr/include/python2.5/Python.h:37:20: error: string.h: No such file or directory
    /usr/include/python2.5/Python.h:39:19: error: errno.h: No such file or directory
    /usr/include/python2.5/Python.h:41:20: error: stdlib.h: No such file or directory
    /usr/include/python2.5/Python.h:43:20: error: unistd.h: No such file or directory
    /usr/include/python2.5/Python.h:55:20: error: assert.h: No such file or directory
    In file included from /usr/include/python2.5/Python.h:57,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/pyport.h:7:20: error: stdint.h: No such file or directory
    In file included from /usr/include/python2.5/Python.h:57,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/pyport.h:89: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Py_uintptr_t’
    /usr/include/python2.5/pyport.h:90: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Py_intptr_t’
    /usr/include/python2.5/pyport.h:113: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Py_ssize_t’
    /usr/include/python2.5/pyport.h:231:76: error: math.h: No such file or directory
    /usr/include/python2.5/pyport.h:238:22: error: sys/time.h: No such file or directory
    /usr/include/python2.5/pyport.h:239:18: error: time.h: No such file or directory
    /usr/include/python2.5/pyport.h:257:24: error: sys/select.h: No such file or directory
    /usr/include/python2.5/pyport.h:296:22: error: sys/stat.h: No such file or directory
    In file included from /usr/include/python2.5/Python.h:76,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/pymem.h:50: warning: parameter names (without types) in function declaration
    /usr/include/python2.5/pymem.h:51: error: expected declaration specifiers or ‘...’ before ‘size_t’
    In file included from /usr/include/python2.5/Python.h:78,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/object.h:104: error: expected specifier-qualifier-list before ‘Py_ssize_t’
    /usr/include/python2.5/object.h:108: error: expected specifier-qualifier-list before ‘Py_ssize_t’
    /usr/include/python2.5/object.h:131: error: expected declaration specifiers or ‘...’ before ‘*’ token
    /usr/include/python2.5/object.h:131: warning: type defaults to ‘int’ in declaration of ‘Py_ssize_t’
    /usr/include/python2.5/object.h:131: error: ‘Py_ssize_t’ declared as function returning a function
    /usr/include/python2.5/object.h:131: warning: function declaration isn’t a prototype
    /usr/include/python2.5/object.h:149: error: ‘readbufferproc’ declared as function returning a function
    /usr/include/python2.5/object.h:150: error: ‘writebufferproc’ declared as function returning a function
    /usr/include/python2.5/object.h:151: error: ‘segcountproc’ declared as function returning a function
    /usr/include/python2.5/object.h:152: error: ‘charbufferproc’ declared as function returning a function
    /usr/include/python2.5/object.h:215: error: expected specifier-qualifier-list before ‘lenfunc’
    /usr/include/python2.5/object.h:229: error: expected specifier-qualifier-list before ‘lenfunc’
    /usr/include/python2.5/object.h:244: error: expected declaration specifiers or ‘...’ before ‘FILE’
    /usr/include/python2.5/object.h:258: warning: ‘struct _typeobject’ declared inside parameter list
    /usr/include/python2.5/object.h:258: warning: its scope is only this definition or declaration, which is probably not what you want
    /usr/include/python2.5/object.h:259: warning: ‘struct _typeobject’ declared inside parameter list
    /usr/include/python2.5/object.h:262: error: field ‘ob_refcnt’ declared as a function
    /usr/include/python2.5/object.h:262: error: field ‘ob_size’ declared as a function
    /usr/include/python2.5/object.h:264: error: field ‘tp_basicsize’ declared as a function
    /usr/include/python2.5/object.h:264: error: field ‘tp_itemsize’ declared as a function
    /usr/include/python2.5/object.h:309: error: field ‘tp_weaklistoffset’ declared as a function
    /usr/include/python2.5/object.h:324: error: field ‘tp_dictoffset’ declared as a function
    /usr/include/python2.5/object.h:389: error: expected declaration specifiers or ‘...’ before ‘FILE’
    In file included from /usr/include/python2.5/Python.h:79,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/objimpl.h:97: warning: parameter names (without types) in function declaration
    /usr/include/python2.5/objimpl.h:98: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/python2.5/objimpl.h:228: error: ‘PyGC_Collect’ declared as function returning a function
    /usr/include/python2.5/objimpl.h:249: error: field ‘gc_refs’ declared as a function
    /usr/include/python2.5/objimpl.h:288: warning: parameter names (without types) in function declaration
    In file included from /usr/include/python2.5/Python.h:83,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/unicodeobject.h:55:19: error: ctype.h: No such file or directory
    /usr/include/python2.5/unicodeobject.h:118:21: error: wchar.h: No such file or directory
    In file included from /usr/include/python2.5/Python.h:83,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/unicodeobject.h:384: error: field ‘ob_refcnt’ declared as a function
    /usr/include/python2.5/unicodeobject.h:385: error: field ‘length’ declared as a function
    /usr/include/python2.5/unicodeobject.h:447: error: ‘PyUnicodeUCS4_GetSize’ declared as function returning a function
    /usr/include/python2.5/unicodeobject.h:521: warning: type defaults to ‘int’ in declaration of ‘wchar_t’
    /usr/include/python2.5/unicodeobject.h:521: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
    /usr/include/python2.5/unicodeobject.h:539: warning: type defaults to ‘int’ in declaration of ‘wchar_t’
    /usr/include/python2.5/unicodeobject.h:539: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
    /usr/include/python2.5/unicodeobject.h:1102: error: ‘PyUnicodeUCS4_Tailmatch’ declared as function returning a function
    /usr/include/python2.5/unicodeobject.h:1114: error: ‘PyUnicodeUCS4_Find’ declared as function returning a function
    /usr/include/python2.5/unicodeobject.h:1123: error: ‘PyUnicodeUCS4_Count’ declared as function returning a function
    In file included from /usr/include/python2.5/Python.h:84,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/intobject.h:24: error: field ‘ob_refcnt’ declared as a function
    /usr/include/python2.5/intobject.h:38: warning: parameter names (without types) in function declaration
    /usr/include/python2.5/intobject.h:41: error: ‘PyInt_AsSsize_t’ declared as function returning a function
    In file included from /usr/include/python2.5/Python.h:86,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/longobject.h:25: error: ‘_PyLong_AsSsize_t’ declared as function returning a function
    /usr/include/python2.5/longobject.h:26: warning: parameter names (without types) in function declaration
    /usr/include/python2.5/longobject.h:69: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_PyLong_NumBits’
    /usr/include/python2.5/longobject.h:85: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/python2.5/longobject.h:108: error: expected declaration specifiers or ‘...’ before ‘size_t’
    In file included from /usr/include/python2.5/Python.h:87,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/floatobject.h:15: error: field ‘ob_refcnt’ declared as a function
    In file included from /usr/include/python2.5/Python.h:89,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/complexobject.h:39: error: field ‘ob_refcnt’ declared as a function
    In file included from /usr/include/python2.5/Python.h:92,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/stringobject.h:36: error: field ‘ob_refcnt’ declared as a function
    /usr/include/python2.5/stringobject.h:36: error: field ‘ob_size’ declared as a function
    /usr/include/python2.5/stringobject.h:67: error: ‘PyString_Size’ declared as function returning a function
    In file included from /usr/include/python2.5/Python.h:94,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/tupleobject.h:25: error: field ‘ob_refcnt’ declared as a function
    /usr/include/python2.5/tupleobject.h:25: error: field ‘ob_size’ declared as a function
    /usr/include/python2.5/tupleobject.h:40: error: ‘PyTuple_Size’ declared as function returning a function
    In file included from /usr/include/python2.5/Python.h:95,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/listobject.h:23: error: field ‘ob_refcnt’ declared as a function
    /usr/include/python2.5/listobject.h:23: error: field ‘ob_size’ declared as a function
    /usr/include/python2.5/listobject.h:38: error: field ‘allocated’ declared as a function
    /usr/include/python2.5/listobject.h:47: error: ‘PyList_Size’ declared as function returning a function
    In file included from /usr/include/python2.5/Python.h:96,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/dictobject.h:55: error: field ‘me_hash’ declared as a function
    /usr/include/python2.5/dictobject.h:71: error: field ‘ob_refcnt’ declared as a function
    /usr/include/python2.5/dictobject.h:72: error: field ‘ma_fill’ declared as a function
    /usr/include/python2.5/dictobject.h:73: error: field ‘ma_used’ declared as a function
    /usr/include/python2.5/dictobject.h:79: error: field ‘ma_mask’ declared as a function
    /usr/include/python2.5/dictobject.h:108: error: ‘PyDict_Size’ declared as function returning a function
    In file included from /usr/include/python2.5/Python.h:98,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/setobject.h:36: error: field ‘ob_refcnt’ declared as a function
    /usr/include/python2.5/setobject.h:38: error: field ‘fill’ declared as a function
    /usr/include/python2.5/setobject.h:39: error: field ‘used’ declared as a function
    /usr/include/python2.5/setobject.h:45: error: field ‘mask’ declared as a function
    /usr/include/python2.5/setobject.h:79: error: ‘PySet_Size’ declared as function returning a function
    In file included from /usr/include/python2.5/Python.h:99,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/methodobject.h:82: error: field ‘ob_refcnt’ declared as a function
    In file included from /usr/include/python2.5/Python.h:101,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/funcobject.h:22: error: field ‘ob_refcnt’ declared as a function
    In file included from /usr/include/python2.5/Python.h:102,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/classobject.h:13: error: field ‘ob_refcnt’ declared as a function
    /usr/include/python2.5/classobject.h:24: error: field ‘ob_refcnt’ declared as a function
    /usr/include/python2.5/classobject.h:31: error: field ‘ob_refcnt’ declared as a function
    In file included from /usr/include/python2.5/Python.h:103,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/fileobject.h:11: error: field ‘ob_refcnt’ declared as a function
    /usr/include/python2.5/fileobject.h:12: error: expected specifier-qualifier-list before ‘FILE’
    /usr/include/python2.5/fileobject.h:38: error: expected ‘)’ before ‘*’ token
    /usr/include/python2.5/fileobject.h:40: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
    /usr/include/python2.5/fileobject.h:57: error: expected declaration specifiers or ‘...’ before ‘FILE’
    /usr/include/python2.5/fileobject.h:58: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Py_UniversalNewlineFread’
    In file included from /usr/include/python2.5/Python.h:105,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/traceback.h:13: error: field ‘ob_refcnt’ declared as a function
    In file included from /usr/include/python2.5/Python.h:106,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/sliceobject.h:23: error: field ‘ob_refcnt’ declared as a function
    In file included from /usr/include/python2.5/Python.h:107,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/cellobject.h:10: error: field ‘ob_refcnt’ declared as a function
    In file included from /usr/include/python2.5/Python.h:109,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/genobject.h:13: error: field ‘ob_refcnt’ declared as a function
    In file included from /usr/include/python2.5/Python.h:110,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/descrobject.h:46: error: field ‘ob_refcnt’ declared as a function
    /usr/include/python2.5/descrobject.h:50: error: field ‘ob_refcnt’ declared as a function
    /usr/include/python2.5/descrobject.h:55: error: field ‘ob_refcnt’ declared as a function
    /usr/include/python2.5/descrobject.h:60: error: field ‘ob_refcnt’ declared as a function
    /usr/include/python2.5/descrobject.h:65: error: field ‘ob_refcnt’ declared as a function
    In file included from /usr/include/python2.5/Python.h:111,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/weakrefobject.h:16: error: field ‘ob_refcnt’ declared as a function
    /usr/include/python2.5/weakrefobject.h:65: error: ‘_PyWeakref_GetWeakrefCount’ declared as function returning a function
    In file included from /usr/include/python2.5/Python.h:114,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/pyerrors.h:10: error: field ‘ob_refcnt’ declared as a function
    /usr/include/python2.5/pyerrors.h:17: error: field ‘ob_refcnt’ declared as a function
    /usr/include/python2.5/pyerrors.h:31: error: field ‘ob_refcnt’ declared as a function
    /usr/include/python2.5/pyerrors.h:44: error: field ‘ob_refcnt’ declared as a function
    /usr/include/python2.5/pyerrors.h:52: error: field ‘ob_refcnt’ declared as a function
    /usr/include/python2.5/pyerrors.h:329: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/python2.5/pyerrors.h:330: error: format string argument not a string type
    /usr/include/python2.5/pyerrors.h:331: error: expected declaration specifiers or ‘...’ before ‘size_t’
    In file included from /usr/include/python2.5/Python.h:118,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/pyarena.h:50: error: expected declaration specifiers or ‘...’ before ‘size_t’
    In file included from /usr/include/python2.5/Python.h:120,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/pythonrun.h:34: error: expected ‘)’ before ‘*’ token
    /usr/include/python2.5/pythonrun.h:35: error: expected ‘)’ before ‘*’ token
    /usr/include/python2.5/pythonrun.h:37: error: expected ‘)’ before ‘*’ token
    /usr/include/python2.5/pythonrun.h:38: error: expected ‘)’ before ‘*’ token
    /usr/include/python2.5/pythonrun.h:39: error: expected ‘)’ before ‘*’ token
    /usr/include/python2.5/pythonrun.h:44: error: expected ‘)’ before ‘*’ token
    /usr/include/python2.5/pythonrun.h:54: error: expected ‘)’ before ‘*’ token
    /usr/include/python2.5/pythonrun.h:60: error: expected ‘)’ before ‘*’ token
    /usr/include/python2.5/pythonrun.h:77: error: expected ‘)’ before ‘*’ token
    /usr/include/python2.5/pythonrun.h:142: error: expected ‘)’ before ‘*’ token
    /usr/include/python2.5/pythonrun.h:144: error: expected ‘)’ before ‘*’ token
    In file included from /usr/include/python2.5/Python.h:122,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/sysmodule.h:12: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
    In file included from /usr/include/python2.5/Python.h:124,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/import.h:33: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/python2.5/import.h:33: error: expected declaration specifiers or ‘...’ before ‘FILE’
    In file included from /usr/include/python2.5/Python.h:126,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/abstract.h:421: error: ‘PyObject_Size’ declared as function returning a function
    /usr/include/python2.5/abstract.h:433: error: ‘PyObject_Length’ declared as function returning a function
    /usr/include/python2.5/abstract.h:436: error: ‘_PyObject_LengthHint’ declared as function returning a function
    /usr/include/python2.5/abstract.h:774: error: ‘PyNumber_AsSsize_t’ declared as function returning a function
    /usr/include/python2.5/abstract.h:947: error: ‘PySequence_Size’ declared as function returning a function
    /usr/include/python2.5/abstract.h:956: error: ‘PySequence_Length’ declared as function returning a function
    /usr/include/python2.5/abstract.h:1078: error: ‘PySequence_Count’ declared as function returning a function
    /usr/include/python2.5/abstract.h:1097: error: ‘_PySequence_IterSearch’ declared as function returning a function
    /usr/include/python2.5/abstract.h:1122: error: ‘PySequence_Index’ declared as function returning a function
    /usr/include/python2.5/abstract.h:1161: error: ‘PyMapping_Size’ declared as function returning a function
    /usr/include/python2.5/abstract.h:1171: error: ‘PyMapping_Length’ declared as function returning a function
    In file included from /usr/include/python2.5/compile.h:5,
                     from /usr/include/python2.5/Python.h:128,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/code.h:11: error: field ‘ob_refcnt’ declared as a function
    In file included from /usr/include/python2.5/Python.h:131,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/pystrtod.h:11: error: expected declaration specifiers or ‘...’ before ‘size_t’
    In file included from /usr/include/python2.5/Python.h:151,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/pyfpe.h:129:20: error: signal.h: No such file or directory
    /usr/include/python2.5/pyfpe.h:130:20: error: setjmp.h: No such file or directory
    In file included from /usr/include/python2.5/Python.h:151,
                     from mercurial/mpatch.c:23:
    /usr/include/python2.5/pyfpe.h:132: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PyFPE_jbuf’
    mercurial/mpatch.c:54:24: error: sys/types.h: No such file or directory
    mercurial/mpatch.c:58:25: error: arpa/inet.h: No such file or directory
    mercurial/mpatch.c:60:23: error: inttypes.h: No such file or directory
    mercurial/mpatch.c: In function ‘lalloc’:
    mercurial/mpatch.c:77: error: ‘NULL’ undeclared (first use in this function)
    mercurial/mpatch.c:77: error: (Each undeclared identifier is reported only once
    mercurial/mpatch.c:77: error: for each function it appears in.)
    mercurial/mpatch.c:82: warning: implicit declaration of function ‘malloc’
    mercurial/mpatch.c:82: warning: incompatible implicit declaration of built-in function ‘malloc’
    mercurial/mpatch.c:89: warning: implicit declaration of function ‘free’
    mercurial/mpatch.c: In function ‘combine’:
    mercurial/mpatch.c:197: error: ‘NULL’ undeclared (first use in this function)
    mercurial/mpatch.c:224: warning: implicit declaration of function ‘memcpy’
    mercurial/mpatch.c:224: warning: incompatible implicit declaration of built-in function ‘memcpy’
    mercurial/mpatch.c: In function ‘decode’:
    mercurial/mpatch.c:244: error: ‘NULL’ undeclared (first use in this function)
    mercurial/mpatch.c:249: warning: incompatible implicit declaration of built-in function ‘memcpy’
    mercurial/mpatch.c:250: warning: implicit declaration of function ‘ntohl’
    mercurial/mpatch.c:250: error: ‘uint32_t’ undeclared (first use in this function)
    mercurial/mpatch.c:250: error: expected expression before ‘)’ token
    mercurial/mpatch.c:251: error: expected expression before ‘)’ token
    mercurial/mpatch.c:252: error: expected expression before ‘)’ token
    mercurial/mpatch.c: In function ‘apply’:
    mercurial/mpatch.c:310: warning: incompatible implicit declaration of built-in function ‘memcpy’
    mercurial/mpatch.c:317: warning: incompatible implicit declaration of built-in function ‘memcpy’
    mercurial/mpatch.c: In function ‘fold’:
    mercurial/mpatch.c:330: warning: passing argument 2 of ‘PyList_GetItem’ makes pointer from integer without a cast
    mercurial/mpatch.c:332: error: ‘NULL’ undeclared (first use in this function)
    mercurial/mpatch.c:335: warning: passing argument 2 of ‘decode’ makes integer from pointer without a cast
    mercurial/mpatch.c: In function ‘patches’:
    mercurial/mpatch.c:355: error: ‘NULL’ undeclared (first use in this function)
    mercurial/mpatch.c:360: error: ‘PyObject’ has no member named ‘ob_refcnt’
    mercurial/mpatch.c:371: warning: passing argument 1 of ‘calcsize’ makes integer from pointer without a cast
    mercurial/mpatch.c:376: warning: passing argument 2 of ‘PyString_FromStringAndSize’ makes pointer from integer without a cast
    mercurial/mpatch.c:382: warning: passing argument 3 of ‘apply’ makes integer from pointer without a cast
    mercurial/mpatch.c:383: error: ‘PyObject’ has no member named ‘ob_refcnt’
    mercurial/mpatch.c:383: error: ‘PyObject’ has no member named ‘ob_type’
    mercurial/mpatch.c: In function ‘patchedsize’:
    mercurial/mpatch.c:401: error: ‘NULL’ undeclared (first use in this function)
    mercurial/mpatch.c:407: warning: incompatible implicit declaration of built-in function ‘memcpy’
    mercurial/mpatch.c:408: error: ‘uint32_t’ undeclared (first use in this function)
    mercurial/mpatch.c:408: error: expected expression before ‘)’ token
    mercurial/mpatch.c:409: error: expected expression before ‘)’ token
    mercurial/mpatch.c:410: error: expected expression before ‘)’ token
    mercurial/mpatch.c: At top level:
    mercurial/mpatch.c:435: error: ‘NULL’ undeclared here (not in a function)
    mercurial/mpatch.c: In function ‘initmpatch’:
    mercurial/mpatch.c:442: warning: passing argument 2 of ‘PyErr_NewException’ from incompatible pointer type
    mercurial/mpatch.c:442: warning: passing argument 3 of ‘PyErr_NewException’ from incompatible pointer type
    error: Setup script exited with error: command 'gcc' failed with exit status 1
    
  • Python.h error during easy_install
    If you got the following error while trying to run easy_install, it probably means you don't have the "python-dev" package installed. $ sudo apt-get install python-dev.
    Searching for mercurial
    Reading http://cheeseshop.python.org/pypi/mercurial/
    Couldn't find index page for 'mercurial' (maybe misspelled?)
    Scanning index of all packages (this may take a while)
    Reading http://cheeseshop.python.org/pypi/
    Reading http://cheeseshop.python.org/pypi/Mercurial/1.0
    Reading http://www.selenic.com/mercurial
    Best match: mercurial 1.0
    Downloading http://www.selenic.com/mercurial/release/mercurial-1.0.tar.gz
    Processing mercurial-1.0.tar.gz
    Running mercurial-1.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-MfmZhU/mercurial-1.0/egg-dist-tmp-JDYH6V
    mercurial/mpatch.c:23:20: error: Python.h: No such file or directory
    mercurial/mpatch.c:64: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
    mercurial/mpatch.c: In function 'lalloc':
    mercurial/mpatch.c:92: warning: implicit declaration of function 'PyErr_Occurred'
    mercurial/mpatch.c:93: warning: implicit declaration of function 'PyErr_NoMemory'
    mercurial/mpatch.c: In function 'decode':
    mercurial/mpatch.c:265: warning: implicit declaration of function 'PyErr_SetString'
    mercurial/mpatch.c:265: error: 'mpatch_Error' undeclared (first use in this function)
    mercurial/mpatch.c:265: error: (Each undeclared identifier is reported only once
    mercurial/mpatch.c:265: error: for each function it appears in.)
    mercurial/mpatch.c: In function 'calcsize':
    mercurial/mpatch.c:283: error: 'mpatch_Error' undeclared (first use in this function)
    mercurial/mpatch.c: In function 'apply':
    mercurial/mpatch.c:306: error: 'mpatch_Error' undeclared (first use in this function)
    mercurial/mpatch.c: At top level:
    mercurial/mpatch.c:322: error: expected ')' before '*' token
    mercurial/mpatch.c:344: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
    mercurial/mpatch.c:392: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
    mercurial/mpatch.c:432: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'methods'
    mercurial/mpatch.c:439: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'initmpatch'
    error: Setup script exited with error: command 'gcc' failed with exit status 1
  • Couldn't find a setup script Error:
    If you get the following error when trying to run sudo easy_install -U mercurial, it could mean that there is a "mercurial" directory in your current working directory. Change to a different directory and run the command again.
    Processing mercurial
    error: Couldn't find a setup script in mercurial
  • error: can't create or remove files in install directory
    error: can't create or remove files in install directory
    
    The following error occurred while trying to add or remove files in the
    installation directory:
    
        [Errno 13] Permission denied: '/usr/lib/python2.5/site-packages/test-easy-install-28328.write-test'
    
    The installation directory you specified (via --install-dir, --prefix, or
    the distutils default setting) was:
    
        /usr/lib/python2.5/site-packages/
    
    Perhaps your account does not have write access to this directory?  If the
    installation directory is a system-owned directory, you may need to sign in
    as the administrator or "root" account.  If you do not have administrative
    access to this machine, you may wish to choose a different installation
    directory, preferably one that is listed in your PYTHONPATH environment
    variable.
    
    For information on other options, you may wish to consult the
    documentation at:
      
      http://peak.telecommunity.com/EasyInstall.html
    
    Please make the appropriate changes for your system and try again.
    You will get this error if you don't use the sudo command. Use
    $ sudo easy_install -U mercurial

Comments


#1 Jiri commented on :

Thanks for your blog. It's helped me to rid of intrusive

***** failed to import extension hgext.hbisect: No module named hbisect**

#2 romikt commented on :

Won't this confuse the package manager?
I've just installed Mercurial 1.0.1 on Ubuntu Hardy from Debian Unstable repo. I think it is a better way.


#3 sofeng commented on :

romikt,
thanks for the comment. you're probably right-- Easy Install is like a package manager so the two will probably have some conflicts. I just found this the easiest way to have to most up to date Mercurial.


#4 Arvind Gupta commented on :

Hi Thanks for the tutorial. I have installed it on ubuntu jaunty, with current mercurial version 1.2.1


#5 Eliot commented on :

Arvind,
Thanks for the updated information. I'm glad to hear this process still works with the latest versions.


#6 Eshan commented on :

Installed mercurial 1.4.3. Thanks for the useful information.


#7 idigitall commented on :

useful info; still works upgrading to 1.5


#8 Renato commented on :

Usefull and still works for 1.6 Thanks for the info.


#9 cape1232 commented on :

Had the /usr/bin/env: wish: No such file or directory error and found your solution here. Saved me lots of time figuring out what that meant. Thanks.