Opened 4 months ago

Closed 4 months ago

#70478 closed defect (fixed)

opencc fails to build: error: assignment of read-only member 'rapidjson::GenericStringRef<CharType>::length'

Reported by: barracuda156 Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.9.3
Keywords: Cc:
Port: opencc

Description

[ 22%] Building CXX object src/CMakeFiles/libopencc.dir/MaxMatchSegmentation.cpp.o
cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/build/src && /opt/local/bin/ccache /opt/local/bin/g++-mp-14 -DENABLE_DARTS -DLOCALEDIR=\"/opt/local/share/locale\" -DPACKAGE_NAME=\"opencc\" -DPKGDATADIR=\"/opt/local/share/opencc\" -DVERSION=\"1.1.8\" -Dlibopencc_EXPORTS -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/build/src -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/../deps/rapidjson-1.1.0 -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/../deps/tclap-1.2.5 -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/../deps/darts-clone-0.32 -pipe -Os -DNDEBUG -I/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -std=gnu++14 -arch ppc -mmacosx-version-min=10.6 -fPIC   -std=c++14 -Wall -MD -MT src/CMakeFiles/libopencc.dir/MaxMatchSegmentation.cpp.o -MF CMakeFiles/libopencc.dir/MaxMatchSegmentation.cpp.o.d -o CMakeFiles/libopencc.dir/MaxMatchSegmentation.cpp.o -c /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/MaxMatchSegmentation.cpp
In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/Config.cpp:23:
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/../deps/rapidjson-1.1.0/rapidjson/document.h: In member function 'rapidjson::GenericStringRef<CharType>& rapidjson::GenericStringRef<CharType>::operator=(const rapidjson::GenericStringRef<CharType>&)':
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/../deps/rapidjson-1.1.0/rapidjson/document.h:319:82: error: assignment of read-only member 'rapidjson::GenericStringRef<CharType>::length'
  319 |     GenericStringRef& operator=(const GenericStringRef& rhs) { s = rhs.s; length = rhs.length; }
      |                                                                           ~~~~~~~^~~~~~~~~~~~
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/../deps/rapidjson-1.1.0/rapidjson/document.h: In instantiation of 'void rapidjson::GenericValue<Encoding, Allocator>::SetObjectRaw(Member*, rapidjson::SizeType, Allocator&) [with Encoding = rapidjson::UTF8<>; Allocator = rapidjson::MemoryPoolAllocator<>; Member = rapidjson::GenericMember<rapidjson::UTF8<>, rapidjson::MemoryPoolAllocator<> >; rapidjson::SizeType = unsigned int]':
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/../deps/rapidjson-1.1.0/rapidjson/document.h:2363:55:   required from 'bool rapidjson::GenericDocument<Encoding, Allocator, StackAllocator>::EndObject(rapidjson::SizeType) [with Encoding = rapidjson::UTF8<>; Allocator = rapidjson::MemoryPoolAllocator<>; StackAllocator = rapidjson::CrtAllocator; rapidjson::SizeType = unsigned int]'
 2363 |         stack_.template Top<ValueType>()->SetObjectRaw(members, memberCount, GetAllocator());
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/../deps/rapidjson-1.1.0/rapidjson/reader.h:1736:40:   required from 'rapidjson::GenericReader<SourceEncoding, TargetEncoding, StackAllocator>::IterativeParsingState rapidjson::GenericReader<SourceEncoding, TargetEncoding, StackAllocator>::Transit(IterativeParsingState, Token, IterativeParsingState, InputStream&, Handler&) [with unsigned int parseFlags = 1; InputStream = rapidjson::GenericInsituStringStream<rapidjson::UTF8<> >; Handler = rapidjson::GenericDocument<rapidjson::UTF8<> >; SourceEncoding = rapidjson::UTF8<>; TargetEncoding = rapidjson::UTF8<>; StackAllocator = rapidjson::CrtAllocator]'
 1736 |             bool hr = handler.EndObject(c);
      |                       ~~~~~~~~~~~~~~~~~^~~
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/../deps/rapidjson-1.1.0/rapidjson/reader.h:1832:58:   required from 'rapidjson::ParseResult rapidjson::GenericReader<SourceEncoding, TargetEncoding, StackAllocator>::IterativeParse(InputStream&, Handler&) [with unsigned int parseFlags = 1; InputStream = rapidjson::GenericInsituStringStream<rapidjson::UTF8<> >; Handler = rapidjson::GenericDocument<rapidjson::UTF8<> >; SourceEncoding = rapidjson::UTF8<>; TargetEncoding = rapidjson::UTF8<>; StackAllocator = rapidjson::CrtAllocator]'
 1832 |             IterativeParsingState d = Transit<parseFlags>(state, t, n, is, handler);
      |                                       ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/../deps/rapidjson-1.1.0/rapidjson/reader.h:487:46:   required from 'rapidjson::ParseResult rapidjson::GenericReader<SourceEncoding, TargetEncoding, StackAllocator>::Parse(InputStream&, Handler&) [with unsigned int parseFlags = 1; InputStream = rapidjson::GenericInsituStringStream<rapidjson::UTF8<> >; Handler = rapidjson::GenericDocument<rapidjson::UTF8<> >; SourceEncoding = rapidjson::UTF8<>; TargetEncoding = rapidjson::UTF8<>; StackAllocator = rapidjson::CrtAllocator]'
  487 |             return IterativeParse<parseFlags>(is, handler);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/../deps/rapidjson-1.1.0/rapidjson/document.h:2159:57:   required from 'rapidjson::GenericDocument<Encoding, Allocator, StackAllocator>& rapidjson::GenericDocument<Encoding, Allocator, StackAllocator>::ParseStream(InputStream&) [with unsigned int parseFlags = 1; SourceEncoding = rapidjson::UTF8<>; InputStream = rapidjson::GenericInsituStringStream<rapidjson::UTF8<> >; Encoding = rapidjson::UTF8<>; Allocator = rapidjson::MemoryPoolAllocator<>; StackAllocator = rapidjson::CrtAllocator]'
 2159 |         parseResult_ = reader.template Parse<parseFlags>(is, *this);
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/../deps/rapidjson-1.1.0/rapidjson/document.h:2175:62:   required from 'rapidjson::GenericDocument<Encoding, Allocator, StackAllocator>& rapidjson::GenericDocument<Encoding, Allocator, StackAllocator>::ParseStream(InputStream&) [with unsigned int parseFlags = 1; InputStream = rapidjson::GenericInsituStringStream<rapidjson::UTF8<> >; Encoding = rapidjson::UTF8<>; Allocator = rapidjson::MemoryPoolAllocator<>; StackAllocator = rapidjson::CrtAllocator]'
 2175 |         return ParseStream<parseFlags, Encoding, InputStream>(is);
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/../deps/rapidjson-1.1.0/rapidjson/document.h:2200:58:   required from 'rapidjson::GenericDocument<Encoding, Allocator, StackAllocator>& rapidjson::GenericDocument<Encoding, Allocator, StackAllocator>::ParseInsitu(Ch*) [with unsigned int parseFlags = 0; Encoding = rapidjson::UTF8<>; Allocator = rapidjson::MemoryPoolAllocator<>; StackAllocator = rapidjson::CrtAllocator; Ch = char]'
 2200 |         return ParseStream<parseFlags | kParseInsituFlag>(s);
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/Config.cpp:275:21:   required from here
  275 |   doc.ParseInsitu<0>(const_cast<char*>(json.c_str()));
      |   ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/../deps/rapidjson-1.1.0/rapidjson/document.h:1952:24: warning: 'void* memcpy(void*, const void*, size_t)' writing to an object of type 'rapidjson::GenericValue<rapidjson::UTF8<> >::Member' {aka 'struct rapidjson::GenericMember<rapidjson::UTF8<>, rapidjson::MemoryPoolAllocator<> >'} with no trivial copy-assignment; use copy-assignment instead [-Wclass-memaccess]
 1952 |             std::memcpy(m, members, count * sizeof(Member));
      |             ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/../deps/rapidjson-1.1.0/rapidjson/document.h:71:8: note: 'rapidjson::GenericValue<rapidjson::UTF8<> >::Member' {aka 'struct rapidjson::GenericMember<rapidjson::UTF8<>, rapidjson::MemoryPoolAllocator<> >'} declared here
   71 | struct GenericMember {
      |        ^~~~~~~~~~~~~
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/../deps/rapidjson-1.1.0/rapidjson/document.h: In instantiation of 'void rapidjson::GenericValue<Encoding, Allocator>::SetArrayRaw(rapidjson::GenericValue<Encoding, Allocator>*, rapidjson::SizeType, Allocator&) [with Encoding = rapidjson::UTF8<>; Allocator = rapidjson::MemoryPoolAllocator<>; rapidjson::SizeType = unsigned int]':
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/../deps/rapidjson-1.1.0/rapidjson/document.h:2371:54:   required from 'bool rapidjson::GenericDocument<Encoding, Allocator, StackAllocator>::EndArray(rapidjson::SizeType) [with Encoding = rapidjson::UTF8<>; Allocator = rapidjson::MemoryPoolAllocator<>; StackAllocator = rapidjson::CrtAllocator; rapidjson::SizeType = unsigned int]'
 2371 |         stack_.template Top<ValueType>()->SetArrayRaw(elements, elementCount, GetAllocator());
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/../deps/rapidjson-1.1.0/rapidjson/reader.h:1766:39:   required from 'rapidjson::GenericReader<SourceEncoding, TargetEncoding, StackAllocator>::IterativeParsingState rapidjson::GenericReader<SourceEncoding, TargetEncoding, StackAllocator>::Transit(IterativeParsingState, Token, IterativeParsingState, InputStream&, Handler&) [with unsigned int parseFlags = 1; InputStream = rapidjson::GenericInsituStringStream<rapidjson::UTF8<> >; Handler = rapidjson::GenericDocument<rapidjson::UTF8<> >; SourceEncoding = rapidjson::UTF8<>; TargetEncoding = rapidjson::UTF8<>; StackAllocator = rapidjson::CrtAllocator]'
 1766 |             bool hr = handler.EndArray(c);
      |                       ~~~~~~~~~~~~~~~~^~~
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/../deps/rapidjson-1.1.0/rapidjson/reader.h:1832:58:   required from 'rapidjson::ParseResult rapidjson::GenericReader<SourceEncoding, TargetEncoding, StackAllocator>::IterativeParse(InputStream&, Handler&) [with unsigned int parseFlags = 1; InputStream = rapidjson::GenericInsituStringStream<rapidjson::UTF8<> >; Handler = rapidjson::GenericDocument<rapidjson::UTF8<> >; SourceEncoding = rapidjson::UTF8<>; TargetEncoding = rapidjson::UTF8<>; StackAllocator = rapidjson::CrtAllocator]'
 1832 |             IterativeParsingState d = Transit<parseFlags>(state, t, n, is, handler);
      |                                       ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/../deps/rapidjson-1.1.0/rapidjson/reader.h:487:46:   required from 'rapidjson::ParseResult rapidjson::GenericReader<SourceEncoding, TargetEncoding, StackAllocator>::Parse(InputStream&, Handler&) [with unsigned int parseFlags = 1; InputStream = rapidjson::GenericInsituStringStream<rapidjson::UTF8<> >; Handler = rapidjson::GenericDocument<rapidjson::UTF8<> >; SourceEncoding = rapidjson::UTF8<>; TargetEncoding = rapidjson::UTF8<>; StackAllocator = rapidjson::CrtAllocator]'
  487 |             return IterativeParse<parseFlags>(is, handler);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/../deps/rapidjson-1.1.0/rapidjson/document.h:2159:57:   required from 'rapidjson::GenericDocument<Encoding, Allocator, StackAllocator>& rapidjson::GenericDocument<Encoding, Allocator, StackAllocator>::ParseStream(InputStream&) [with unsigned int parseFlags = 1; SourceEncoding = rapidjson::UTF8<>; InputStream = rapidjson::GenericInsituStringStream<rapidjson::UTF8<> >; Encoding = rapidjson::UTF8<>; Allocator = rapidjson::MemoryPoolAllocator<>; StackAllocator = rapidjson::CrtAllocator]'
 2159 |         parseResult_ = reader.template Parse<parseFlags>(is, *this);
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/../deps/rapidjson-1.1.0/rapidjson/document.h:2175:62:   required from 'rapidjson::GenericDocument<Encoding, Allocator, StackAllocator>& rapidjson::GenericDocument<Encoding, Allocator, StackAllocator>::ParseStream(InputStream&) [with unsigned int parseFlags = 1; InputStream = rapidjson::GenericInsituStringStream<rapidjson::UTF8<> >; Encoding = rapidjson::UTF8<>; Allocator = rapidjson::MemoryPoolAllocator<>; StackAllocator = rapidjson::CrtAllocator]'
 2175 |         return ParseStream<parseFlags, Encoding, InputStream>(is);
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/../deps/rapidjson-1.1.0/rapidjson/document.h:2200:58:   required from 'rapidjson::GenericDocument<Encoding, Allocator, StackAllocator>& rapidjson::GenericDocument<Encoding, Allocator, StackAllocator>::ParseInsitu(Ch*) [with unsigned int parseFlags = 0; Encoding = rapidjson::UTF8<>; Allocator = rapidjson::MemoryPoolAllocator<>; StackAllocator = rapidjson::CrtAllocator; Ch = char]'
 2200 |         return ParseStream<parseFlags | kParseInsituFlag>(s);
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/Config.cpp:275:21:   required from here
  275 |   doc.ParseInsitu<0>(const_cast<char*>(json.c_str()));
      |   ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/../deps/rapidjson-1.1.0/rapidjson/document.h:1939:24: warning: 'void* memcpy(void*, const void*, size_t)' writing to an object of type 'class rapidjson::GenericValue<rapidjson::UTF8<> >' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
 1939 |             std::memcpy(e, values, count * sizeof(GenericValue));
      |             ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/opencc-1.1.8/src/../deps/rapidjson-1.1.0/rapidjson/document.h:540:7: note: 'class rapidjson::GenericValue<rapidjson::UTF8<> >' declared here
  540 | class GenericValue {
      |       ^~~~~~~~~~~~
make[2]: *** [src/CMakeFiles/libopencc.dir/Config.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/build'
make[1]: *** [src/CMakeFiles/libopencc.dir/all] Error 2
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_opencc/opencc/work/build'
make: *** [all] Error 2

Upstream issue: https://github.com/BYVoid/OpenCC/issues/884

Attachments (1)

main.log (52.4 KB) - added by barracuda156 4 months ago.

Download all attachments as: .zip

Change History (3)

Changed 4 months ago by barracuda156

Attachment: main.log added

comment:2 Changed 4 months ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: assignedclosed

In 84291adc8e51652055ceab1425274382c8935b85/macports-ports (master):

opencc: Fix compile error with gcc

Closes: #70478

Note: See TracTickets for help on using tickets.