unbit / uwsgi

uWSGI application server container
http://projects.unbit.it/uwsgi
Other
3.45k stars 691 forks source link

Cannot build from master (cast-function-type/stringop-truncation) #1819

Closed frafra closed 5 years ago

frafra commented 6 years ago
$ pip3 install 'git+https://github.com/unbit/uwsgi.git'
Collecting git+https://github.com/unbit/uwsgi.git
  Cloning https://github.com/unbit/uwsgi.git to /tmp/pip-cdc9_gy5-build
Installing collected packages: uWSGI
  Running setup.py install for uWSGI ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-cdc9_gy5-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-l8p5110u-record/install-record.txt --single-version-externally-managed --compile:
    using profile: buildconf/default.ini
    detected include path: ['/usr/lib/gcc/x86_64-redhat-linux/8/include', '/usr/local/include', '/usr/include']
    /usr/lib/python3.6/site-packages/setuptools/dist.py:407: UserWarning: The version specified ('2.1-dev-cc409036') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
      "details." % self.metadata.version
    running install
    using profile: buildconf/default.ini
    detected include path: ['/usr/lib/gcc/x86_64-redhat-linux/8/include', '/usr/local/include', '/usr/include']
    Patching "bin_name" to properly install_scripts dir
    detected CPU cores: 8
    configured CFLAGS: -O2 -I. -Wall -Werror -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -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_PCRE -DUWSGI_ROUTING -DUWSGI_UUID -DUWSGI_VERSION="\"2.1-dev-cc409036\"" -DUWSGI_VERSION_BASE="2" -DUWSGI_VERSION_MAJOR="1" -DUWSGI_VERSION_MINOR="0" -DUWSGI_VERSION_REVISION="0" -DUWSGI_VERSION_CUSTOM="\"dev-cc409036\"" -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);UDEP(router_fcgi);" -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);ULEP(router_fcgi);"
    *** uWSGI compiling server core ***
    [thread 1][gcc -pthread] core/utils.o
    [thread 0][gcc -pthread] core/protocol.o
    [thread 5][gcc -pthread] core/socket.o
    [thread 3][gcc -pthread] core/logging.o
    [thread 4][gcc -pthread] core/master.o
    [thread 6][gcc -pthread] core/master_utils.o
    [thread 2][gcc -pthread] core/emperor.o
    [thread 7][gcc -pthread] core/notify.o
    core/emperor.c: In function ‘uwsgi_emperor_vassal_start’:
    core/emperor.c:1356:15: error: cast between incompatible function types from ‘void (*)(struct uwsgi_instance *)’ to ‘int (*)(void *)’ [-Werror=cast-function-type]
       pid = clone((int (*)(void *)) uwsgi_emperor_spawn_vassal, stack + PTHREAD_STACK_MIN, SIGCHLD | uwsgi.emperor_clone, (void *) n_ui);
                   ^
    [thread 7][gcc -pthread] core/mule.o
    [thread 0][gcc -pthread] core/subscription.o
    core/mule.c: In function ‘uwsgi_setup_mules_and_farms’:
    core/mule.c:475:4: error: ‘strncpy’ specified bound 255 equals destination size [-Werror=stringop-truncation]
        strncpy(uwsgi.farms[i].name, farm_value, 0xff);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    core/utils.c: In function ‘uwsgi_substitute’:
    core/utils.c:1779:3: error: ‘strncat’ output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
       strncat(dst, with, with_len);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    core/utils.c:1759:20: note: length computed here
      size_t with_len = strlen(with);
                        ^~~~~~~~~~~~
    core/utils.c:1784:2: error: ‘strncat’ output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
      strncat(dst, ptr, strlen(ptr));
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    cc1: all warnings being treated as errors

    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-cdc9_gy5-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-l8p5110u-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-cdc9_gy5-build/
xrmx commented 6 years ago

which compiler is this? Ah it looks like it's gcc 8.

frafra commented 6 years ago

I am using gcc 8.1.1 on Fedora 28.

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --enable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 8.1.1 20180502 (Red Hat 8.1.1-1) (GCC) 
$ lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: Fedora
Description:    Fedora release 28 (Twenty Eight)
Release:    28
Codename:   TwentyEight

I also tried with clang 6.0, but I get a different error:

$ clang -v
clang version 6.0.0 (tags/RELEASE_600/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/8
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/8
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
$ export CC=clang
$ pip3 install 'git+https://github.com/unbit/uwsgi.git'
Collecting git+https://github.com/unbit/uwsgi.git
  Cloning https://github.com/unbit/uwsgi.git to /tmp/pip-joijsm26-build
Installing collected packages: uWSGI
  Running setup.py install for uWSGI ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-joijsm26-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-2jp6yl7o-record/install-record.txt --single-version-externally-managed --compile:
    using profile: buildconf/default.ini
    detected include path: ['/usr/local/include', '/usr/lib64/clang/6.0.0/include', '/usr/include']
    /usr/lib/python3.6/site-packages/setuptools/dist.py:407: UserWarning: The version specified ('2.1-dev-cc409036') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
      "details." % self.metadata.version
    running install
    using profile: buildconf/default.ini
    detected include path: ['/usr/local/include', '/usr/lib64/clang/6.0.0/include', '/usr/include']
    Patching "bin_name" to properly install_scripts dir
    detected CPU cores: 8
    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 -Wno-format -Wno-format-security -DUWSGI_HAS_IFADDRS -DUWSGI_ZLIB -DUWSGI_LOCK_USE_MUTEX -DUWSGI_EVENT_USE_EPOLL -DUWSGI_EVENT_TIMER_USE_TIMERFD -DUWSGI_EVENT_FILEMONITOR_USE_INOTIFY  -DUWSGI_PCRE -DUWSGI_ROUTING -DUWSGI_UUID -DUWSGI_VERSION="\"2.1-dev-cc409036\"" -DUWSGI_VERSION_BASE="2" -DUWSGI_VERSION_MAJOR="1" -DUWSGI_VERSION_MINOR="0" -DUWSGI_VERSION_REVISION="0" -DUWSGI_VERSION_CUSTOM="\"dev-cc409036\"" -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);UDEP(router_fcgi);" -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);ULEP(router_fcgi);"
    *** uWSGI compiling server core ***
    [thread 1][clang] core/utils.o
    [thread 7][clang] core/protocol.o
    [thread 3][clang] core/socket.o
    [thread 6][clang] core/logging.o
    [thread 5][clang] core/master.o
    [thread 2][clang] core/master_utils.o
    [thread 4][clang] core/emperor.o
    [thread 0][clang] core/notify.o
    [thread 0][clang] core/mule.o
    [thread 7][clang] core/subscription.o
    [thread 5][clang] core/stats.o
    [thread 3][clang] core/sendfile.o
    [thread 6][clang] core/async.o
    [thread 2][clang] core/master_checks.o
    [thread 0][clang] core/fifo.o
    [thread 4][clang] core/offload.o
    [thread 3][clang] core/io.o
    [thread 5][clang] core/static.o
    [thread 7][clang] core/websockets.o
    [thread 6][clang] core/spooler.o
    [thread 0][clang] core/snmp.o
    [thread 1][clang] core/exceptions.o
    [thread 2][clang] core/config.o
    [thread 4][clang] core/setup_utils.o
    [thread 7][clang] core/clock.o
    [thread 5][clang] core/init.o
    [thread 1][clang] core/buffer.o
    [thread 6][clang] core/reader.o
    [thread 3][clang] core/writer.o
    [thread 0][clang] core/alarm.o
    [thread 4][clang] core/cron.o
    [thread 7][clang] core/hooks.o
    [thread 2][clang] core/plugins.o
    [thread 5][clang] core/lock.o
    [thread 1][clang] core/cache.o
    [thread 0][clang] core/daemons.o
    [thread 4][clang] core/errors.o
    [thread 6][clang] core/hash.o
    [thread 3][clang] core/master_events.o
    [thread 2][clang] core/chunked.o
    [thread 7][clang] core/queue.o
    [thread 5][clang] core/event.o
    [thread 6][clang] core/signal.o
    [thread 4][clang] core/strings.o
    [thread 3][clang] core/progress.o
    [thread 0][clang] core/timebomb.o
    [thread 2][clang] core/ini.o
    [thread 7][clang] core/fsmon.o
    [thread 5][clang] core/mount.o
    [thread 0][clang] core/metrics.o
    [thread 3][clang] core/plugins_builder.o
    [thread 6][clang] core/sharedarea.o
    [thread 4][clang] core/fork_server.o
    [thread 2][clang] core/webdav.o
    [thread 1][clang] core/zeus.o
    [thread 7][clang] core/rpc.o
    [thread 5][clang] core/gateway.o
    [thread 3][clang] core/loop.o
    [thread 4][clang] core/cookie.o
    [thread 1][clang] core/querystring.o
    [thread 2][clang] core/rb_timers.o
    [thread 6][clang] core/transformations.o
    [thread 7][clang] core/uwsgi.o
    [thread 5][clang] proto/base.o
    [thread 0][clang] proto/uwsgi.o
    [thread 3][clang] proto/http.o
    [thread 1][clang] proto/fastcgi.o
    [thread 4][clang] proto/scgi.o
    [thread 2][clang] proto/puwsgi.o
    [thread 6][clang] lib/linux_ns.o
    [thread 5][clang] core/zlib.o
    [thread 0][clang] core/regexp.o
    [thread 4][clang] core/routing.o
    [thread 1][clang] core/yaml.o
    [thread 2][clang] core/ssl.o
    [thread 6][clang] core/legion.o
    [thread 3][clang] core/xmlconf.o
    [thread 5][clang] core/dot_h.o
    [thread 0][clang] core/config_py.o
    *** uWSGI compiling embedded plugins ***
    [thread 5][clang] plugins/python/python_plugin.o
    [thread 0][clang] plugins/python/pyutils.o
    [thread 1][clang] plugins/python/pyloader.o
    [thread 3][clang] plugins/python/wsgi_handlers.o
    [thread 2][clang] plugins/python/wsgi_headers.o
    [thread 0][clang] plugins/python/wsgi_subhandler.o
    [thread 6][clang] plugins/python/web3_subhandler.o
    [thread 2][clang] plugins/python/pump_subhandler.o
    [thread 1][clang] plugins/python/gil.o
    [thread 3][clang] plugins/python/uwsgi_pymodule.o
    [thread 4][clang] plugins/python/profiler.o
    [thread 7][clang] plugins/python/symimporter.o
    [thread 5][clang] plugins/python/tracebacker.o
    [thread 6][clang] plugins/python/raw.o
    [thread 1][clang] plugins/gevent/gevent.o
    [thread 0][clang] plugins/gevent/hooks.o
    [thread 2][clang] plugins/ping/ping_plugin.o
    [thread 4][clang] plugins/cache/cache.o
    [thread 5][clang] plugins/nagios/nagios.o
    [thread 7][clang] plugins/rrdtool/rrdtool.o
    [thread 6][clang] plugins/carbon/carbon.o
    [thread 2][clang] plugins/rpc/rpc_plugin.o
    [thread 4][clang] plugins/corerouter/cr_common.o
    [thread 0][clang] plugins/corerouter/cr_map.o
    [thread 5][clang] plugins/corerouter/corerouter.o
    [thread 1][clang] plugins/fastrouter/fastrouter.o
    [thread 7][clang] plugins/http/http.o
    [thread 6][clang] plugins/http/keepalive.o
    [thread 3][clang] plugins/http/https.o
    [thread 4][clang] plugins/http/spdy3.o
    [thread 0][clang] plugins/ugreen/ugreen.o
    [thread 2][clang] plugins/signal/signal_plugin.o
    [thread 1][clang] plugins/syslog/syslog_plugin.o
    [thread 5][clang] plugins/rsyslog/rsyslog_plugin.o
    [thread 6][clang] plugins/logsocket/logsocket_plugin.o
    [thread 0][clang] plugins/router_uwsgi/router_uwsgi.o
    [thread 3][clang] plugins/router_redirect/router_redirect.o
    [thread 2][clang] plugins/router_basicauth/router_basicauth.o
    [thread 7][clang] plugins/zergpool/zergpool.o
    [thread 1][clang] plugins/redislog/redislog_plugin.o
    [thread 4][clang] plugins/mongodblog/mongodblog_plugin.o
    [thread 5][clang] plugins/router_rewrite/router_rewrite.o
    [thread 6][clang] plugins/router_http/router_http.o
    [thread 0][clang] plugins/logfile/logfile.o
    [thread 3][clang] plugins/router_cache/router_cache.o
    plugins/router_basicauth/router_basicauth.c:83:13: error: implicit declaration of function 'crypt' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                    crypted = crypt( colon+1, cpwd);
                              ^
    plugins/router_basicauth/router_basicauth.c:83:11: error: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Werror,-Wint-conversion]
                    crypted = crypt( colon+1, cpwd);
                            ^ ~~~~~~~~~~~~~~~~~~~~~
    2 errors generated.

    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-joijsm26-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-2jp6yl7o-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-joijsm26-build/
unbit commented 6 years ago

The fix for fedora 28 (and clang-6) is here: https://github.com/unbit/uwsgi/pull/1780

frafra commented 6 years ago

Thank you; the patch for Clang 6 works, but the issue with GCC is still there.

xrmx commented 6 years ago

So we got gcc-8 in debian unstable and find some time to look a this. I've fixed what i got but haven't tested them and won't trust myself on C these days :) The branch is at https://github.com/xrmx/uwsgi/tree/fixcomp

Still i'm stuck with the python module:

plugins/python/uwsgi_pymodule.c:2785:22: error: cast between incompatible function types from ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *, struct _object *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} [-Werror=cast-function-type]
  {"send_to_spooler", (PyCFunction) py_uwsgi_send_spool, METH_VARARGS | METH_KEYWORDS, ""},

@afazekas any chance you hit this too in fedora and have a fix?

AncalagonTheBlack commented 5 years ago

So we got gcc-8 in debian unstable and find some time to look a this. I've fixed what i got but haven't tested them and won't trust myself on C these days :) The branch is at https://github.com/xrmx/uwsgi/tree/fixcomp

Still i'm stuck with the python module:

plugins/python/uwsgi_pymodule.c:2785:22: error: cast between incompatible function types from ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *, struct _object *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} [-Werror=cast-function-type]
  {"send_to_spooler", (PyCFunction) py_uwsgi_send_spool, METH_VARARGS | METH_KEYWORDS, ""},

@afazekas any chance you hit this too in fedora and have a fix?

Same Issue. Any Solution ?

xrmx commented 5 years ago

The solution is here waiting for some testing https://github.com/unbit/uwsgi/pull/1856

xrmx commented 5 years ago

This should be fixed in master and uwsgi-2.0.