hg cygwin issue

Emmanuel Mogenet mgix at mgix.com
Tue Jul 12 20:00:57 UTC 2005


I've installed hg under cygwin and ran into a couple of issues.

These might be cygwin problems rather than hg's, but I thought I'd log 
them anyway.

First problem : install doesn't work out of the box: linking with 
libpython fails:

    *glint # cd ~/hg
    glint # python setup.py install --home=/cygdrive/d/mgix/hg-work
    running install
    running build
    running build_py
    creating build
    creating build/lib.cygwin-1.5.12-i686-2.4
    creating build/lib.cygwin-1.5.12-i686-2.4/mercurial
    copying mercurial/byterange.py ->
    build/lib.cygwin-1.5.12-i686-2.4/mercurial
    copying mercurial/commands.py ->
    build/lib.cygwin-1.5.12-i686-2.4/mercurial
    copying mercurial/demandload.py ->
    build/lib.cygwin-1.5.12-i686-2.4/mercurial
    copying mercurial/fancyopts.py ->
    build/lib.cygwin-1.5.12-i686-2.4/mercurial
    copying mercurial/hg.py -> build/lib.cygwin-1.5.12-i686-2.4/mercurial
    copying mercurial/hgweb.py -> build/lib.cygwin-1.5.12-i686-2.4/mercurial
    copying mercurial/httprangereader.py ->
    build/lib.cygwin-1.5.12-i686-2.4/mercurial
    copying mercurial/lock.py -> build/lib.cygwin-1.5.12-i686-2.4/mercurial
    copying mercurial/mdiff.py -> build/lib.cygwin-1.5.12-i686-2.4/mercurial
    copying mercurial/revlog.py ->
    build/lib.cygwin-1.5.12-i686-2.4/mercurial
    copying mercurial/transaction.py ->
    build/lib.cygwin-1.5.12-i686-2.4/mercurial
    copying mercurial/ui.py -> build/lib.cygwin-1.5.12-i686-2.4/mercurial
    copying mercurial/util.py -> build/lib.cygwin-1.5.12-i686-2.4/mercurial
    copying mercurial/version.py ->
    build/lib.cygwin-1.5.12-i686-2.4/mercurial
    copying mercurial/__init__.py ->
    build/lib.cygwin-1.5.12-i686-2.4/mercurial
    running build_ext
    building 'mercurial.mpatch' extension
    creating build/temp.cygwin-1.5.12-i686-2.4
    creating build/temp.cygwin-1.5.12-i686-2.4/mercurial
    gcc -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes
    -I/usr/include/python2.4 -c mercurial/mpatch.c -o
    build/temp.cygwin-1.5.12-i686-2.4/mercurial/mpatch.o
    gcc -shared -Wl,--enable-auto-image-base
    build/temp.cygwin-1.5.12-i686-2.4/mercurial/mpatch.o -L. -lpython2.4
    -o build/lib.cygwin-1.5.12-i686-2.4/mercurial/mpatch.dll
    /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../i686-pc-cygwin/bin/ld:
    cannot find -lpython2.4
    collect2: ld returned 1 exit status
    error: command 'gcc' failed with exit status 1*

I "fixed" this by linking things by hand as follows (replacing *-L.* by 
*-L/usr/lib/python2.4/config -lpython2.4*) :

    *glint # gcc -shared -Wl,--enable-auto-image-base
    build/temp.cygwin-1.5.12-i686-2.4/mercurial/mpatch.o
    -L/usr/lib/python2.4/config -lpython2.4 -o
    build/lib.cygwin-1.5.12-i686-2.4/mercurial/mpatch.dll
    *

    *glint # gcc -shared -Wl,--enable-auto-image-base
    build/temp.cygwin-1.5.12-i686-2.4/mercurial/bdiff.o
    -L/usr/lib/python2.4/config -lpython2.4 -o
    build/lib.cygwin-1.5.12-i686-2.4/mercurial/bdiff.dll*

After that, hg installs fine:

    *glint # python setup.py install --home=/cygdrive/d/mgix/hg-work

    [... output removed everything works...]*

Second problem : after adding *~/hg-work/bin* to my path and doing a
*setenv PYTHONPATH '/cygdrive/d/mgix/hg-work/lib/python'*
hg works fine:

    *glint #
    glint # cd
    glint # hg version
    Mercurial version unknown

    Copyright (C) 2005 Matt Mackall <mpm at selenic.com>
    This is free software; see the source for copying conditions. There
    is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
    PURPOSE.
    glint # *

However, if I do try to launch hg from within a cleaned up hg working 
directory, here's what happens:

    *glint #
    glint # cd
    glint # cd hg
    glint # rm -rf build
    glint # hg tip
    Traceback (most recent call last):
      File "hg", line 13, in ?
        commands.run()
      File "/cygdrive/d/mgix/hg/mercurial/commands.py", line 1162, in run
        sys.exit(dispatch(sys.argv[1:]))
      File "/cygdrive/d/mgix/hg/mercurial/commands.py", line 1255, in
    dispatch
        except hg.RepoError, inst:
      File "/cygdrive/d/mgix/hg/mercurial/demandload.py", line 6, in
    __getattr__
        scope[mod] = __import__(mod, scope, scope, [])
      File "/cygdrive/d/mgix/hg/mercurial/hg.py", line 10, in ?
        from revlog import *
      File "/cygdrive/d/mgix/hg/mercurial/revlog.py", line 12, in ?
        from mercurial import mdiff
      File "/cygdrive/d/mgix/hg/mercurial/mdiff.py", line 8, in ?
        import difflib, struct, bdiff
    ImportError: No module named bdiff
    *


It looks like the hg that I installed in ~/hg-work/bin is trying to load 
hg stuff from the current directory
instead of  grabbing it from ~/hg-work. It probably has to do with the 
way python is configured under
cygwin, but it makes things kind of hard when using hg from within a hg 
repo.







More information about the Mercurial mailing list