views:

1649

answers:

3

I'm attempting to build mercurial 1.3.1. I've attempted this thus far on my Mac OS X machine and on a Linux Ubuntu virtual machine that I'm running.

I keep getting errors while running the make. I know there are binaries availble for both Linux and Mac, but I want to build my own copy. I've always skipped out on building and I want to learn how to do this.

But now, I need help. Here is the results from the entire build process from my Ubuntu Linux v9.04 machine... The error error: Python.h: No such file or directory towards the end. I've included all of the results in case this helps someone trouble shoot.

frank@ubuntu:~/Desktop/mercurial-1.3.1$ sudo make install
[sudo] password for frank: 
python setup.py  build
running build
running build_py
creating build
creating build/lib.linux-i686-2.6
creating build/lib.linux-i686-2.6/mercurial
copying mercurial/dirstate.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/bundlerepo.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/subrepo.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/httprepo.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/__version__.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/changelog.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/repo.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/config.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/byterange.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/verify.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/encoding.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/keepalive.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/sshserver.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/fancyopts.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/__init__.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/merge.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/i18n.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/archival.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/match.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/mail.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/help.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/win32.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/posix.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/repair.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/dispatch.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/error.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/templatefilters.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/localrepo.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/sshrepo.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/node.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/templater.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/streamclone.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/context.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/strutil.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/ignore.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/hook.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/mdiff.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/ui.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/lsprofcalltree.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/transaction.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/commands.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/windows.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/revlog.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/store.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/lock.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/changegroup.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/lsprof.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/manifest.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/url.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/util.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/demandimport.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/graphmod.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/statichttprepo.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/cmdutil.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/extensions.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/filemerge.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/hg.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/filelog.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/copies.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/hbisect.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/patch.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/ancestor.py -> build/lib.linux-i686-2.6/mercurial
copying mercurial/simplemerge.py -> build/lib.linux-i686-2.6/mercurial
creating build/lib.linux-i686-2.6/mercurial/hgweb
copying mercurial/hgweb/webutil.py -> build/lib.linux-i686-2.6/mercurial/hgweb
copying mercurial/hgweb/request.py -> build/lib.linux-i686-2.6/mercurial/hgweb
copying mercurial/hgweb/wsgicgi.py -> build/lib.linux-i686-2.6/mercurial/hgweb
copying mercurial/hgweb/protocol.py -> build/lib.linux-i686-2.6/mercurial/hgweb
copying mercurial/hgweb/server.py -> build/lib.linux-i686-2.6/mercurial/hgweb
copying mercurial/hgweb/__init__.py -> build/lib.linux-i686-2.6/mercurial/hgweb
copying mercurial/hgweb/common.py -> build/lib.linux-i686-2.6/mercurial/hgweb
copying mercurial/hgweb/hgwebdir_mod.py -> build/lib.linux-i686-2.6/mercurial/hgweb
copying mercurial/hgweb/webcommands.py -> build/lib.linux-i686-2.6/mercurial/hgweb
copying mercurial/hgweb/hgweb_mod.py -> build/lib.linux-i686-2.6/mercurial/hgweb
creating build/lib.linux-i686-2.6/hgext
copying hgext/pager.py -> build/lib.linux-i686-2.6/hgext
copying hgext/purge.py -> build/lib.linux-i686-2.6/hgext
copying hgext/graphlog.py -> build/lib.linux-i686-2.6/hgext
copying hgext/win32text.py -> build/lib.linux-i686-2.6/hgext
copying hgext/gpg.py -> build/lib.linux-i686-2.6/hgext
copying hgext/hgk.py -> build/lib.linux-i686-2.6/hgext
copying hgext/color.py -> build/lib.linux-i686-2.6/hgext
copying hgext/bugzilla.py -> build/lib.linux-i686-2.6/hgext
copying hgext/bookmarks.py -> build/lib.linux-i686-2.6/hgext
copying hgext/__init__.py -> build/lib.linux-i686-2.6/hgext
copying hgext/notify.py -> build/lib.linux-i686-2.6/hgext
copying hgext/record.py -> build/lib.linux-i686-2.6/hgext
copying hgext/interhg.py -> build/lib.linux-i686-2.6/hgext
copying hgext/rebase.py -> build/lib.linux-i686-2.6/hgext
copying hgext/churn.py -> build/lib.linux-i686-2.6/hgext
copying hgext/keyword.py -> build/lib.linux-i686-2.6/hgext
copying hgext/mq.py -> build/lib.linux-i686-2.6/hgext
copying hgext/transplant.py -> build/lib.linux-i686-2.6/hgext
copying hgext/acl.py -> build/lib.linux-i686-2.6/hgext
copying hgext/children.py -> build/lib.linux-i686-2.6/hgext
copying hgext/fetch.py -> build/lib.linux-i686-2.6/hgext
copying hgext/extdiff.py -> build/lib.linux-i686-2.6/hgext
copying hgext/win32mbcs.py -> build/lib.linux-i686-2.6/hgext
copying hgext/share.py -> build/lib.linux-i686-2.6/hgext
copying hgext/parentrevspec.py -> build/lib.linux-i686-2.6/hgext
copying hgext/hgcia.py -> build/lib.linux-i686-2.6/hgext
copying hgext/patchbomb.py -> build/lib.linux-i686-2.6/hgext
creating build/lib.linux-i686-2.6/hgext/convert
copying hgext/convert/bzr.py -> build/lib.linux-i686-2.6/hgext/convert
copying hgext/convert/convcmd.py -> build/lib.linux-i686-2.6/hgext/convert
copying hgext/convert/gnuarch.py -> build/lib.linux-i686-2.6/hgext/convert
copying hgext/convert/cvsps.py -> build/lib.linux-i686-2.6/hgext/convert
copying hgext/convert/__init__.py -> build/lib.linux-i686-2.6/hgext/convert
copying hgext/convert/git.py -> build/lib.linux-i686-2.6/hgext/convert
copying hgext/convert/p4.py -> build/lib.linux-i686-2.6/hgext/convert
copying hgext/convert/subversion.py -> build/lib.linux-i686-2.6/hgext/convert
copying hgext/convert/transport.py -> build/lib.linux-i686-2.6/hgext/convert
copying hgext/convert/common.py -> build/lib.linux-i686-2.6/hgext/convert
copying hgext/convert/hg.py -> build/lib.linux-i686-2.6/hgext/convert
copying hgext/convert/monotone.py -> build/lib.linux-i686-2.6/hgext/convert
copying hgext/convert/cvs.py -> build/lib.linux-i686-2.6/hgext/convert
copying hgext/convert/filemap.py -> build/lib.linux-i686-2.6/hgext/convert
copying hgext/convert/darcs.py -> build/lib.linux-i686-2.6/hgext/convert
creating build/lib.linux-i686-2.6/hgext/highlight
copying hgext/highlight/highlight.py -> build/lib.linux-i686-2.6/hgext/highlight
copying hgext/highlight/__init__.py -> build/lib.linux-i686-2.6/hgext/highlight
creating build/lib.linux-i686-2.6/hgext/zeroconf
copying hgext/zeroconf/__init__.py -> build/lib.linux-i686-2.6/hgext/zeroconf
copying hgext/zeroconf/Zeroconf.py -> build/lib.linux-i686-2.6/hgext/zeroconf
creating build/lib.linux-i686-2.6/hgext/inotify
copying hgext/inotify/server.py -> build/lib.linux-i686-2.6/hgext/inotify
copying hgext/inotify/__init__.py -> build/lib.linux-i686-2.6/hgext/inotify
copying hgext/inotify/common.py -> build/lib.linux-i686-2.6/hgext/inotify
copying hgext/inotify/client.py -> build/lib.linux-i686-2.6/hgext/inotify
creating build/lib.linux-i686-2.6/hgext/inotify/linux
copying hgext/inotify/linux/__init__.py -> build/lib.linux-i686-2.6/hgext/inotify/linux
copying hgext/inotify/linux/watcher.py -> build/lib.linux-i686-2.6/hgext/inotify/linux
running build_ext
building 'mercurial.base85' extension
creating build/temp.linux-i686-2.6
creating build/temp.linux-i686-2.6/mercurial
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-i686-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:141: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘methods’
mercurial/base85.c:150: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘initbase85’
error: command 'gcc' failed with exit status 1
make: *** [build] Error 1
+11  A: 

Make sure you have the python-dev package installed:

apt-get install python-dev
Jon
I've checked on Python - I have Python 2.6.2
Frank V
You need both the python and the python-dev packages installed. Run the command above and then run the Mercurial install again...
Jon
Thank you. I didn't realize there was a difference between "Python" and Python-dev.
Frank V
+2  A: 

First result on Google: http://ubuntuforums.org/showthread.php?t=497109

Does that help?

EDIT: That's for Linux. I'm pretty sure on OS X the Python.h will only be installed if you've installed the Developer Tools. Did you install them?

Steve Losh
Yes, this helped but the command was the answer... So I have to give it to Jon...
Frank V
Yes, I have the developer tools for Mac OS. Though, this particular post is for my Ubuntu setup.
Frank V
Ah, you didn't mention whether the build on OS X succeeded or not. From the original question it sounded like it did not.
Steve Losh
+2  A: 

I know you want to build from source, but for OS X (and elsewhere) you could simply use Python's easy_install (get it with Setuptools):

sudo easy_install mercurial

since Mercurial is written in Python. This finds the latest version (1.3.1 at time of writing) and (I don't use Macports or Fink) installs it nicely with no fuss at:

/Library/Frameworks/Python.framework/Versions/2.6/bin/

I run Python 2.6 (on Mac OS 10.4.11) so this also gets around the Mercurial OS X installer package (only at 1.2.1 as of July 25 2009) complaint about needing Python 2.5.

Dave Everitt
Thanks for the tip.
Frank V