uwsgi 安装报错

新手上路,请多包涵

pip install uwsgi 失败

Collecting uwsgi
  Using cached uwsgi-2.0.13.1.tar.gz
Installing collected packages: uwsgi
  Running setup.py install for uwsgi ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-omVSJq/uwsgi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-SEw5pP-record/install-record.txt --single-version-externally-managed --compile:
    running install
    using profile: buildconf/default.ini
    detected include path: ['/usr/lib/gcc/x86_64-linux-gnu/5/include', '/usr/local/include', '/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed', '/usr/include/x86_64-linux-gnu', '/usr/include']
    Patching "bin_name" to properly install_scripts dir
    detected CPU cores: 1
    configured CFLAGS: -O2 -I. -Wall -Werror -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fno-strict-aliasing -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -DUWSGI_HAS_IFADDRS -DUWSGI_ZLIB -DUWSGI_LOCK_USE_MUTEX -DUWSGI_EVENT_USE_EPOLL -DUWSGI_EVENT_TIMER_USE_TIMERFD -DUWSGI_EVENT_FILEMONITOR_USE_INOTIFY -I/usr/local/include -DUWSGI_PCRE -DUWSGI_ROUTING -DUWSGI_VERSION="\"2.0.13.1\"" -DUWSGI_VERSION_BASE="2" -DUWSGI_VERSION_MAJOR="0" -DUWSGI_VERSION_MINOR="13" -DUWSGI_VERSION_REVISION="1" -DUWSGI_VERSION_CUSTOM="\"\"" -DUWSGI_YAML -DUWSGI_SSL -I/usr/include/libxml2 -DUWSGI_XML -DUWSGI_XML_LIBXML2 -DUWSGI_PLUGIN_DIR="\".\"" -DUWSGI_DECLARE_EMBEDDED_PLUGINS="UDEP(python);UDEP(gevent);UDEP(ping);UDEP(cache);UDEP(nagios);UDEP(rrdtool);UDEP(carbon);UDEP(rpc);UDEP(corerouter);UDEP(fastrouter);UDEP(http);UDEP(ugreen);UDEP(signal);UDEP(syslog);UDEP(rsyslog);UDEP(logsocket);UDEP(router_uwsgi);UDEP(router_redirect);UDEP(router_basicauth);UDEP(zergpool);UDEP(redislog);UDEP(mongodblog);UDEP(router_rewrite);UDEP(router_http);UDEP(logfile);UDEP(router_cache);UDEP(rawrouter);UDEP(router_static);UDEP(sslrouter);UDEP(spooler);UDEP(cheaper_busyness);UDEP(symcall);UDEP(transformation_tofile);UDEP(transformation_gzip);UDEP(transformation_chunked);UDEP(transformation_offload);UDEP(router_memcached);UDEP(router_redis);UDEP(router_hash);UDEP(router_expires);UDEP(router_metrics);UDEP(transformation_template);UDEP(stats_pusher_socket);" -DUWSGI_LOAD_EMBEDDED_PLUGINS="ULEP(python);ULEP(gevent);ULEP(ping);ULEP(cache);ULEP(nagios);ULEP(rrdtool);ULEP(carbon);ULEP(rpc);ULEP(corerouter);ULEP(fastrouter);ULEP(http);ULEP(ugreen);ULEP(signal);ULEP(syslog);ULEP(rsyslog);ULEP(logsocket);ULEP(router_uwsgi);ULEP(router_redirect);ULEP(router_basicauth);ULEP(zergpool);ULEP(redislog);ULEP(mongodblog);ULEP(router_rewrite);ULEP(router_http);ULEP(logfile);ULEP(router_cache);ULEP(rawrouter);ULEP(router_static);ULEP(sslrouter);ULEP(spooler);ULEP(cheaper_busyness);ULEP(symcall);ULEP(transformation_tofile);ULEP(transformation_gzip);ULEP(transformation_chunked);ULEP(transformation_offload);ULEP(router_memcached);ULEP(router_redis);ULEP(router_hash);ULEP(router_expires);ULEP(router_metrics);ULEP(transformation_template);ULEP(stats_pusher_socket);"
    *** uWSGI compiling server core ***
    [x86_64-linux-gnu-gcc -pthread] core/utils.o
    [x86_64-linux-gnu-gcc -pthread] core/protocol.o
    [x86_64-linux-gnu-gcc -pthread] core/socket.o
    [x86_64-linux-gnu-gcc -pthread] core/logging.o
    [x86_64-linux-gnu-gcc -pthread] core/master.o
    [x86_64-linux-gnu-gcc -pthread] core/master_utils.o
    [x86_64-linux-gnu-gcc -pthread] core/emperor.o
    [x86_64-linux-gnu-gcc -pthread] core/notify.o
    [x86_64-linux-gnu-gcc -pthread] core/mule.o
    [x86_64-linux-gnu-gcc -pthread] core/subscription.o
    [x86_64-linux-gnu-gcc -pthread] core/stats.o
    [x86_64-linux-gnu-gcc -pthread] core/sendfile.o
    [x86_64-linux-gnu-gcc -pthread] core/async.o
    [x86_64-linux-gnu-gcc -pthread] core/master_checks.o
    [x86_64-linux-gnu-gcc -pthread] core/fifo.o
    [x86_64-linux-gnu-gcc -pthread] core/offload.o
    [x86_64-linux-gnu-gcc -pthread] core/io.o
    [x86_64-linux-gnu-gcc -pthread] core/static.o
    [x86_64-linux-gnu-gcc -pthread] core/websockets.o
    [x86_64-linux-gnu-gcc -pthread] core/spooler.o
    [x86_64-linux-gnu-gcc -pthread] core/snmp.o
    [x86_64-linux-gnu-gcc -pthread] core/exceptions.o
    [x86_64-linux-gnu-gcc -pthread] core/config.o
    [x86_64-linux-gnu-gcc -pthread] core/setup_utils.o
    [x86_64-linux-gnu-gcc -pthread] core/clock.o
    [x86_64-linux-gnu-gcc -pthread] core/init.o
    [x86_64-linux-gnu-gcc -pthread] core/buffer.o
    [x86_64-linux-gnu-gcc -pthread] core/reader.o
    [x86_64-linux-gnu-gcc -pthread] core/writer.o
    [x86_64-linux-gnu-gcc -pthread] core/alarm.o
    [x86_64-linux-gnu-gcc -pthread] core/cron.o
    [x86_64-linux-gnu-gcc -pthread] core/hooks.o
    [x86_64-linux-gnu-gcc -pthread] core/plugins.o
    [x86_64-linux-gnu-gcc -pthread] core/lock.o
    [x86_64-linux-gnu-gcc -pthread] core/cache.o
    [x86_64-linux-gnu-gcc -pthread] core/daemons.o
    [x86_64-linux-gnu-gcc -pthread] core/errors.o
    [x86_64-linux-gnu-gcc -pthread] core/hash.o
    [x86_64-linux-gnu-gcc -pthread] core/master_events.o
    [x86_64-linux-gnu-gcc -pthread] core/chunked.o
    [x86_64-linux-gnu-gcc -pthread] core/queue.o
    [x86_64-linux-gnu-gcc -pthread] core/event.o
    [x86_64-linux-gnu-gcc -pthread] core/signal.o
    [x86_64-linux-gnu-gcc -pthread] core/strings.o
    [x86_64-linux-gnu-gcc -pthread] core/progress.o
    [x86_64-linux-gnu-gcc -pthread] core/timebomb.o
    [x86_64-linux-gnu-gcc -pthread] core/ini.o
    [x86_64-linux-gnu-gcc -pthread] core/fsmon.o
    [x86_64-linux-gnu-gcc -pthread] core/mount.o
    [x86_64-linux-gnu-gcc -pthread] core/metrics.o
    [x86_64-linux-gnu-gcc -pthread] core/plugins_builder.o
    [x86_64-linux-gnu-gcc -pthread] core/sharedarea.o
    [x86_64-linux-gnu-gcc -pthread] core/rpc.o
    [x86_64-linux-gnu-gcc -pthread] core/gateway.o
    [x86_64-linux-gnu-gcc -pthread] core/loop.o
    [x86_64-linux-gnu-gcc -pthread] core/cookie.o
    [x86_64-linux-gnu-gcc -pthread] core/querystring.o
    [x86_64-linux-gnu-gcc -pthread] core/rb_timers.o
    [x86_64-linux-gnu-gcc -pthread] core/transformations.o
    [x86_64-linux-gnu-gcc -pthread] core/uwsgi.o
    [x86_64-linux-gnu-gcc -pthread] proto/base.o
    [x86_64-linux-gnu-gcc -pthread] proto/uwsgi.o
    [x86_64-linux-gnu-gcc -pthread] proto/http.o
    [x86_64-linux-gnu-gcc -pthread] proto/fastcgi.o
    [x86_64-linux-gnu-gcc -pthread] proto/scgi.o
    [x86_64-linux-gnu-gcc -pthread] proto/puwsgi.o
    [x86_64-linux-gnu-gcc -pthread] lib/linux_ns.o
    [x86_64-linux-gnu-gcc -pthread] core/zlib.o
    [x86_64-linux-gnu-gcc -pthread] core/regexp.o
    [x86_64-linux-gnu-gcc -pthread] core/routing.o
    [x86_64-linux-gnu-gcc -pthread] core/yaml.o
    [x86_64-linux-gnu-gcc -pthread] core/ssl.o
    core/ssl.c: In function ‘uwsgi_ssl_init’:
    core/ssl.c:17:9: error: ‘OPENSSL_config’ is deprecated [-Werror=deprecated-declarations]
             OPENSSL_config(NULL);
             ^
    In file included from /usr/local/include/openssl/crypto.h:32:0,
                     from /usr/local/include/openssl/bio.h:20,
                     from /usr/local/include/openssl/conf.h:13,
                     from ./uwsgi.h:356,
                     from core/ssl.c:1:
    /usr/local/include/openssl/conf.h:92:1: note: declared here
     DEPRECATEDIN_1_1_0(void OPENSSL_config(const char *config_name))
     ^
    core/ssl.c: In function ‘uwsgi_ssl_info_cb’:
    core/ssl.c:26:24: error: dereferencing pointer to incomplete type ‘SSL {aka const struct ssl_st}’
                     if (ssl->s3) {
                            ^
    core/ssl.c: In function ‘uwsgi_ssl_session_new_cb’:
    core/ssl.c:62:69: error: dereferencing pointer to incomplete type ‘SSL_SESSION {aka struct ssl_session_st}’
             if (uwsgi_cache_set2(uwsgi.ssl_sessions_cache, (char *) sess->session_id, sess->session_id_length, session_blob, len, uwsgi.ssl_sessions_timeout, 0)) {
                                                                         ^
    core/ssl.c: In function ‘uwsgi_ssl_new_server_context’:
    core/ssl.c:408:46: error: passing argument 2 of ‘SSL_CTX_sess_set_get_cb’ from incompatible pointer type [-Werror=incompatible-pointer-types]
                     SSL_CTX_sess_set_get_cb(ctx, uwsgi_ssl_session_get_cb);
                                                  ^
    In file included from ./uwsgi.h:357:0,
                     from core/ssl.c:1:
    /usr/local/include/openssl/ssl.h:618:6: note: expected ‘SSL_SESSION * (*)(struct ssl_st *, const unsigned char *, int,  int *) {aka struct ssl_session_st * (*)(struct ssl_st *, const unsigned char *, int,  int *)}’ but argument is of type ‘SSL_SESSION * (*)(SSL *, unsigned char *, int,  int *) {aka struct ssl_session_st * (*)(struct ssl_st *, unsigned char *, int,  int *)}’
     void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx,
          ^
    cc1: all warnings being treated as errors

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-omVSJq/uwsgi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-SEw5pP-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-omVSJq/uwsgi/
阅读 10k
1 个回答

从编译结果可以看出问题出在你的OpenSSL的版本太低,具体是低于1.1.0,你可以安装高版本的openssl和openssl-devel之后再重新安装uwsgi。

主要是从下面的编译错误提示发现问题出在这个函数调用OPENSSL_config(NULL)。:

core/ssl.c: In function ‘uwsgi_ssl_init’:
core/ssl.c:17:9: error: ‘OPENSSL_config’ is deprecated [-Werror=deprecated-declarations]

然后查看uwsgi代码core/ssl.c(https://github.com/unbit/uwsg...)可以发现下面语句:

void uwsgi_ssl_init(void) {
#if OPENSSL_VERSION_NUMBER < 0x10100000L
        OPENSSL_config(NULL);
#endif
        SSL_library_init();
        SSL_load_error_strings();
        OpenSSL_add_all_algorithms();
        uwsgi.ssl_initialized = 1;
}

其中宏定义表示openssl版本小于1.1.0时才会调用已经废弃的OPENSSL_config函数。
所以安装1.1.0以上版本的openssl应该可以解决问题。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏