rpm-software-management / dnf5

Next-generation RPM package management system
Other
249 stars 85 forks source link

Ruby bindings fail to build on openSUSE Tumbleweed: ruby-3.2.0: redundant redeclaration of rb_iterate() #562

Open Conan-Kudo opened 1 year ago

Conan-Kudo commented 1 year ago

When trying to build dnf5-5.0.11 with Ruby bindings enabled, I get the following errors during the build:

[  323s] [ 66%] Building CXX object bindings/ruby/libdnf5/CMakeFiles/ruby_advisory.dir/CMakeFiles/ruby_advisory.dir/advisoryRUBY_wrap.cxx.o
[  323s] cd /home/abuild/rpmbuild/BUILD/dnf5-5.0.11/build/bindings/ruby/libdnf5 && /usr/bin/c++ -DPROJECT_BINARY_DIR=\"/home/abuild/rpmbuild/BUILD/dnf5-5.0.11/build\" -DPROJECT_SOURCE_DIR=\"/home/abuild/rpmbuild/BUILD/dnf5-5.0.11\" -DPROJECT_VERSION_MAJOR=5 -DPROJECT_VERSION_MINOR=0 -DPROJECT_VERSION_PATCH=11 -Druby_advisory_EXPORTS -I/home/abuild/rpmbuild/BUILD/dnf5-5.0.11/include -I/home/abuild/rpmbuild/BUILD/dnf5-5.0.11/common -I/usr/include/ruby-3.2.0 -I/usr/include/ruby-3.2.0/x86_64-linux-gnu -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -O2 -g -DNDEBUG -std=gnu++20 -fPIC -fmacro-prefix-map=/home/abuild/rpmbuild/BUILD/dnf5-5.0.11/= -Wall -Wextra -Werror -Wcast-align -Wformat-nonliteral -Wmissing-format-attribute -Wredundant-decls -Wsign-compare -Wtype-limits -Wuninitialized -Wwrite-strings -Werror=unused-result -Wodr -Wconversion -Wl,--as-needed -Wno-cast-align -Wno-conversion -Wno-deprecated-copy -Wno-deprecated-declarations -Wno-ignored-qualifiers -Wno-missing-declarations -Wno-missing-field-initializers -Wno-sign-compare -Wno-sometimes-uninitialized -Wno-strict-aliasing -Wno-unused-function -Wno-unused-parameter -Wno-catch-value -Wno-maybe-uninitialized -Wno-volatile -MD -MT bindings/ruby/libdnf5/CMakeFiles/ruby_advisory.dir/CMakeFiles/ruby_advisory.dir/advisoryRUBY_wrap.cxx.o -MF CMakeFiles/ruby_advisory.dir/CMakeFiles/ruby_advisory.dir/advisoryRUBY_wrap.cxx.o.d -o CMakeFiles/ruby_advisory.dir/CMakeFiles/ruby_advisory.dir/advisoryRUBY_wrap.cxx.o -c /home/abuild/rpmbuild/BUILD/dnf5-5.0.11/build/bindings/ruby/libdnf5/CMakeFiles/ruby_advisory.dir/advisoryRUBY_wrap.cxx
[  323s] In file included from /usr/include/ruby-3.2.0/ruby/internal/intern/cont.h:25,
[  323s]                  from /usr/include/ruby-3.2.0/ruby/backward/cxxanyargs.hpp:15,
[  323s]                  from /usr/include/ruby-3.2.0/ruby/internal/anyargs.h:83,
[  323s]                  from /usr/include/ruby-3.2.0/ruby/ruby.h:27,
[  323s]                  from /usr/include/ruby-3.2.0/ruby.h:38,
[  323s]                  from /home/abuild/rpmbuild/BUILD/dnf5-5.0.11/build/bindings/ruby/libdnf5/CMakeFiles/ruby_advisory.dir/advisoryRUBY_wrap.cxx:872:
[  323s] /usr/include/ruby-3.2.0/ruby/internal/iterator.h:307:7: error: redundant redeclaration of 'VALUE rb_iterate(VALUE (*)(VALUE), VALUE, rb_block_call_func_t, VALUE)' in same scope [-Werror=redundant-decls]
[  323s]   307 | VALUE rb_iterate(VALUE (*func1)(VALUE), VALUE data1, rb_block_call_func_t proc, VALUE data2);
[  323s]       |       ^~~~~~~~~~
[  323s] /usr/include/ruby-3.2.0/ruby/internal/iterator.h:283:7: note: previous declaration of 'VALUE rb_iterate(VALUE (*)(VALUE), VALUE, rb_block_call_func_t, VALUE)'
[  323s]   283 | VALUE rb_iterate(VALUE (*func1)(VALUE), VALUE data1, rb_block_call_func_t proc, VALUE data2);
[  323s]       |       ^~~~~~~~~~
[  323s] In file included from /usr/include/ruby-3.2.0/ruby/internal/intern/hash.h:26,
[  323s]                  from /usr/include/ruby-3.2.0/ruby/backward/cxxanyargs.hpp:16:
[  323s] /usr/include/ruby-3.2.0/ruby/st.h:168:42: error: redundant redeclaration of 'int rb_st_locale_insensitive_strcasecmp(const char*, const char*)' in same scope [-Werror=redundant-decls]
[  323s]   168 | #define st_locale_insensitive_strcasecmp rb_st_locale_insensitive_strcasecmp
[  323s]       |                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  323s] /usr/include/ruby-3.2.0/ruby/internal/ctype.h:132:5: note: in expansion of macro 'st_locale_insensitive_strcasecmp'
[  323s]   132 | int st_locale_insensitive_strcasecmp(const char *s1, const char *s2);
[  323s]       |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  323s] In file included from /usr/include/ruby-3.2.0/ruby/defines.h:73,
[  323s]                  from /usr/include/ruby-3.2.0/ruby/ruby.h:25:
[  323s] /usr/include/ruby-3.2.0/ruby/st.h:167:14: note: previous declaration of 'int rb_st_locale_insensitive_strcasecmp(const char*, const char*)'
[  323s]   167 | PUREFUNC(int rb_st_locale_insensitive_strcasecmp(const char *s1, const char *s2));
[  323s]       |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  323s] /usr/include/ruby-3.2.0/ruby/backward/2/attributes.h:53:40: note: in definition of macro 'PUREFUNC'
[  323s]    53 | #define PUREFUNC(x) RBIMPL_ATTR_PURE() x
[  323s]       |                                        ^
[  323s] /usr/include/ruby-3.2.0/ruby/st.h:170:43: error: redundant redeclaration of 'int rb_st_locale_insensitive_strncasecmp(const char*, const char*, size_t)' in same scope [-Werror=redundant-decls]
[  323s]   170 | #define st_locale_insensitive_strncasecmp rb_st_locale_insensitive_strncasecmp
[  323s]       |                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  323s] /usr/include/ruby-3.2.0/ruby/internal/ctype.h:152:5: note: in expansion of macro 'st_locale_insensitive_strncasecmp'
[  323s]   152 | int st_locale_insensitive_strncasecmp(const char *s1, const char *s2, size_t n);
[  323s]       |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  323s] /usr/include/ruby-3.2.0/ruby/st.h:169:14: note: previous declaration of 'int rb_st_locale_insensitive_strncasecmp(const char*, const char*, size_t)'
[  323s]   169 | PUREFUNC(int rb_st_locale_insensitive_strncasecmp(const char *s1, const char *s2, size_t n));
[  323s]       |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  323s] /usr/include/ruby-3.2.0/ruby/backward/2/attributes.h:53:40: note: in definition of macro 'PUREFUNC'
[  323s]    53 | #define PUREFUNC(x) RBIMPL_ATTR_PURE() x
[  323s]       |                                        ^
[  323s] cc1plus: note: unrecognized command-line option '-Wno-sometimes-uninitialized' may have been intended to silence earlier diagnostics
[  323s] cc1plus: all warnings being treated as errors
[  323s] make[2]: *** [bindings/ruby/libdnf5/CMakeFiles/ruby_advisory.dir/build.make:79: bindings/ruby/libdnf5/CMakeFiles/ruby_advisory.dir/CMakeFiles/ruby_advisory.dir/advisoryRUBY_wrap.cxx.o] Error 1
[  323s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/dnf5-5.0.11/build'
[  323s] make[1]: *** [CMakeFiles/Makefile2:2456: bindings/ruby/libdnf5/CMakeFiles/ruby_advisory.dir/all] Error 2
[...]
[  338s] [ 68%] Building CXX object bindings/ruby/libdnf5/CMakeFiles/ruby_base.dir/CMakeFiles/ruby_base.dir/baseRUBY_wrap.cxx.o
[  338s] cd /home/abuild/rpmbuild/BUILD/dnf5-5.0.11/build/bindings/ruby/libdnf5 && /usr/bin/c++ -DPROJECT_BINARY_DIR=\"/home/abuild/rpmbuild/BUILD/dnf5-5.0.11/build\" -DPROJECT_SOURCE_DIR=\"/home/abuild/rpmbuild/BUILD/dnf5-5.0.11\" -DPROJECT_VERSION_MAJOR=5 -DPROJECT_VERSION_MINOR=0 -DPROJECT_VERSION_PATCH=11 -Druby_base_EXPORTS -I/home/abuild/rpmbuild/BUILD/dnf5-5.0.11/include -I/home/abuild/rpmbuild/BUILD/dnf5-5.0.11/common -I/usr/include/ruby-3.2.0 -I/usr/include/ruby-3.2.0/x86_64-linux-gnu -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -O2 -g -DNDEBUG -std=gnu++20 -fPIC -fmacro-prefix-map=/home/abuild/rpmbuild/BUILD/dnf5-5.0.11/= -Wall -Wextra -Werror -Wcast-align -Wformat-nonliteral -Wmissing-format-attribute -Wredundant-decls -Wsign-compare -Wtype-limits -Wuninitialized -Wwrite-strings -Werror=unused-result -Wodr -Wconversion -Wl,--as-needed -Wno-cast-align -Wno-conversion -Wno-deprecated-copy -Wno-deprecated-declarations -Wno-ignored-qualifiers -Wno-missing-declarations -Wno-missing-field-initializers -Wno-sign-compare -Wno-sometimes-uninitialized -Wno-strict-aliasing -Wno-unused-function -Wno-unused-parameter -Wno-catch-value -Wno-maybe-uninitialized -Wno-volatile -MD -MT bindings/ruby/libdnf5/CMakeFiles/ruby_base.dir/CMakeFiles/ruby_base.dir/baseRUBY_wrap.cxx.o -MF CMakeFiles/ruby_base.dir/CMakeFiles/ruby_base.dir/baseRUBY_wrap.cxx.o.d -o CMakeFiles/ruby_base.dir/CMakeFiles/ruby_base.dir/baseRUBY_wrap.cxx.o -c /home/abuild/rpmbuild/BUILD/dnf5-5.0.11/build/bindings/ruby/libdnf5/CMakeFiles/ruby_base.dir/baseRUBY_wrap.cxx
[  338s] In file included from /usr/include/ruby-3.2.0/ruby/internal/intern/cont.h:25,
[  338s]                  from /usr/include/ruby-3.2.0/ruby/backward/cxxanyargs.hpp:15,
[  338s]                  from /usr/include/ruby-3.2.0/ruby/internal/anyargs.h:83,
[  338s]                  from /usr/include/ruby-3.2.0/ruby/ruby.h:27,
[  338s]                  from /usr/include/ruby-3.2.0/ruby.h:38,
[  338s]                  from /home/abuild/rpmbuild/BUILD/dnf5-5.0.11/build/bindings/ruby/libdnf5/CMakeFiles/ruby_base.dir/baseRUBY_wrap.cxx:873:
[  338s] /usr/include/ruby-3.2.0/ruby/internal/iterator.h:307:7: error: redundant redeclaration of 'VALUE rb_iterate(VALUE (*)(VALUE), VALUE, rb_block_call_func_t, VALUE)' in same scope [-Werror=redundant-decls]
[  338s]   307 | VALUE rb_iterate(VALUE (*func1)(VALUE), VALUE data1, rb_block_call_func_t proc, VALUE data2);
[  338s]       |       ^~~~~~~~~~
[  338s] /usr/include/ruby-3.2.0/ruby/internal/iterator.h:283:7: note: previous declaration of 'VALUE rb_iterate(VALUE (*)(VALUE), VALUE, rb_block_call_func_t, VALUE)'
[  338s]   283 | VALUE rb_iterate(VALUE (*func1)(VALUE), VALUE data1, rb_block_call_func_t proc, VALUE data2);
[  338s]       |       ^~~~~~~~~~
[  338s] In file included from /usr/include/ruby-3.2.0/ruby/internal/intern/hash.h:26,
[  338s]                  from /usr/include/ruby-3.2.0/ruby/backward/cxxanyargs.hpp:16:
[  338s] /usr/include/ruby-3.2.0/ruby/st.h:168:42: error: redundant redeclaration of 'int rb_st_locale_insensitive_strcasecmp(const char*, const char*)' in same scope [-Werror=redundant-decls]
[  338s]   168 | #define st_locale_insensitive_strcasecmp rb_st_locale_insensitive_strcasecmp
[  338s]       |                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  338s] /usr/include/ruby-3.2.0/ruby/internal/ctype.h:132:5: note: in expansion of macro 'st_locale_insensitive_strcasecmp'
[  338s]   132 | int st_locale_insensitive_strcasecmp(const char *s1, const char *s2);
[  338s]       |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  338s] In file included from /usr/include/ruby-3.2.0/ruby/defines.h:73,
[  338s]                  from /usr/include/ruby-3.2.0/ruby/ruby.h:25:
[  338s] /usr/include/ruby-3.2.0/ruby/st.h:167:14: note: previous declaration of 'int rb_st_locale_insensitive_strcasecmp(const char*, const char*)'
[  338s]   167 | PUREFUNC(int rb_st_locale_insensitive_strcasecmp(const char *s1, const char *s2));
[  338s]       |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  338s] /usr/include/ruby-3.2.0/ruby/backward/2/attributes.h:53:40: note: in definition of macro 'PUREFUNC'
[  338s]    53 | #define PUREFUNC(x) RBIMPL_ATTR_PURE() x
[  338s]       |                                        ^
[  338s] /usr/include/ruby-3.2.0/ruby/st.h:170:43: error: redundant redeclaration of 'int rb_st_locale_insensitive_strncasecmp(const char*, const char*, size_t)' in same scope [-Werror=redundant-decls]
[  338s]   170 | #define st_locale_insensitive_strncasecmp rb_st_locale_insensitive_strncasecmp
[  338s]       |                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  338s] /usr/include/ruby-3.2.0/ruby/internal/ctype.h:152:5: note: in expansion of macro 'st_locale_insensitive_strncasecmp'
[  338s]   152 | int st_locale_insensitive_strncasecmp(const char *s1, const char *s2, size_t n);
[  338s]       |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  338s] /usr/include/ruby-3.2.0/ruby/st.h:169:14: note: previous declaration of 'int rb_st_locale_insensitive_strncasecmp(const char*, const char*, size_t)'
[  338s]   169 | PUREFUNC(int rb_st_locale_insensitive_strncasecmp(const char *s1, const char *s2, size_t n));
[  338s]       |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  338s] /usr/include/ruby-3.2.0/ruby/backward/2/attributes.h:53:40: note: in definition of macro 'PUREFUNC'
[  338s]    53 | #define PUREFUNC(x) RBIMPL_ATTR_PURE() x
[  338s]       |                                        ^
[  338s] cc1plus: note: unrecognized command-line option '-Wno-sometimes-uninitialized' may have been intended to silence earlier diagnostics
[  338s] cc1plus: all warnings being treated as errors
[  338s] make[2]: *** [bindings/ruby/libdnf5/CMakeFiles/ruby_base.dir/build.make:79: bindings/ruby/libdnf5/CMakeFiles/ruby_base.dir/CMakeFiles/ruby_base.dir/baseRUBY_wrap.cxx.o] Error 1
[  338s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/dnf5-5.0.11/build'
[  338s] make[1]: *** [CMakeFiles/Makefile2:2510: bindings/ruby/libdnf5/CMakeFiles/ruby_base.dir/all] Error 2

This is with openSUSE Tumbleweed x86_64 with Ruby 3.2.

j-mracek commented 1 year ago

It would be interesting to compare the build environment between yours and in Fedora.

ppisar commented 1 week ago

What ruby and swig do you use? Can you still reproduce this issue?