Opened 5 months ago

Closed 3 weeks ago

#70842 closed defect (fixed)

rapidjson: error: cannot assign to non-static data member 'length' with const-qualified type 'const SizeType' (aka 'const unsigned int')

Reported by: kwolcott Owned by: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Priority: Normal Milestone:
Component: ports Version:
Keywords: sequoia Cc: barracuda156
Port: rapidjson

Description (last modified by ryandesign (Ryan Carsten Schmidt))

const SizeType' (aka 'const unsigned int')
  319 |     GenericStringRef& operator=(const GenericStringRef& rhs) { s = rhs.s; length = rhs.length; }
      |                                                                           ~~~~~~ ^
/opt/local/include/rapidjson/document.h:325:20: note: non-static data member 'length' declared const here
  325 |     const SizeType length; //!< length of the string (excluding the trailing NULL terminator)
      |     ~~~~~~~~~~~~~~~^~~~~~
1 error generated.
make[2]: *** [src/lfortran/CMakeFiles/lfortran_lib.dir/ast_to_json.cpp.o] Error 1

MacOS 15.0

Attachments (1)

lfortran_port_build_failure.log.bz2 (12.5 KB) - added by kwolcott 5 months ago.

Download all attachments as: .zip

Change History (8)

Changed 5 months ago by kwolcott

comment:1 Changed 5 months ago by ryandesign (Ryan Carsten Schmidt)

Cc: barracuda156 added
Description: modified (diff)
Keywords: sequoia added
Owner: set to MarcusCalhoun-Lopez
Port: rapidjson added
Status: newassigned

Remember to use WikiFormatting.

You didn't show what the error was but from your log it was:

/opt/local/include/rapidjson/document.h:319:82: error: cannot assign to non-static data member 'length' with const-qualified type 'const SizeType' (aka 'const unsigned int')

That sounds like a bug in the port that provides the file /opt/local/include/rapidjson/document.h, namely rapidjson.

comment:2 Changed 3 months ago by kwolcott

Looks like it is working now.

comment:3 in reply to:  1 Changed 3 weeks ago by barracuda156

Replying to ryandesign:

Remember to use WikiFormatting.

You didn't show what the error was but from your log it was:

/opt/local/include/rapidjson/document.h:319:82: error: cannot assign to non-static data member 'length' with const-qualified type 'const SizeType' (aka 'const unsigned int')

That sounds like a bug in the port that provides the file /opt/local/include/rapidjson/document.h, namely rapidjson.

Yes, it is rapidjson is broken. I have seen a number of examples of the same failure. Just now:

[292/478] /opt/local/bin/g++-mp-14 -DARROW_EXTRA_ERROR_CONTEXT -DARROW_WITH_TIMING_TESTS -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_apache-arrow/apache-arrow/work/build/src -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_apache-arrow/apache-arrow/work/arrow-19.0.0/cpp/src -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_apache-arrow/apache-arrow/work/arrow-19.0.0/cpp/src/generated -isystem /opt/local/include -Wno-noexcept-type -Wno-self-move -pipe -I/opt/local/libexec/boost/1.81/include -Os -DNDEBUG -I/opt/local/libexec/boost/1.81/include -isystem/opt/local/include/LegacySupport -I/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -fdiagnostics-color=always  -Wall -fno-semantic-interposition -maltivec  -O3 -DNDEBUG -O2 -ftree-vectorize  -std=c++17 -arch ppc -mmacosx-version-min=10.6 -fPIC -MD -MT src/arrow/CMakeFiles/arrow_json.dir/extension/opaque.cc.o -MF src/arrow/CMakeFiles/arrow_json.dir/extension/opaque.cc.o.d -o src/arrow/CMakeFiles/arrow_json.dir/extension/opaque.cc.o -c /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_apache-arrow/apache-arrow/work/arrow-19.0.0/cpp/src/arrow/extension/opaque.cc
FAILED: src/arrow/CMakeFiles/arrow_json.dir/extension/opaque.cc.o 
/opt/local/bin/g++-mp-14 -DARROW_EXTRA_ERROR_CONTEXT -DARROW_WITH_TIMING_TESTS -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_apache-arrow/apache-arrow/work/build/src -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_apache-arrow/apache-arrow/work/arrow-19.0.0/cpp/src -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_apache-arrow/apache-arrow/work/arrow-19.0.0/cpp/src/generated -isystem /opt/local/include -Wno-noexcept-type -Wno-self-move -pipe -I/opt/local/libexec/boost/1.81/include -Os -DNDEBUG -I/opt/local/libexec/boost/1.81/include -isystem/opt/local/include/LegacySupport -I/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -fdiagnostics-color=always  -Wall -fno-semantic-interposition -maltivec  -O3 -DNDEBUG -O2 -ftree-vectorize  -std=c++17 -arch ppc -mmacosx-version-min=10.6 -fPIC -MD -MT src/arrow/CMakeFiles/arrow_json.dir/extension/opaque.cc.o -MF src/arrow/CMakeFiles/arrow_json.dir/extension/opaque.cc.o.d -o src/arrow/CMakeFiles/arrow_json.dir/extension/opaque.cc.o -c /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_apache-arrow/apache-arrow/work/arrow-19.0.0/cpp/src/arrow/extension/opaque.cc
In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_apache-arrow/apache-arrow/work/arrow-19.0.0/cpp/src/arrow/extension/opaque.cc:25:
/opt/local/include/rapidjson/document.h: In member function 'arrow::rapidjson::GenericStringRef<CharType>& arrow::rapidjson::GenericStringRef<CharType>::operator=(const arrow::rapidjson::GenericStringRef<CharType>&)':
/opt/local/include/rapidjson/document.h:319:82: error: assignment of read-only member 'arrow::rapidjson::GenericStringRef<CharType>::length'
  319 |     GenericStringRef& operator=(const GenericStringRef& rhs) { s = rhs.s; length = rhs.length; }
      |                                                                           ~~~~~~~^~~~~~~~~~~~

It is fixed in rapidjson-devel. However it is not obvious for anyone just trying to build some port which relies on rapidjson that instead rapidjson-devel must be used. The port should be updated or at least a fix for this backported.

comment:4 in reply to:  2 Changed 3 weeks ago by barracuda156

Replying to kwolcott:

Looks like it is working now.

The issue has nothing to do with lfortran, it is a bug in a version of rapidjson which MacPorts uses. It is still unfixed.

comment:5 Changed 3 weeks ago by ryandesign (Ryan Carsten Schmidt)

Port: lfortran removed
Summary: lfortran port fails to compilerapidjson: error: cannot assign to non-static data member 'length' with const-qualified type 'const SizeType' (aka 'const unsigned int')

The port should be updated

There's nothing to update to; the rapidjson port is already at the latest stable version, 1.1.0. There is already an upstream bug report asking the developers to release a new stable version. Until that happens, you can try to identify which upstream commit fixed it so that it can be backported.

comment:6 Changed 3 weeks ago by ryandesign (Ryan Carsten Schmidt)

I believe this is the upstream bug: https://github.com/Tencent/rapidjson/issues/718

And this the fix: https://github.com/Tencent/rapidjson/pull/719

but I haven't tested the fix. Let us know if you test it and it works.

comment:7 Changed 3 weeks ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: assignedclosed

In 63a3caff522c92cabf6282777790ce21b9d00ef6/macports-ports (master):

rapidjson: Remove wrong assignment operator

Some compilers complained when compiling code that includes
<rapidjson/document.h>.

Closes: #70842

Note: See TracTickets for help on using tickets.