How to make current Mercurial run in an outdated shared server?

Marcos Cruz mercurial-list at programandala.net
Tue Nov 15 10:14:31 UTC 2022


Hi,

As I wrote in July, I configured a CGI-enabled subdomain of mine
containing an <hgweb.cgi>, a proper <.htaccess>, etc. It works fine.

The problem is the following:

- My shared hosting has Mercurial 3.7.3, Python 2.6.6, Python 3.4.3,
  glibc 2.12.
- My computer (with Debian 11.5) has Mercurial 6.2.3, Python 2.7.18,
  Python 3.9.2, glibc 2.31.
- The old Mercurial 3.7.3 in the server cannot manage repositories
  created by my Mercurial 6.2.3: "abort: repository requires features
  unknown to this Mercurial: share-safe". I think Mercurial 5.7 is the
  oldest one that can work with current repositories. Right?
- I have no permissions to install, update or compile anything on the
  server, except in my home directory and by my own means.
- So far my hosting provider refuses to update anything and suggests me
  to go for a more expensive VPS plan, which I don't need.

I'm considering moving to some other hosting provider, but first I've
been looking for a solution.

First I thought I could install a newer version of Python into my home
directory in the server, and then a modern version of Mercurial.
Therefore I compiled Python 3.10.5 on my own machine and installed it
into my server's <~/.local/> dir. Everything seemed ok, but it didn't
work because of its required version of glibc:

....
> python3 -V
python3: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by python3)
python3: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by python3)
python3: /lib64/libc.so.6: version `GLIBC_2.25' not found (required by python3)
python3: /lib64/libc.so.6: version `GLIBC_2.15' not found (required by python3)
python3: /lib64/libc.so.6: version `GLIBC_2.26' not found (required by python3)
python3: /lib64/libc.so.6: version `GLIBC_2.27' not found (required by python3)
python3: /lib64/libc.so.6: version `GLIBC_2.17' not found (required by python3)
....

Then I tried debootstrap in order to install an older Debian environment
in my computer (tried 6.0 and 5.0), and compile Python and Mercurial in
it with chroot, but debootstrap always fails with "segmentation fault"
during the process, both on my former Debian 10.13 and my current Debian
11.5, and I cannot find out the cause yet.

Then I tried an alternative: compiling Oxidized Mercurial with
PyOxidizer. It worked fine in Debian 10.13 with PyOxidizer 0.22.0:

```
cd mercurial-6.2.3/rust/hgcli
pyoxidizer build --release
```

The resulting 102 MiB binary
(build/pyoxidizer/x86_64-unknown-linux-gnu/release/app/hg) worked on my
machine, but failed on the server because of the same reason, the
required version of glibc:

....
./bin/hg: /lib64/libc.so.6: version `GLIBC_2.17' not found (required by
./bin/hg)
./bin/hg: /lib64/libc.so.6: version `GLIBC_2.13' not found (required by
./bin/hg)
./bin/hg: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by
./bin/hg)
./bin/hg: /lib64/libc.so.6: version `GLIBC_2.27' not found (required by
./bin/hg)
./bin/hg: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by
./bin/hg)
./bin/hg: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by
./bin/hg)
./bin/hg: /lib64/libc.so.6: version `GLIBC_2.15' not found (required by
./bin/hg)
./bin/hg: /lib64/libc.so.6: version `GLIBC_2.25' not found (required by
./bin/hg)
....

Now I'm trying on Debian 11.5 with PyOxidizer 0.23.0:

```
cd mercurial-6.2.3/rust/hgcli
pyoxidizer build --release --target-triple x86_64-unknown-linux-musl
```

The compilation failed with different errors, wich I eventually solved.
But I have found no solution to this problem yet:

```
  Running setup.py install for mercurial: finished with status 'done'
Successfully installed mercurial-6.2.3
Removed build tracker: '/tmp/pip-build-tracker-07i3otxd'
error[PYOXIDIZER_PYTHON_EXECUTABLE]: adding PythonExtensionModule<name=hgext.fsmonitor.pywatchman.bser>

    Caused by:
        extension module hgext.fsmonitor.pywatchman.bser cannot be loaded from memory but memory loading required
       --> ./pyoxidizer.bzl:144:5

```

Searching the list archives I've found a message by Chuck Tuffli on
2021-03-19 about this problem, but no solution was posted.

I've been tinkering also with <pyoxidizer.bzl>, the configuration file
included in Oxidized Mercurial. I've made a new generic one with
`pyoxidizer init-config-file hgcli/`. Using that generic config file,
the compilation makes a 126 MiB static executable:

```
> cd build/x86_64-unknown-linux-musl/debug/install
> ldd hgcli
        statically linked
> pyoxidizer analyze hgcli
Shared Library Dependencies
===========================
Symbol Versioning
===========================
```

But it runs the Python interpreter, not Mercurial. Clearly the reason is
the run code included in the custom config file is missing from the
generic one. I have edited both files and did many tries with them, but
so far nothing works. The PyOxidizer documentation
(https://pyoxidizer.readthedocs.io) is very complete, but doesn't help
me much yet. I'm not a Python or Rust programmer, so I'm a bit lost in
all this, just learning by doing.

Has anybody succeeded in compiling Oxidized Mercurial?

Is there a way to force PyOxidizer to use an older version of glibc?

Is there any other approach to make a modern Mercurial run in my shared
server?

Thank you.

-- 
Marcos Cruz
http://programandala.net


More information about the Mercurial mailing list