【问题标题】:Compile plugins for Uwsgi为 Uwsgi 编译插件
【发布时间】:2015-09-15 13:30:07
【问题描述】:

我从官方网站编译了uwsgi版本x.y.zz.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 ***

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

【问题讨论】:

  • 您使用的是哪个版本的 ubuntu?如果是 14.04,您可以直接使用 apt-get install uwsgi-plugin-python3 并将 plugin=python3 作为属性放在您的应用程序配置文件中。

标签: python plugins uwsgi


【解决方案1】:

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

/usr/bin/ld: /usr/local/lib/python3.4/config-3.4m/libpython3.4m.a(abstract.o): 重定位 R_X86_64_32S 对 `_Py_NotImplementedStruct' 不能用于制作共享对象; 使用 -fPIC 重新编译

这行暗示你需要一个带有标志的python构建:-fPIC,所以我卸载了python版本并使用这个标志重新构建。

在构建之前像这样导出标志:

export CFLAGS="$CFLAGS -fPIC"

或者,如果您使用的是 pyenv

env PYTHON_CFLAGS=-fPIC pyenv install 3.5.x

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-07-26
    • 1970-01-01
    • 1970-01-01
    • 2015-12-13
    • 2013-03-07
    • 2021-05-22
    • 2016-01-24
    • 1970-01-01
    相关资源
    最近更新 更多