mod_python icon indicating copy to clipboard operation
mod_python copied to clipboard

unable to compile mod_python due to "apxs:Error: Command failed with rc=9240576" during make command

Open prescriptionlifeline opened this issue 1 year ago • 5 comments

Here are the commands I've ran:

apt-get install -y apache2-dev python-dev
git clone https://github.com/grisha/mod_python.git
cd mod_python
./configure --with-python=/usr/bin/python3
make

Here's the error that make returns:

/usr/share/apr-1.0/build/libtool  --mode=compile --tag=disable-static x86_64-linux-gnu-gcc -prefer-pic -pipe -g -O2 -fdebug-prefix-map=/build/apache2-gDSZKE/apache2-2.4.25=. -fstack-protector-strong -Wformat -Werror=format-security  -DBUILD_DATETIME='"2022-03-18T12:54:25"' -Wdate-time -D_FORTIFY_SOURCE=2   -DLINUX -D_REENTRANT -D_GNU_SOURCE  -pthread  -I/usr/include/apache2  -I/usr/include/apr-1.0   -I/usr/include/apr-1.0 -I/usr/include -I/root/mod_python/src/include -I/usr/include/python3.5m -I/usr/include/python3.5m  -c -o mod_python.lo mod_python.c && touch mod_python.slo
apxs:Error: Command failed with rc=9240576
.
Makefile:54: recipe for target 'mod_python.so' failed
make[1]: *** [mod_python.so] Error 127
make[1]: Leaving directory '/root/mod_python/src'
Makefile:34: recipe for target 'do_dso' failed
make: *** [do_dso] Error 2

https://pastebin.com/3aqVV8yE has the full output.

Any ideas what's wrong?

prescriptionlifeline avatar May 12 '24 22:05 prescriptionlifeline

This probably means that your Python was compiled without the --enable-shared option.

grisha avatar May 12 '24 23:05 grisha

I didn't install python by compiling it - I installed it by doing sudo apt-get install python3-pip. https://docs.python.org/3/using/configure.html suggests that --enable-shared will build a shared Python library - libpython. If that's the case then it stands to reason that doing sudo apt-get install libpython3-dev should be sufficient but when I do that it shows that that's already installed.

Why is sudo apt-get install python3-pip insufficient? Am I going to have to compile Apache and gcc and Linux, too?

prescriptionlifeline avatar May 13 '24 01:05 prescriptionlifeline

That was just a guess. I think on Ubuntu you can just try installing the libapache2-mod-python package and avoid compiling.

grisha avatar May 13 '24 14:05 grisha

So I just compiled the latest version of Python by doing this:

wget https://www.python.org/ftp/python/3.12.3/Python-3.12.3.tgz
tar xvzf Python-3.12.3.tgz
cd Python-3.12.3
./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make
make install

pip3 install setuptools

Now when I try to do make on mod_python I'm getting this error:

/usr/local/bin/python3 setup.py build
Traceback (most recent call last):
  File "/root/mod_python/dist/setup.py", line 204, in <module>
    setup(name="mod_python",
  File "/usr/local/lib/python3.12/site-packages/setuptools/__init__.py", line 103, in setup
    return distutils.core.setup(**attrs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 146, in setup
    _setup_distribution = dist = klass(attrs)
                                 ^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/setuptools/dist.py", line 318, in __init__
    self.metadata.version = self._normalize_version(self.metadata.version)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/setuptools/dist.py", line 354, in _normalize_version
    normalized = str(Version(version))
                     ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/setuptools/_vendor/packaging/version.py", line 200, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
setuptools.extern.packaging.version.InvalidVersion: Invalid version: 'error: unknown option `exclude'
usage: git describe [<options>] [<commit-ish>...]
   or: git describe [<options>] --dirty

    --contains            find the tag that comes after the commit
    --debug               debug search strategy on stderr
    --all                 use any ref
    --tags                use any tag, even unannotated
    --long                always use long format
    --first-parent        only follow first parent
    --abbrev[=<n>]        use <n> digits to display SHA-1s
    --exact-match         only output exact matches
    --candidates <n>      consider <n> most recent tags (default: 10)
    --match <pattern>     only consider tags matching <pattern>
    --always              show abbreviated commit object as fallback
    --dirty[=<mark>]      append <mark> on dirty working tree (default: "-dirty")

3.5.0+'
Makefile:24: recipe for target 'build' failed
make[1]: *** [build] Error 1

Any ideas?

prescriptionlifeline avatar May 23 '24 01:05 prescriptionlifeline

Your git is too old and doesn't support the --exclude option, so one thing to try is to upgrade it. Another, perhaps simpler thing to try instead, is to remove git from the path - the compile should work just fine without git. Just rename your git binary temporarily to something else and try compiling again.

grisha avatar May 23 '24 02:05 grisha