On 29/01/21 09:16 -0000, Martin Gansser wrote:
Hi, i am trying to compile cxxtools 2.2.1 [1] on Fedora 34 with gcc11 but this fails with following error messages [2] on Fedora build server. make[2]: Entering directory '/builddir/build/BUILD/cxxtools-2.2.1/src' /bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I../src -I../include -I../include -Wno-long-long -Wall -pedantic -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -c -o settingswriter.lo settingswriter.cpp libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../src -I../include -I../include -Wno-long-long -Wall -pedantic -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -c settingswriter.cpp -fPIC -DPIC -o .libs/settingswriter.o In file included from settingswriter.h:31, from settingswriter.cpp:28: ../include/cxxtools/char.h: In static member function 'static std::char_traits<cxxtools::Char>::char_type* std::char_traits<cxxtools::Char>::move(std::char_traits<cxxtools::Char>::char_type*, const char_type*, std::char_traits<cxxtools::Char>::int_type)': ../include/cxxtools/char.h:337:80: warning: 'void* memmove(void*, const void*, size_t)' writing to an object of type 'std::char_traits<cxxtools::Char>::char_type' {aka 'class cxxtools::Char'} with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess] 337 | return (cxxtools::Char*)std::memmove(s1, s2, n * sizeof(cxxtools::Char)); | ^ In file included from settingswriter.h:31, from settingswriter.cpp:28: ../include/cxxtools/char.h:65:11: note: 'std::char_traits<cxxtools::Char>::char_type' {aka 'class cxxtools::Char'} declared here 65 | class Char | ^~~~ In file included from settingswriter.h:31, from settingswriter.cpp:28: ../include/cxxtools/char.h: In static member function 'static std::char_traits<cxxtools::Char>::char_type* std::char_traits<cxxtools::Char>::copy(std::char_traits<cxxtools::Char>::char_type*, const char_type*, std::size_t)': ../include/cxxtools/char.h:344:79: warning: 'void* memcpy(void*, const void*, size_t)' writing to an object of type 'std::char_traits<cxxtools::Char>::char_type' {aka 'class cxxtools::Char'} with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess] 344 | return (cxxtools::Char*)std::memcpy(s1, s2, n * sizeof(cxxtools::Char)); | ^
This warning is surprising. The type should have a trivial copy assignment operator.
In file included from settingswriter.h:31, from settingswriter.cpp:28: ../include/cxxtools/char.h:65:11: note: 'std::char_traits<cxxtools::Char>::char_type' {aka 'class cxxtools::Char'} declared here 65 | class Char | ^~~~ In file included from /usr/include/c++/11/bits/basic_string.h:48, from /usr/include/c++/11/string:55, from ../include/cxxtools/char.h:32, from settingswriter.h:31, from settingswriter.cpp:28: /usr/include/c++/11/string_view: In instantiation of 'class std::basic_string_view<cxxtools::Char, std::char_traits<cxxtools::Char> >': settingswriter.cpp:42:26: required from here /usr/include/c++/11/string_view:98:21: error: static assertion failed 98 | static_assert(is_trivial_v<_CharT> && is_standard_layout_v<_CharT>); | ^~~~~~~~~~~~~~~~~~~~ /usr/include/c++/11/string_view:98:21: note: 'std::is_trivial_v<cxxtools::Char>' evaluates to false
With the patch below the class should be trivial. However, if it has a non-trivial copy assignment operator, that would explain why it's not trivial. Why is the copy assignment operator not trivial? That's what you need to check.
make[2]: *** [Makefile:740: settingswriter.lo] Error 1 [1] https://martinkg.fedorapeople.org/ErrorReports/cxxtools-2.2.1-25.fc33.src.rpm [2] https://koji.fedoraproject.org/koji/taskinfo?taskID=60804463 I use the following patch for gcc11: --- include/cxxtools/char.h.orig 2021-01-28 10:15:36.017763265 +0100 +++ include/cxxtools/char.h 2021-01-28 10:16:14.833762026 +0100 @@ -68,9 +68,7 @@ typedef int32_t value_type; //! Constructs a character with a value of 0. - Char() - : _value(0) - {} + Char() = default; //! Constructs a character using the given char as base for the character value. Char(char ch) --- src/char.cpp.orig 2021-01-29 09:50:47.876669852 +0100 +++ src/char.cpp 2021-01-29 09:51:37.747675779 +0100 @@ -140,7 +140,7 @@ cxxtools::Char ctype<cxxtools::Char>::do_widen(char ch) const { - return cxxtools::Char(ch); + return cxxtools::Char(static_cast<unsigned char>(ch));
This second part of the patch is from a different unrelated upstream change, you don't need it in Fedora. _______________________________________________ devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx