How to install mod_wsgi in AWS Linux 2023 ec2 server correctly?
-
I install Python 3.11.4 based on following the tutorial: https://tecadmin.net/how-to-install-python-3-11-on-amazon-linux-2/
wget https://www.python.org/ftp/python/3.11.4/Python-3.11.4.tgz -
I install the XAMPP based on the tutorial: https://linuxhint.com/setup-configure-xampp-lamp-linux/
wget https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/8.2.4/xampp-linux-x64-8.2.4-0-installer.run -
then I install mod_wsgi based on: https://modwsgi.readthedocs.io/en/develop/user-guides/quick-installation-guide.html
wget https://github.com/GrahamDumpleton/mod_wsgi/archive/4.9.4.tar.gz
configure it:
./configure --with-apxs=/opt/lampp/bin/apxs --with-python=/home/ec2-user/Python-3.11.4/python
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for prctl... yes
checking Apache version... 2.4.56
configure: creating ./config.status
config.status: creating Makefile
make it:
make; make install
/opt/lampp/bin/apxs -c -I/usr/local/include/python3.11 -DNDEBUG -Wc,-g -Wc,-O2 src/server/mod_wsgi.c src/server/wsgi_*.c -L/usr/local/lib -L/usr/local/lib/python3.11/config -lpython3.11 -ldl -lm
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/mod_wsgi.lo src/server/mod_wsgi.c && touch src/server/mod_wsgi.slo
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/wsgi_apache.lo src/server/wsgi_apache.c && touch src/server/wsgi_apache.slo
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/wsgi_buckets.lo src/server/wsgi_buckets.c && touch src/server/wsgi_buckets.slo
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/wsgi_convert.lo src/server/wsgi_convert.c && touch src/server/wsgi_convert.slo
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/wsgi_daemon.lo src/server/wsgi_daemon.c && touch src/server/wsgi_daemon.slo
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/wsgi_interp.lo src/server/wsgi_interp.c && touch src/server/wsgi_interp.slo
src/server/wsgi_interp.c: In function 'wsgi_python_init':
src/server/wsgi_interp.c:2223:17: warning: 'PySys_AddWarnOption' is deprecated [-Wdeprecated-declarations]
2223 | PySys_AddWarnOption(s);
| ^~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/python3.11/Python.h:96,
from src/server/wsgi_python.h:26,
from src/server/wsgi_interp.h:24,
from src/server/wsgi_interp.c:21:
/usr/local/include/python3.11/sysmodule.h:25:38: note: declared here
25 | Py_DEPRECATED(3.11) PyAPI_FUNC(void) PySys_AddWarnOption(const wchar_t *);
| ^~~~~~~~~~~~~~~~~~~
src/server/wsgi_interp.c:2384:17: warning: 'Py_SetProgramName' is deprecated [-Wdeprecated-declarations]
2384 | Py_SetProgramName(s);
| ^~~~~~~~~~~~~~~~~
In file included from /usr/local/include/python3.11/Python.h:94,
from src/server/wsgi_python.h:26,
from src/server/wsgi_interp.h:24,
from src/server/wsgi_interp.c:21:
/usr/local/include/python3.11/pylifecycle.h:37:38: note: declared here
37 | Py_DEPRECATED(3.11) PyAPI_FUNC(void) Py_SetProgramName(const wchar_t *);
| ^~~~~~~~~~~~~~~~~
src/server/wsgi_interp.c:2399:17: warning: 'Py_SetPythonHome' is deprecated [-Wdeprecated-declarations]
2399 | Py_SetPythonHome(s);
| ^~~~~~~~~~~~~~~~
In file included from /usr/local/include/python3.11/Python.h:94,
from src/server/wsgi_python.h:26,
from src/server/wsgi_interp.h:24,
from src/server/wsgi_interp.c:21:
/usr/local/include/python3.11/pylifecycle.h:40:38: note: declared here
40 | Py_DEPRECATED(3.11) PyAPI_FUNC(void) Py_SetPythonHome(const wchar_t *);
| ^~~~~~~~~~~~~~~~
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/wsgi_logger.lo src/server/wsgi_logger.c && touch src/server/wsgi_logger.slo
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/wsgi_memory.lo src/server/wsgi_memory.c && touch src/server/wsgi_memory.slo
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/wsgi_metrics.lo src/server/wsgi_metrics.c && touch src/server/wsgi_metrics.slo
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/wsgi_restrict.lo src/server/wsgi_restrict.c && touch src/server/wsgi_restrict.slo
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/wsgi_server.lo src/server/wsgi_server.c && touch src/server/wsgi_server.slo
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/wsgi_stream.lo src/server/wsgi_stream.c && touch src/server/wsgi_stream.slo
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/wsgi_thread.lo src/server/wsgi_thread.c && touch src/server/wsgi_thread.slo
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/wsgi_validate.lo src/server/wsgi_validate.c && touch src/server/wsgi_validate.slo
/opt/lampp/build/libtool --silent --mode=link gcc -std=gnu11 -Wl,--rpath -Wl,/opt/lampp/lib -L/opt/lampp/lib -I/opt/lampp/include -L/opt/lampp/lib -L/opt/lampp -o src/server/mod_wsgi.la -rpath /opt/lampp/modules -module -avoid-version src/server/wsgi_validate.lo src/server/wsgi_thread.lo src/server/wsgi_stream.lo src/server/wsgi_server.lo src/server/wsgi_restrict.lo src/server/wsgi_metrics.lo src/server/wsgi_memory.lo src/server/wsgi_logger.lo src/server/wsgi_interp.lo src/server/wsgi_daemon.lo src/server/wsgi_convert.lo src/server/wsgi_buckets.lo src/server/wsgi_apache.lo src/server/mod_wsgi.lo -L/usr/local/lib -L/usr/local/lib/python3.11/config -lpython3.11 -ldl -lm
/usr/bin/ld: /usr/local/lib/libpython3.11.a(abstract.o): relocation R_X86_64_32S against symbol `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
apxs:Error: Command failed with rc=65536
.
make: *** [Makefile:31: src/server/mod_wsgi.la] Error 1
/opt/lampp/bin/apxs -c -I/usr/local/include/python3.11 -DNDEBUG -Wc,-g -Wc,-O2 src/server/mod_wsgi.c src/server/wsgi_*.c -L/usr/local/lib -L/usr/local/lib/python3.11/config -lpython3.11 -ldl -lm
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/mod_wsgi.lo src/server/mod_wsgi.c && touch src/server/mod_wsgi.slo
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/wsgi_apache.lo src/server/wsgi_apache.c && touch src/server/wsgi_apache.slo
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/wsgi_buckets.lo src/server/wsgi_buckets.c && touch src/server/wsgi_buckets.slo
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/wsgi_convert.lo src/server/wsgi_convert.c && touch src/server/wsgi_convert.slo
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/wsgi_daemon.lo src/server/wsgi_daemon.c && touch src/server/wsgi_daemon.slo
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/wsgi_interp.lo src/server/wsgi_interp.c && touch src/server/wsgi_interp.slo
src/server/wsgi_interp.c: In function 'wsgi_python_init':
src/server/wsgi_interp.c:2223:17: warning: 'PySys_AddWarnOption' is deprecated [-Wdeprecated-declarations]
2223 | PySys_AddWarnOption(s);
| ^~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/python3.11/Python.h:96,
from src/server/wsgi_python.h:26,
from src/server/wsgi_interp.h:24,
from src/server/wsgi_interp.c:21:
/usr/local/include/python3.11/sysmodule.h:25:38: note: declared here
25 | Py_DEPRECATED(3.11) PyAPI_FUNC(void) PySys_AddWarnOption(const wchar_t *);
| ^~~~~~~~~~~~~~~~~~~
src/server/wsgi_interp.c:2384:17: warning: 'Py_SetProgramName' is deprecated [-Wdeprecated-declarations]
2384 | Py_SetProgramName(s);
| ^~~~~~~~~~~~~~~~~
In file included from /usr/local/include/python3.11/Python.h:94,
from src/server/wsgi_python.h:26,
from src/server/wsgi_interp.h:24,
from src/server/wsgi_interp.c:21:
/usr/local/include/python3.11/pylifecycle.h:37:38: note: declared here
37 | Py_DEPRECATED(3.11) PyAPI_FUNC(void) Py_SetProgramName(const wchar_t *);
| ^~~~~~~~~~~~~~~~~
src/server/wsgi_interp.c:2399:17: warning: 'Py_SetPythonHome' is deprecated [-Wdeprecated-declarations]
2399 | Py_SetPythonHome(s);
| ^~~~~~~~~~~~~~~~
In file included from /usr/local/include/python3.11/Python.h:94,
from src/server/wsgi_python.h:26,
from src/server/wsgi_interp.h:24,
from src/server/wsgi_interp.c:21:
/usr/local/include/python3.11/pylifecycle.h:40:38: note: declared here
40 | Py_DEPRECATED(3.11) PyAPI_FUNC(void) Py_SetPythonHome(const wchar_t *);
| ^~~~~~~~~~~~~~~~
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/wsgi_logger.lo src/server/wsgi_logger.c && touch src/server/wsgi_logger.slo
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/wsgi_memory.lo src/server/wsgi_memory.c && touch src/server/wsgi_memory.slo
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/wsgi_metrics.lo src/server/wsgi_metrics.c && touch src/server/wsgi_metrics.slo
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/wsgi_restrict.lo src/server/wsgi_restrict.c && touch src/server/wsgi_restrict.slo
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/wsgi_server.lo src/server/wsgi_server.c && touch src/server/wsgi_server.slo
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/wsgi_stream.lo src/server/wsgi_stream.c && touch src/server/wsgi_stream.slo
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/wsgi_thread.lo src/server/wsgi_thread.c && touch src/server/wsgi_thread.slo
/opt/lampp/build/libtool --silent --mode=compile gcc -std=gnu11 -prefer-pic -I/opt/lampp/include/c-client -I/opt/lampp/include/libpng -I/opt/lampp/include/freetype2 -O3 -L/opt/lampp/lib -I/opt/lampp/include -I/opt/lampp/include/ncurses -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/opt/lampp/include -I/opt/lampp/include/apr-1 -I/opt/lampp/include/apr-1 -I/opt/lampp/include -g -O2 -I/usr/local/include/python3.11 -DNDEBUG -c -o src/server/wsgi_validate.lo src/server/wsgi_validate.c && touch src/server/wsgi_validate.slo
/opt/lampp/build/libtool --silent --mode=link gcc -std=gnu11 -Wl,--rpath -Wl,/opt/lampp/lib -L/opt/lampp/lib -I/opt/lampp/include -L/opt/lampp/lib -L/opt/lampp -o src/server/mod_wsgi.la -rpath /opt/lampp/modules -module -avoid-version src/server/wsgi_validate.lo src/server/wsgi_thread.lo src/server/wsgi_stream.lo src/server/wsgi_server.lo src/server/wsgi_restrict.lo src/server/wsgi_metrics.lo src/server/wsgi_memory.lo src/server/wsgi_logger.lo src/server/wsgi_interp.lo src/server/wsgi_daemon.lo src/server/wsgi_convert.lo src/server/wsgi_buckets.lo src/server/wsgi_apache.lo src/server/mod_wsgi.lo -L/usr/local/lib -L/usr/local/lib/python3.11/config -lpython3.11 -ldl -lm
/usr/bin/ld: /usr/local/lib/libpython3.11.a(abstract.o): relocation R_X86_64_32S against symbol `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
apxs:Error: Command failed with rc=65536
It ends with error: make: *** [Makefile:31: src/server/mod_wsgi.la] Error 1
How to fix it?
Your Python installation must have shared libraries enabled. See:
- https://modwsgi.readthedocs.io/en/master/user-guides/installation-issues.html#mixing-32-bit-and-64-bit-packages
Read:
- http://blog.dscpl.com.au/2015/06/installing-custom-python-version-into.html
where it talks more about this issue and how to go about installing Python from source with most appropriate options.