Open jenner opened 4 years ago
Found the problem: in ecbdcf17 print(distutils.sysconfig.get_config_var("LDLIBRARY"))
yields libpython3.7m.so
, which is not a valid linker argument. Replacing it with print(distutils.sysconfig.get_config_var("BLDLIBRARY"))
works though:
~# python3.7 -c 'import distutils.sysconfig; print(distutils.sysconfig.get_config_var("BLDLIBRARY"))'
-lpython3.7m
I guess the config var depends on the platform.
BLDLIBRARY
isn't consistent depending on the how the original python got built.
> python -m sysconfig | grep BLDLIB
BLDLIBRARY = "-L. -lpython2.7"
> python -m sysconfig | grep BLDLIB
BLDLIBRARY = ""
> python -m sysconfig | grep BLDLIB
BLDLIBRARY = "libpython3.8.a"
locally i've reverted the config code back to pre-ecbdcf17884551b823fcef12cd5bd91103bde1fc (nov 7, 2019)
+ if test "$PyMAJVERSION" -eq "3"; then
+ LDLIBS1="-lpython${PyMAJVERSION}"
+ else
+ LDLIBS1="-lpython${PyVERSION}"
+ fi
- LDLIBS1=`${PYTHON_BIN} -c 'import distutils.sysconfig;\
- print(distutils.sysconfig.get_config_var("LDLIBRARY"))'`
trying to compile mod-python on ubuntu 20.10 against python 2.7 . Compilation and installation goes ok but apache2 does not start with same error.
apachectl configtest apache2: Syntax error on line 146 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/python.load: Cannot load /usr/lib/apache2/modules/mod_python.so into server: /usr/lib/apache2/modules/mod_python.so: undefined symbol: PyExc_SystemError Action 'configtest' failed. The Apache error log may have more information.
tried all of the patches on makefile.in still no luck.
update: this modification on configure script worked ana apache2 started. https://github.com/grisha/mod_python/pull/90/commits/0e436f1370bb380c08c22daeae7490c2153e44dc now I am facing ImportError: Import by filename is not supported.
any update from this error? I am still seeing on Docker in Ubuntu 16.04:
FROM python:2.7.18-slim
# Install packages
RUN apt-get -yqq update && \
apt-get -yqq install mercurial git vim apache2 apache2-dev libapache2-mod-python openssl libmariadb-dev fonts-freefont-ttf libssl-dev cron logrotate lynx htop zabbix-agent && \
apt-get clean
WORKDIR /usr/local/src
RUN git clone git+https://github.com/grisha/mod_python.git@e7ec956eaeba9f75e33f5d0036a6699ac3f0d816
WORKDIR /usr/local/src/mod_python
COPY patches/patch-Py_Initialize.txt /tmp
RUN LIBS="-lpython2.7" ./configure && \
# configure gets the libpython2.7.so link argument wrong, so fix it
sed -i.bak 's/libpython2.7.so/-lpython2.7/g' /usr/local/src/mod_python/src/Makefile && \
patch -p1 < /tmp/patch-Py_Initialize.txt && \
LIBS="-lpython2.7" make && \
make install
OS: Debian Buster mod_python: master HEAD (7af8011)
Running
make test
yields following errors:apache2: Syntax error on line 57 of /usr/src/mod_python/test/conf/test.conf: Cannot load /usr/src/mod_python/src/mod_python.so into server: /usr/src/mod_python/src/mod_python.so: undefined symbol: PyExc_SystemError
Seems like libpython is not linked properly:
Any hints on how to solve this?
Thanks in advance Igor