czmq
czmq copied to clipboard
Errors with -Werror=redundant-decls
Hi all,
I've just brough Zyre into my project and am getting this build error:
https://github.com/SentryPeer/SentryPeer/runs/5101350050?check_suite_focus=true
gcc -DHAVE_CONFIG_H -I. -Wall -Werror -Wextra -Wpedantic -pedantic -Wformat=2 -Wno-unused-parameter -Wshadow -Wwrite-strings -Wstrict-prototypes -Wold-style-definition -Wredundant-decls -Wnested-externs -Wmissing-include-dirs -std=c18 -D_FORTIFY_SOURCE=2 -fpie -fpic -g3 -O2 -fstack-protector-strong -grecord-gcc-switches -Werror=format-security -Werror=implicit-function-declaration -Wmisleading-indentation -g -O2 -pthread -I/home/linuxbrew/.linuxbrew/Cellar/zyre/2.0.1/include -I/home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include -I/home/linuxbrew/.linuxbrew/Cellar/zeromq/4.3.4/include -I/home/linuxbrew/.linuxbrew/Cellar/libsodium/1.0.18_1/include -I/home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include -I/home/linuxbrew/.linuxbrew/Cellar/zeromq/4.3.4/include -I/home/linuxbrew/.linuxbrew/Cellar/libsodium/1.0.18_1/include -I/home/linuxbrew/.linuxbrew/Cellar/zeromq/4.3.4/include -I/home/linuxbrew/.linuxbrew/Cellar/libsodium/1.0.18_1/include -MT src/sentrypeer.o -MD -MP -MF $depbase.Tpo -c -o src/sentrypeer.o src/sentrypeer.c &&\
mv -f $depbase.Tpo $depbase.Po
In file included from /home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/czmq_library.h:159,
from /home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/czmq.h:37,
from /home/linuxbrew/.linuxbrew/Cellar/zyre/2.0.1/include/zyre_library.h:26,
from /home/linuxbrew/.linuxbrew/Cellar/zyre/2.0.1/include/zyre.h:23,
from src/conf.h:20,
from src/sentrypeer.c:25:
/home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/zclock.h:67:18: error: redundant redeclaration of ‘zclock_log’ [-Werror=redundant-decls]
67 | CZMQ_EXPORT void zclock_log (const char *format, ...) CHECK_PRINTF (1);
| ^~~~~~~~~~
/home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/zclock.h:64:5: note: previous declaration of ‘zclock_log’ with type ‘void(const char *, ...)’
64 | zclock_log (const char *format, ...);
| ^~~~~~~~~~
In file included from /home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/czmq_library.h:160,
from /home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/czmq.h:37,
from /home/linuxbrew/.linuxbrew/Cellar/zyre/2.0.1/include/zyre_library.h:26,
from /home/linuxbrew/.linuxbrew/Cellar/zyre/2.0.1/include/zyre.h:23,
from src/conf.h:20,
from src/sentrypeer.c:25:
/home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/zconfig.h:194:5: error: redundant redeclaration of ‘zconfig_test’ [-Werror=redundant-decls]
194 | zconfig_test (bool verbose);
| ^~~~~~~~~~~~
/home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/zconfig.h:168:5: note: previous declaration of ‘zconfig_test’ with type ‘void(_Bool)’
168 | zconfig_test (bool verbose);
| ^~~~~~~~~~~~
/home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/zconfig.h:197:18: error: redundant redeclaration of ‘zconfig_set_value’ [-Werror=redundant-decls]
197 | CZMQ_EXPORT void zconfig_set_value (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2);
| ^~~~~~~~~~~~~~~~~
/home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/zconfig.h:82:5: note: previous declaration of ‘zconfig_set_value’ with type ‘void(zconfig_t *, const char *, ...)’ {aka ‘void(struct _zconfig_t *, const char *, ...)’}
82 | zconfig_set_value (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2);
| ^~~~~~~~~~~~~~~~~
In file included from /home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/czmq_library.h:172,
from /home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/czmq.h:37,
from /home/linuxbrew/.linuxbrew/Cellar/zyre/2.0.1/include/zyre_library.h:26,
from /home/linuxbrew/.linuxbrew/Cellar/zyre/2.0.1/include/zyre.h:23,
from src/conf.h:20,
from src/sentrypeer.c:25:
/home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/zmsg.h:278:17: error: redundant redeclaration of ‘zmsg_addstrf’ [-Werror=redundant-decls]
278 | CZMQ_EXPORT int zmsg_addstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2);
| ^~~~~~~~~~~~
/home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/zmsg.h:131:5: note: previous declaration of ‘zmsg_addstrf’ with type ‘int(zmsg_t *, const char *, ...)’ {aka ‘int(struct _zmsg_t *, const char *, ...)’}
131 | zmsg_addstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2);
| ^~~~~~~~~~~~
/home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/zmsg.h:279:17: error: redundant redeclaration of ‘zmsg_pushstrf’ [-Werror=redundant-decls]
279 | CZMQ_EXPORT int zmsg_pushstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2);
| ^~~~~~~~~~~~~
/home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/zmsg.h:126:5: note: previous declaration of ‘zmsg_pushstrf’ with type ‘int(zmsg_t *, const char *, ...)’ {aka ‘int(struct _zmsg_t *, const char *, ...)’}
126 | zmsg_pushstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2);
| ^~~~~~~~~~~~~
In file included from /home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/czmq_library.h:175,
from /home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/czmq.h:37,
from /home/linuxbrew/.linuxbrew/Cellar/zyre/2.0.1/include/zyre_library.h:26,
from /home/linuxbrew/.linuxbrew/Cellar/zyre/2.0.1/include/zyre.h:23,
from src/conf.h:20,
from src/sentrypeer.c:25:
/home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/zstr.h:129:17: error: redundant redeclaration of ‘zstr_sendf’ [-Werror=redundant-decls]
129 | CZMQ_EXPORT int zstr_sendf (void *dest, const char *format, ...) CHECK_PRINTF (2);
| ^~~~~~~~~~
/home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/zstr.h:61:5: note: previous declaration of ‘zstr_sendf’ with type ‘int(void *, const char *, ...)’
61 | zstr_sendf (void *dest, const char *format, ...) CHECK_PRINTF (2);
| ^~~~~~~~~~
cc1: all warnings being treated as errors
Process finished with exit code 2
I've posted here before hand:
https://lists.zeromq.org/pipermail/zeromq-dev/2022-February/033675.html
If I remove -Werror=redundant-decls
, all is well. clang is fine, it's gcc. What am I doing wrong here as a user?
Thanks.
Just install libczmq-dev, no need to build it
Hi @bluca
If you look here, it's all installed via Homebrew and PKG_CHECK_MODULES is used to find it:
https://github.com/SentryPeer/SentryPeer/runs/5101350050?check_suite_focus=true#step:3:360
The building and installing of libzcmq is done for me. I don't think that would resolve the -Werror=redundant-decl issue?
Thanks.
Proved this away from my project:
all OK:
~/src/zyre/examples/minimal [master*]$ gcc -Werror=all `pkg-config --libs --cflags libzyre libczmq` minimal.c -o minimal
with -Werror=redundant-decls
:
gcc -Werror=redundant-decls `pkg-config --libs --cflags libzyre ` minimal.c -o minimal
In file included from /home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/czmq_library.h:159,
from /home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/czmq.h:37,
from /home/linuxbrew/.linuxbrew/Cellar/zyre/2.0.1/include/zyre_library.h:26,
from /home/linuxbrew/.linuxbrew/Cellar/zyre/2.0.1/include/zyre.h:23,
from minimal.c:25:
/home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/zclock.h:67:18: error: redundant redeclaration of ‘zclock_log’ [-Werror=redundant-decls]
67 | CZMQ_EXPORT void zclock_log (const char *format, ...) CHECK_PRINTF (1);
| ^~~~~~~~~~
/home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/zclock.h:64:5: note: previous declaration of ‘zclock_log’ with type ‘void(const char *, ...)’
64 | zclock_log (const char *format, ...);
| ^~~~~~~~~~
In file included from /home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/czmq_library.h:160,
from /home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/czmq.h:37,
from /home/linuxbrew/.linuxbrew/Cellar/zyre/2.0.1/include/zyre_library.h:26,
from /home/linuxbrew/.linuxbrew/Cellar/zyre/2.0.1/include/zyre.h:23,
from minimal.c:25:
/home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/zconfig.h:194:5: error: redundant redeclaration of ‘zconfig_test’ [-Werror=redundant-decls]
194 | zconfig_test (bool verbose);
| ^~~~~~~~~~~~
/home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/zconfig.h:168:5: note: previous declaration of ‘zconfig_test’ with type ‘void(_Bool)’
168 | zconfig_test (bool verbose);
| ^~~~~~~~~~~~
/home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/zconfig.h:197:18: error: redundant redeclaration of ‘zconfig_set_value’ [-Werror=redundant-decls]
197 | CZMQ_EXPORT void zconfig_set_value (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2);
| ^~~~~~~~~~~~~~~~~
/home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/zconfig.h:82:5: note: previous declaration of ‘zconfig_set_value’ with type ‘void(zconfig_t *, const char *, ...)’ {aka ‘void(struct _zconfig_t *, const char *, ...)’}
82 | zconfig_set_value (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2);
| ^~~~~~~~~~~~~~~~~
In file included from /home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/czmq_library.h:172,
from /home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/czmq.h:37,
from /home/linuxbrew/.linuxbrew/Cellar/zyre/2.0.1/include/zyre_library.h:26,
from /home/linuxbrew/.linuxbrew/Cellar/zyre/2.0.1/include/zyre.h:23,
from minimal.c:25:
/home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/zmsg.h:278:17: error: redundant redeclaration of ‘zmsg_addstrf’ [-Werror=redundant-decls]
278 | CZMQ_EXPORT int zmsg_addstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2);
| ^~~~~~~~~~~~
/home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/zmsg.h:131:5: note: previous declaration of ‘zmsg_addstrf’ with type ‘int(zmsg_t *, const char *, ...)’ {aka ‘int(struct _zmsg_t *, const char *, ...)’}
131 | zmsg_addstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2);
| ^~~~~~~~~~~~
/home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/zmsg.h:279:17: error: redundant redeclaration of ‘zmsg_pushstrf’ [-Werror=redundant-decls]
279 | CZMQ_EXPORT int zmsg_pushstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2);
| ^~~~~~~~~~~~~
/home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/zmsg.h:126:5: note: previous declaration of ‘zmsg_pushstrf’ with type ‘int(zmsg_t *, const char *, ...)’ {aka ‘int(struct _zmsg_t *, const char *, ...)’}
126 | zmsg_pushstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2);
| ^~~~~~~~~~~~~
In file included from /home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/czmq_library.h:175,
from /home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/czmq.h:37,
from /home/linuxbrew/.linuxbrew/Cellar/zyre/2.0.1/include/zyre_library.h:26,
from /home/linuxbrew/.linuxbrew/Cellar/zyre/2.0.1/include/zyre.h:23,
from minimal.c:25:
/home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/zstr.h:129:17: error: redundant redeclaration of ‘zstr_sendf’ [-Werror=redundant-decls]
129 | CZMQ_EXPORT int zstr_sendf (void *dest, const char *format, ...) CHECK_PRINTF (2);
| ^~~~~~~~~~
/home/linuxbrew/.linuxbrew/Cellar/czmq/4.2.1/include/zstr.h:61:5: note: previous declaration of ‘zstr_sendf’ with type ‘int(void *, const char *, ...)’
61 | zstr_sendf (void *dest, const char *format, ...) CHECK_PRINTF (2);
| ^~~~~~~~~~
cc1: some warnings being treated as errors
Could this be due to how Homebrew has built czmq I wonder? I'll check with libczmq-dev
like you suggest and check out the Homebrew formula.