为Uwsgi编译插件 [英] Compile plugins for Uwsgi

查看:341
本文介绍了为Uwsgi编译插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从官方站点编译了uwsgi版本x.y.zz.ww,我使用了官方文档中建议的命令编译了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

然后我用官方文档中的命令编译了建议用于Python的插件,我得到的错误输出是:

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 ***

使用uwsgi而不从源代码进行编译的另一种方法是使用pip3 install uwsgi,在这种情况下,插件被编译在文件夹 plugins/python/python_plugin.o 中,但找不到它.我正在为项目使用virtualenv,要编译的插件必须位于lib文件夹中的root或virtualenv环境中?

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 ?

推荐答案

旧问题,但以下内容供我参考:

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):在对_Py_NotImplementedStruct进行重定位时无法使用R_X86_64_32S共享对象使用-fPIC重新编译

此行表示您需要一个带有标志:-fPIC的python构建,因此我卸载了python版本,并在此标志打开的情况下进行了重建.

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"

或者,如果您使用的是 pyenv

alternatively if you are using pyenv

env PYTHON_CFLAGS=-fPIC pyenv install 3.5.x

现在使用此python,您可以编译一个python插件:

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

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

这篇关于为Uwsgi编译插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆