Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile plugins for Uwsgi

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 ?

like image 468
ramsoft Avatar asked Sep 15 '15 13:09

ramsoft


People also ask

What is uWSGI plugin Python?

uWSGI presents a complete stack for networked/clustered web applications, implementing message/object passing, caching, RPC and process management. It is designed to be fully modular.

Which Python does uWSGI use?

It's possible to compile an uWSGI plugin using the official Python 3.7 package, and we will see how to do it step by step.

Where is uWSGI config?

Configuration. Web applications served by uWSGI are configured in /etc/uwsgi/ , where each of them requires its own configuration file (ini-style). Details can be found in the uWSGI documentation. Alternatively, you can run uWSGI in Emperor mode (configured in /etc/uwsgi/emperor.


1 Answers

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
like image 106
Tiny Instance Avatar answered Oct 04 '22 14:10

Tiny Instance