Не удается установить uwsgi на Alpine

Я пытаюсь установить uwsgi с помощью pip install uwsgi в моем изображении Alpine docker, но, к сожалению, он продолжает терпеть невообразимое отсутствие реального сообщения об ошибке:

Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-mEZegv/uwsgi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-c7XA_e-record/install-record.txt --single-version-externally-managed --compile:
    running install
    using profile: buildconf/default.ini
    detected include path: ['/usr/include/fortify', '/usr/include', '/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/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 -DUWSGI_VERSION="\"2.0.12\"" -DUWSGI_VERSION_BASE="2" -DUWSGI_VERSION_MAJOR="0" -DUWSGI_VERSION_MINOR="12" -DUWSGI_VERSION_REVISION="0" -DUWSGI_VERSION_CUSTOM="\"\"" -DUWSGI_YAML -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);"core/utils.c: In function 'uwsgi_as_root':
    core/utils.c:344:7: error: implicit declaration of function 'unshare' [-Werror=implicit-function-declaration]
       if (unshare(uwsgi.unshare)) {
           ^
    core/utils.c:564:5: error: implicit declaration of function 'sigfillset' [-Werror=implicit-function-declaration]
         sigfillset(&smask);
         ^
    core/utils.c:565:5: error: implicit declaration of function 'sigprocmask' [-Werror=implicit-function-declaration]
         sigprocmask(SIG_BLOCK, &smask, NULL);
         ^
    core/utils.c:565:17: error: 'SIG_BLOCK' undeclared (first use in this function)
         sigprocmask(SIG_BLOCK, &smask, NULL);
                     ^
    core/utils.c:565:17: note: each undeclared identifier is reported only once for each function it appears in
    core/utils.c:586:7: error: implicit declaration of function 'chroot' [-Werror=implicit-function-declaration]
       if (chroot(uwsgi.chroot)) {
           ^
    core/utils.c:791:5: error: unknown type name 'ushort'
         ushort *array;
         ^
    core/utils.c:833:8: error: implicit declaration of function 'setgroups' [-Werror=implicit-function-declaration]
        if (setgroups(0, NULL)) {
            ^
    core/utils.c:848:8: error: implicit declaration of function 'initgroups' [-Werror=implicit-function-declaration]
        if (initgroups(uidname, uwsgi.gid)) {
            ^
    core/utils.c: In function 'uwsgi_close_request':
    core/utils.c:1145:18: error: 'WAIT_ANY' undeclared (first use in this function)
       while (waitpid(WAIT_ANY, &waitpid_status, WNOHANG) > 0);
                      ^
    core/utils.c: In function 'uwsgi_resolve_ip':
    core/utils.c:1802:7: error: implicit declaration of function 'gethostbyname' [-Werror=implicit-function-declaration]
      he = gethostbyname(domain);
           ^
    core/utils.c:1802:5: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
      he = gethostbyname(domain);
         ^
    core/utils.c: In function 'uwsgi_unix_signal':
    core/utils.c:1936:19: error: storage size of 'sa' isn't known
      struct sigaction sa;
                       ^
    core/utils.c:1938:24: error: invalid application of 'sizeof' to incomplete type 'struct sigaction'
      memset(&sa, 0, sizeof(struct sigaction));
                            ^
    core/utils.c:1942:2: error: implicit declaration of function 'sigemptyset' [-Werror=implicit-function-declaration]
      sigemptyset(&sa.sa_mask);
      ^
    core/utils.c:1944:6: error: implicit declaration of function 'sigaction' [-Werror=implicit-function-declaration]
      if (sigaction(signum, &sa, NULL) < 0) {
          ^
    core/utils.c:1936:19: error: unused variable 'sa' [-Werror=unused-variable]
      struct sigaction sa;
                       ^
    In file included from core/utils.c:1:0:
    core/utils.c: In function 'uwsgi_list_has_num':
    ./uwsgi.h:140:47: error: implicit declaration of function 'strtok_r' [-Werror=implicit-function-declaration]
     #define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
                                                   ^
    core/utils.c:1953:2: note: in expansion of macro 'uwsgi_foreach_token'
      uwsgi_foreach_token(list2, ",", p, ctx) {
      ^
    ./uwsgi.h:140:46: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
     #define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
                                                  ^
    core/utils.c:1953:2: note: in expansion of macro 'uwsgi_foreach_token'
      uwsgi_foreach_token(list2, ",", p, ctx) {
      ^
    ./uwsgi.h:140:70: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
     #define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
                                                                          ^
    core/utils.c:1953:2: note: in expansion of macro 'uwsgi_foreach_token'
      uwsgi_foreach_token(list2, ",", p, ctx) {
      ^
    core/utils.c: In function 'uwsgi_list_has_str':
    ./uwsgi.h:140:46: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
     #define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
                                                  ^
    core/utils.c:1968:2: note: in expansion of macro 'uwsgi_foreach_token'
      uwsgi_foreach_token(list2, " ", p, ctx) {
      ^
    ./uwsgi.h:140:70: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
     #define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
                                                                          ^
    core/utils.c:1968:2: note: in expansion of macro 'uwsgi_foreach_token'
      uwsgi_foreach_token(list2, " ", p, ctx) {
      ^
    core/utils.c:1969:8: error: implicit declaration of function 'strcasecmp' [-Werror=implicit-function-declaration]
       if (!strcasecmp(p, str)) {
            ^
    core/utils.c: In function 'uwsgi_sig_pause':
    core/utils.c:2361:2: error: implicit declaration of function 'sigsuspend' [-Werror=implicit-function-declaration]
      sigsuspend(&mask);
      ^
    core/utils.c: In function 'uwsgi_run_command_putenv_and_wait':
    core/utils.c:2453:7: error: implicit declaration of function 'putenv' [-Werror=implicit-function-declaration]
       if (putenv(envs[i])) {
           ^
    In file included from core/utils.c:1:0:
    core/utils.c: In function 'uwsgi_build_unshare':
    ./uwsgi.h:140:46: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
     #define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
                                                  ^
    core/utils.c:2855:2: note: in expansion of macro 'uwsgi_foreach_token'
      uwsgi_foreach_token(list, ",", p, ctx) {
      ^
    ./uwsgi.h:140:70: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
     #define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
                                                                          ^
    core/utils.c:2855:2: note: in expansion of macro 'uwsgi_foreach_token'
      uwsgi_foreach_token(list, ",", p, ctx) {
      ^
    core/utils.c: In function 'uwsgi_tmpfd':
    core/utils.c:3533:7: error: implicit declaration of function 'mkstemp' [-Werror=implicit-function-declaration]
      fd = mkstemp(template);
           ^
    core/utils.c: In function 'uwsgi_expand_path':
    core/utils.c:3615:7: error: implicit declaration of function 'realpath' [-Werror=implicit-function-declaration]
      if (!realpath(src, dst)) {
           ^
    core/utils.c: In function 'uwsgi_set_cpu_affinity':
    core/utils.c:3641:3: error: unknown type name 'cpu_set_t'
       cpu_set_t cpuset;
       ^
    core/utils.c:3646:3: error: implicit declaration of function 'CPU_ZERO' [-Werror=implicit-function-declaration]
       CPU_ZERO(&cpuset);
       ^
    core/utils.c:3651:4: error: implicit declaration of function 'CPU_SET' [-Werror=implicit-function-declaration]
        CPU_SET(base_cpu, &cpuset);
        ^
    core/utils.c:3662:7: error: implicit declaration of function 'sched_setaffinity' [-Werror=implicit-function-declaration]
       if (sched_setaffinity(0, sizeof(cpu_set_t), &cpuset)) {
           ^
    core/utils.c:3662:35: error: 'cpu_set_t' undeclared (first use in this function)
       if (sched_setaffinity(0, sizeof(cpu_set_t), &cpuset)) {
                                       ^
    core/utils.c: In function 'uwsgi_thread_run':
    core/utils.c:3782:2: error: implicit declaration of function 'pthread_sigmask' [-Werror=implicit-function-declaration]
      pthread_sigmask(SIG_BLOCK, &smask, NULL);
      ^
    core/utils.c:3782:18: error: 'SIG_BLOCK' undeclared (first use in this function)
      pthread_sigmask(SIG_BLOCK, &smask, NULL);
                      ^
    core/utils.c: In function 'uwsgi_envdir':
    core/utils.c:4349:8: error: implicit declaration of function 'unsetenv' [-Werror=implicit-function-declaration]
        if (unsetenv(de->d_name)) {
            ^
    core/utils.c:4380:7: error: implicit declaration of function 'setenv' [-Werror=implicit-function-declaration]
       if (setenv(de->d_name, content, 1)) {
           ^
    cc1: all warnings being treated as errors

    *** uWSGI compiling server core ***

Любая идея, что может вызвать это? Я заранее устанавливаю следующие зависимости:

RUN apk --update add \
        bash \
        python \
        python-dev \
        py-pip \
        gcc \
        zlib-dev \
        git \
        linux-headers \
        build-base \
        musl \
        musl-dev \
        memcached \
        libmemcached-dev

Ответ 1

К сожалению, последняя версия uwsgi не поддерживает musl, альтернативу glibc, которую используют alpine и пара других дистрибутивов. Uwsgi не будет строиться с муллом, если включен плагин ugreen (см. https://github.com/unbit/uwsgi/pull/522), поэтому вы все еще не можете pip install uwsgi. Однако, если вы создаете uwsgi с переменной окружения UWSGI_PROFILE=core, сборка должна быть успешной; но если во время выполнения произойдет сбой из-за проблем, которые были решены здесь (https://github.com/unbit/uwsgi/pull/1210). Это, вероятно, мрачная новость - я знаю, что это было для меня, но, по крайней мере, похоже, что команда uwsgi занимает время, чтобы решить свои проблемы на мусли. Надеюсь, он будет работать в следующем выпуске.

Ответ 2

Я нашел это в ветке GitHub. Он немного изменился и прекрасно работает на Python 3.5

apk add python3-dev build-base linux-headers pcre-dev
pip install uwsgi

Ответ 3

Вы пробовали

http://github.com/unbit/uwsgi/archive/uwsgi-2.0.zip

в вашем файле требований .txt?

вам понадобится пакет pcre-dev

Ответ 4

Это немного устарело, и это был не совсем случай с ОП. В моем случае обновления версии на requirements.txt до uwsgi==2.0.17.1 работал, как я нашел здесь.