编译Uwsgi的插件

ram*_*oft 7 python plugins uwsgi

我从官方网站编译uwsgi版本xyzz.ww,我用官方文档中建议的命令编译uwsgi

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

>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 ***
Run Code Online (Sandbox Code Playgroud)

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

Tin*_*nce 5

老问题,但供将来参考,这是我所做的:

/usr/bin/ld: /usr/local/lib/python3.4/config-3.4m/libpython3.4m.a(abstract.o): 创建共享对象时不能使用针对“_Py_NotImplementedStruct”的重定位 R_X86_64_32S;使用 -fPIC 重新编译

此行意味着您需要带有标志的 python 构建:-fPIC,因此我卸载了 python 版本并使用此标志进行重建。

在构建之前导出标志,如下所示:

export CFLAGS="$CFLAGS -fPIC"
Run Code Online (Sandbox Code Playgroud)

或者,如果您使用pyenv

env PYTHON_CFLAGS=-fPIC pyenv install 3.5.x
Run Code Online (Sandbox Code Playgroud)

现在使用这个python,你可以编译一个python插件:

python uwsgiconfig.py --plugin plugins/python core python35
Run Code Online (Sandbox Code Playgroud)