Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having issues loading libpython3.6m.a on OSX High Sierra #363

Closed
cgeorgelee opened this issue Oct 17, 2018 · 2 comments
Closed

Having issues loading libpython3.6m.a on OSX High Sierra #363

cgeorgelee opened this issue Oct 17, 2018 · 2 comments

Comments

@cgeorgelee
Copy link

cgeorgelee commented Oct 17, 2018

OS X 10.13.6 (17G65)
Python 3.6.4 installed in a pyenv

Having issues loading libpython3.6m.a trying to connect it to an either the system Apache or a Homebrew Apache running on port 80.

I have tried both the default system Apache and also tried using homebrew Apache. But neither work. It seems unable to load the libpython3.6m.a file into Apache.

$ pip install mod_wsgi

$ mod_wsgi-express module-config
LoadFile "/Users/myuser/.pyenv/versions/3.6.4/lib/libpython3.6m.a"
LoadModule wsgi_module "/Users/myuser/.pyenv/versions/3.6.4/envs/myprojectenv/lib/python3.6/site-packages/mod_wsgi/server/mod_wsgi-py36.cpython-36m-darwin.so"
WSGIPythonHome "/Users/myuser/.pyenv/versions/3.6.4/envs/myprojectenv"

... update the apache config ...

$ apachectl configtest
httpd: Syntax error on line 537 of /usr/local/etc/httpd/httpd.conf: Syntax error on line 1 of /usr/local/etc/httpd/conf.d/wsgi.conf: Cannot load /Users/myuser/.pyenv/versions/3.6.4/lib/libpython3.6m.a into server: dlopen(/Users/myuser/.pyenv/versions/3.6.4/lib/libpython3.6m.a, 10): no suitable image found.  Did find:\n\t/Users/myuser/.pyenv/versions/3.6.4/lib/libpython3.6m.a: unknown file type, first eight bytes: 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A\n\t/Users/myuser/.pyenv/versions/3.6.4/lib/libpython3.6m.a: unknown file type, first eight bytes: 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A
@GrahamDumpleton
Copy link
Owner

You must generate a shared library. See:

@cgeorgelee
Copy link
Author

Updated comment for someone else (probably future me) looking for answers... So for OSX / pyenv, if the output from the module-config looks like a "libpython3.6m.a" (*.a file) then it is a Python configuration issue and you will need to reinstall Python with shared library support. Do the following:

  1. Reinstall the virtual env
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.6.6
pyenv uninstall projectenv
pyenv virtualenv 3.6.6 projectenv
  1. Reinstall the pip packages into the virtualenv
pip install mod_wsgi
...
  1. Rerun the module config and notice that produces a different extension (dylib). If you see
$ mod_wsgi-express module-config
LoadFile "/Users/myuser/.pyenv/versions/3.6.6/lib/libpython3.6m.dylib"
...
  1. Stuff that back into httpd.conf

Thanks a ton!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants