Compile plugins for Uwsgi

巧了我就是萌 提交于 2019-12-23 08:59:27

问题


I compile the uwsgi version x.y.zz.ww from the oficial site, i compiled the uwsgi with the command suggested from the official documentation

And then I compiled the plugins suggested for Python with the commands in the official documentation, the error output I get is this:

>ubuntu@ip-xx-yy-zz-ww:~/tmp/uwsgi-xx.yy.zz.ww$ PYTHON=python3.4 ./uwsgi --build-plugin "plugins/python python34"
*** uWSGI building and linking plugin from plugins/python ***
[gcc -pthread] python34_plugin.so
/usr/bin/ld: /usr/local/lib/python3.4/config-3.4m/libpython3.4m.a(abstract.o): relocation R_X86_64_32S against `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/python3.4/config-3.4m/libpython3.4m.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
*** unable to build python34 plugin ***

The alternative to use uwsgi without compiling it from the source is using pip3 install uwsgi, in this case the plugins are compiled in the folder plugins/python/python_plugin.o but can't find it. I'm using virtualenv for the project, the plugins compile must be on the root or inside the virtualenv enviroment in the lib folder ?


回答1:


Old question but for future reference here is what I had done:

/usr/bin/ld: /usr/local/lib/python3.4/config-3.4m/libpython3.4m.a(abstract.o): relocation R_X86_64_32S against `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC

This line implies that you need a python build with the flag: -fPIC, so I uninstalled the python version and rebuild with this flag on.

Export the flag before build like this:

export CFLAGS="$CFLAGS -fPIC"

alternatively if you are using pyenv

env PYTHON_CFLAGS=-fPIC pyenv install 3.5.x

Now using this python, you can compile a python plugin:

python uwsgiconfig.py --plugin plugins/python core python35


来源:https://stackoverflow.com/questions/32587400/compile-plugins-for-uwsgi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!