mod_wsgiをインストールする時のエラーの対処法
エラーに遭遇
pip install mod_wsgiを実行すると,以下のようなエラーがでた
ERROR: Command errored out with exit status 1: command: /home/ubuntu/.pyenv/versions/3.8.6/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-jusx1yov/mod-wsgi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-jusx1yov/mod-wsgi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-8jy4kqod/install-record.txt --single-version-externally-managed --compile --install-headers /home/ubuntu/.pyenv/versions/3.8.6/include/python3.8/mod-wsgi cwd: /tmp/pip-install-jusx1yov/mod-wsgi/ Complete output (66 lines): WARNING: The Python installation you are using does not appear to have been installed with a shared library, or in the case of MacOS X, as a framework. Where these are not present, the compilation of mod_wsgi may fail, or if it does succeed, will result in extra memory being used by all processes at run time as a result of the static library needing to be loaded in its entirety to every process. It is highly recommended that you reinstall the Python installation being used from source code, supplying the '--enable-shared' option to the 'configure' script when configuring the source code prior to building and installing it. /home/ubuntu/.pyenv/versions/3.8.6/lib/python3.8/distutils/dist.py:274: UserWarning: Unknown distribution option: 'bugtrack_url' warnings.warn(msg) running install running build running build_py creating build creating build/lib.linux-x86_64-3.8 creating build/lib.linux-x86_64-3.8/mod_wsgi copying src/__init__.py -> build/lib.linux-x86_64-3.8/mod_wsgi creating build/lib.linux-x86_64-3.8/mod_wsgi/server copying src/server/apxs_config.py -> build/lib.linux-x86_64-3.8/mod_wsgi/server copying src/server/environ.py -> build/lib.linux-x86_64-3.8/mod_wsgi/server copying src/server/__init__.py -> build/lib.linux-x86_64-3.8/mod_wsgi/server creating build/lib.linux-x86_64-3.8/mod_wsgi/server/management copying src/server/management/__init__.py -> build/lib.linux-x86_64-3.8/mod_wsgi/server/management creating build/lib.linux-x86_64-3.8/mod_wsgi/server/management/commands copying src/server/management/commands/runmodwsgi.py -> build/lib.linux-x86_64-3.8/mod_wsgi/server/management/commands copying src/server/management/commands/__init__.py -> build/lib.linux-x86_64-3.8/mod_wsgi/server/management/commands creating build/lib.linux-x86_64-3.8/mod_wsgi/docs copying docs/_build/html/__init__.py -> build/lib.linux-x86_64-3.8/mod_wsgi/docs creating build/lib.linux-x86_64-3.8/mod_wsgi/images copying images/__init__.py -> build/lib.linux-x86_64-3.8/mod_wsgi/images copying images/snake-whiskey.jpg -> build/lib.linux-x86_64-3.8/mod_wsgi/images running build_ext building 'mod_wsgi.server.mod_wsgi-py38' extension creating build/temp.linux-x86_64-3.8 creating build/temp.linux-x86_64-3.8/src creating build/temp.linux-x86_64-3.8/src/server gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/home/ubuntu/.pyenv/versions/3.8.6/include/python3.8 -c src/server/wsgi_daemon.c -o build/temp.linux-x86_64-3.8/src/server/wsgi_daemon.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/home/ubuntu/.pyenv/versions/3.8.6/include/python3.8 -c src/server/wsgi_server.c -o build/temp.linux-x86_64-3.8/src/server/wsgi_server.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/home/ubuntu/.pyenv/versions/3.8.6/include/python3.8 -c src/server/wsgi_metrics.c -o build/temp.linux-x86_64-3.8/src/server/wsgi_metrics.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/home/ubuntu/.pyenv/versions/3.8.6/include/python3.8 -c src/server/wsgi_stream.c -o build/temp.linux-x86_64-3.8/src/server/wsgi_stream.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/home/ubuntu/.pyenv/versions/3.8.6/include/python3.8 -c src/server/wsgi_apache.c -o build/temp.linux-x86_64-3.8/src/server/wsgi_apache.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/home/ubuntu/.pyenv/versions/3.8.6/include/python3.8 -c src/server/wsgi_convert.c -o build/temp.linux-x86_64-3.8/src/server/wsgi_convert.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/home/ubuntu/.pyenv/versions/3.8.6/include/python3.8 -c src/server/wsgi_logger.c -o build/temp.linux-x86_64-3.8/src/server/wsgi_logger.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/home/ubuntu/.pyenv/versions/3.8.6/include/python3.8 -c src/server/wsgi_thread.c -o build/temp.linux-x86_64-3.8/src/server/wsgi_thread.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/home/ubuntu/.pyenv/versions/3.8.6/include/python3.8 -c src/server/wsgi_interp.c -o build/temp.linux-x86_64-3.8/src/server/wsgi_interp.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/home/ubuntu/.pyenv/versions/3.8.6/include/python3.8 -c src/server/mod_wsgi.c -o build/temp.linux-x86_64-3.8/src/server/mod_wsgi.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include src/server/mod_wsgi.c: In function ‘wsgi_socket_sendv’: src/server/mod_wsgi.c:10966:44: warning: signed and unsigned type in conditional expression [-Wsign-compare] (nvec < iov_max ? nvec : (int)iov_max)); ^ src/server/mod_wsgi.c: In function ‘wsgi_scan_headers’: src/server/mod_wsgi.c:11125:30: warning: signed and unsigned type in conditional expression [-Wsign-compare] buflen = buffer ? buflen : sizeof(x); ^ gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/home/ubuntu/.pyenv/versions/3.8.6/include/python3.8 -c src/server/wsgi_memory.c -o build/temp.linux-x86_64-3.8/src/server/wsgi_memory.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/home/ubuntu/.pyenv/versions/3.8.6/include/python3.8 -c src/server/wsgi_validate.c -o build/temp.linux-x86_64-3.8/src/server/wsgi_validate.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/home/ubuntu/.pyenv/versions/3.8.6/include/python3.8 -c src/server/wsgi_restrict.c -o build/temp.linux-x86_64-3.8/src/server/wsgi_restrict.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/apache2 -I/home/ubuntu/.pyenv/versions/3.8.6/include/python3.8 -c src/server/wsgi_buckets.c -o build/temp.linux-x86_64-3.8/src/server/wsgi_buckets.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -pthread -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include gcc -pthread -shared -L/home/linuxbrew/.linuxbrew/opt/readline/lib -L/home/ubuntu/.pyenv/versions/3.8.6/lib -L/home/linuxbrew/.linuxbrew/opt/readline/lib -L/home/ubuntu/.pyenv/versions/3.8.6/lib build/temp.linux-x86_64-3.8/src/server/wsgi_daemon.o build/temp.linux-x86_64-3.8/src/server/wsgi_server.o build/temp.linux-x86_64-3.8/src/server/wsgi_metrics.o build/temp.linux-x86_64-3.8/src/server/wsgi_stream.o build/temp.linux-x86_64-3.8/src/server/wsgi_apache.o build/temp.linux-x86_64-3.8/src/server/wsgi_convert.o build/temp.linux-x86_64-3.8/src/server/wsgi_logger.o build/temp.linux-x86_64-3.8/src/server/wsgi_thread.o build/temp.linux-x86_64-3.8/src/server/wsgi_interp.o build/temp.linux-x86_64-3.8/src/server/mod_wsgi.o build/temp.linux-x86_64-3.8/src/server/wsgi_memory.o build/temp.linux-x86_64-3.8/src/server/wsgi_validate.o build/temp.linux-x86_64-3.8/src/server/wsgi_restrict.o build/temp.linux-x86_64-3.8/src/server/wsgi_buckets.o -o build/lib.linux-x86_64-3.8/mod_wsgi/server/mod_wsgi-py38.cpython-38-x86_64-linux-gnu.so -L/home/ubuntu/.pyenv/versions/3.8.6/lib -L/home/ubuntu/.pyenv/versions/3.8.6/lib/python3.8/config -lpython3.8 /usr/bin/ld: /home/ubuntu/.pyenv/versions/3.8.6/lib/libpython3.8.a(_warnings.o): relocation R_X86_64_PC32 against symbol `_PyRuntime' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Bad value collect2: error: ld returned 1 exit status error: command 'gcc' failed with exit status 1 ---------------------------------------- ERROR: Command errored out with exit status 1: /home/ubuntu/.pyenv/versions/3.8.6/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-jusx1yov/mod-wsgi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-jusx1yov/mod-wsgi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-8jy4kqod/install-record.txt --single-version-externally-managed --compile --install-headers /home/ubuntu/.pyenv/versions/3.8.6/include/python3.8/mod-wsgi Check the logs for full command output.
なんてことだ.こんなに長いエラーに遭遇するのは久々だ.
調べてみると,依存パッケージが足りていないというわけではなく,pyenvでインストールしたpythonが共有オブジェクトを共有していないことが原因のようだ.
対処法
pyenvでインストールしたpythonを削除.手順は過去記事を参考に
そして次にインストールする際は以下のコマンドでインストール(ここが大事)
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.8.6 pyenv global 3.8.6
こうして,pip install mod_wsgiを実行すると難なくインストールが完了
ディスカッション
コメント一覧
まだ、コメントがありません