Skip to content

Compilation fails on gcc 11 and gcc 10 #97

Open
@voltbit

Description

@voltbit

Hello, the project fails to build with the following output:

cd src && make all
make[1]: Entering directory '/tmp/redis-proxy/src'
Makefile:175: warning: overriding recipe for target '.make-prerequisites'
Makefile:161: warning: ignoring old recipe for target '.make-prerequisites'
    CC Makefile.dep
Makefile:175: warning: overriding recipe for target '.make-prerequisites'
Makefile:161: warning: ignoring old recipe for target '.make-prerequisites'
rm -rf redis-cluster-proxy *.o *.gcda *.gcno *.gcov lcov-html Makefile.dep
(cd ../deps && make distclean)
make[2]: Entering directory '/tmp/redis-proxy/deps'
(cd hiredis && make clean) > /dev/null || true
(rm -f .make-*)
make[2]: Leaving directory '/tmp/redis-proxy/deps'
(rm -f .make-*)
echo STD=-std=c11 -pedantic -DREDIS_STATIC='' >> .make-settings
echo WARN=-Wall -W -Wno-missing-field-initializers -Wno-format-security >> .make-settings
echo OPT=-O2 >> .make-settings
echo MALLOC=libc >> .make-settings
echo CFLAGS= >> .make-settings
echo LDFLAGS= >> .make-settings
echo REDIS_CLUSTER_PROXY_CFLAGS= >> .make-settings
echo REDIS_CLUSTER_PROXY_LDFLAGS= >> .make-settings
echo PREV_FINAL_CFLAGS=-std=c11 -pedantic -DREDIS_STATIC='' -Wall -W -Wno-missing-field-initializers -Wno-format-security -O2 -g -ggdb   -I../deps/hiredis >> .make-settings
echo PREV_FINAL_LDFLAGS=  -g -ggdb -rdynamic >> .make-settings
(cd ../deps && make hiredis)
make[2]: Entering directory '/tmp/redis-proxy/deps'
(cd hiredis && make clean) > /dev/null || true
(rm -f .make-*)
(echo "" > .make-cflags)
(echo "" > .make-ldflags)
MAKE hiredis
cd hiredis && make static
make[3]: Entering directory '/tmp/redis-proxy/deps/hiredis'
cc -std=c11 -pedantic -c -O3 -fPIC   -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb net.c
cc -std=c11 -pedantic -c -O3 -fPIC   -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb hiredis.c
cc -std=c11 -pedantic -c -O3 -fPIC   -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb sds.c
cc -std=c11 -pedantic -c -O3 -fPIC   -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb async.c
cc -std=c11 -pedantic -c -O3 -fPIC   -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb read.c
ar rcs libhiredis.a net.o hiredis.o sds.o async.o read.o
make[3]: Leaving directory '/tmp/redis-proxy/deps/hiredis'
make[2]: Leaving directory '/tmp/redis-proxy/deps'
    CC adlist.o
    CC ae.o
    CC anet.o
    CC cluster.o
cluster.c: In function ‘clusterNodeAuth’:
cluster.c:994:19: warning: ‘strncpy’ output truncated before terminating nul copying 26 bytes from a string of the same length [-Wstringop-truncation]
  994 |         if (*err) strncpy(*err, errmsg, errlen);
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    CC commands.o
    CC config.o
    CC crc16.o
    CC debug.o
debug.c: In function ‘_proxyAssert’:
debug.c:784:18: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  784 |     *((char*)-1) = 'x';
      |     ~~~~~~~~~~~~~^~~~~
    CC dict.o
    CC endianconv.o
    CC help.o
    CC logger.o
    CC memtest.o
    CC protocol.o
    CC proxy.o
In file included from proxy.c:21:
proxy.c: In function ‘mergeReplies’:
logger.h:38:28: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
   38 | #define proxyLogDebug(...) proxyLog(LOGLEVEL_DEBUG, __VA_ARGS__)
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
proxy.c:1215:17: note: in expansion of macro ‘proxyLogDebug’
 1215 |                 proxyLogDebug("Child reply:\n%s\np:\n%s\nendl:\n%s",
      |                 ^~~~~~~~~~~~~
proxy.c:1215:65: note: format string is defined here
 1215 |                 proxyLogDebug("Child reply:\n%s\np:\n%s\nendl:\n%s",
      |                                                                 ^~
proxy.c: In function ‘proxyCommand’:
proxy.c:1096:61: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
 1096 |         if (strcasecmp("segfault", type) == 0) *((char*)-1) = 'x';
      |                                                ~~~~~~~~~~~~~^~~~~
    CC rax.o
    CC release.o
    CC reply_order.o
    CC siphash.o
    CC sds.o
    CC util.o
    CC zmalloc.o
    LINK redis-cluster-proxy
/usr/bin/ld: logger.o:/tmp/redis-proxy/src/sds.h:37: multiple definition of `SDS_NOINIT'; config.o:/tmp/redis-proxy/src/sds.h:37: first defined here
/usr/bin/ld: reply_order.o:/tmp/redis-proxy/src/sds.h:37: multiple definition of `SDS_NOINIT'; config.o:/tmp/redis-proxy/src/sds.h:37: first defined here
/usr/bin/ld: sds.o:/tmp/redis-proxy/src/sds.h:37: multiple definition of `SDS_NOINIT'; config.o:/tmp/redis-proxy/src/sds.h:37: first defined here
/usr/bin/ld: util.o:/tmp/redis-proxy/src/sds.h:37: multiple definition of `SDS_NOINIT'; config.o:/tmp/redis-proxy/src/sds.h:37: first defined here
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:179: redis-cluster-proxy] Error 1
make[1]: Leaving directory '/tmp/redis-proxy/src'
make: *** [Makefile:4: all] Error 2

Build environments:

gcc (GCC) 11.1.0
Linux 5.10.61-1-MANJARO

and

alpine linux 3.14
10.3.1_git20210424-r2

See:
https://bugs.gentoo.org/707210
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=957751
redis/redis#6691

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions