msgpack-tools icon indicating copy to clipboard operation
msgpack-tools copied to clipboard

Compilation fails on GCC v14.2 (v14 and greater I think?) due to rapidjson 'assignment of read-only member' error

Open nuclearpidgeon opened this issue 1 year ago • 2 comments

A clean checkout + ./configure + make on my Arch linux system gives the following error:

contrib/rapidjson/include/rapidjson/document.h: In member function ‘rapidjson::GenericStringRef<CharType>& rapidjson::GenericStringRef<CharType>::operator=(const rapidjson::GenericStringRef<CharType>&)’:
contrib/rapidjson/include/rapidjson/document.h:319:82: error: assignment of read-only member ‘rapidjson::GenericStringRef<CharType>::length’
  319 | cStringRef& operator=(const GenericStringRef& rhs) { s = rhs.s; length = rhs.length; }
      |                                                                 ~~~~~~~^~~~~~~~~~~~

make: *** [Makefile:58: msgpack2json] Error 1

The same issue occurred when I tried to build the AUR package at https://aur.archlinux.org/msgpack-tools.git

It seems the underlying issue is Tencent/rapidjson#2277, and a fix got merged as of 2016(!) but there has still not been a new release with the fix in it...

cemu-project/Cemu#1196 has an example of the same problem on Arch and links to a patch file (https://github.com/Tencent/rapidjson/commit/3b2441b8.patch) that can fix the issue to facilitate building. I can try put together a PR for something like this given some guidance on what the best approach might be for this project.

nuclearpidgeon avatar Oct 04 '24 05:10 nuclearpidgeon

Please fix this. Second install where i have to manually patch this :(

markg85 avatar Apr 12 '25 02:04 markg85

Contrary to the diff in rapidjson, this needs to be fixed in the CMakeLists.txt.

find:

set(RAPIDJSON_COMMIT "99ba17bd66a85ec64a2f322b68c2b9c3b77a4391")

replace it with:

set(RAPIDJSON_COMMIT "9bd618f545ab647e2c3bcbf2f1d87423d6edf800")

Rebuild and done. For those who think: "but.. i don't see cmake? why/how/wtf...".

So this repo has a develop and a master branch. The default on this site is develop (no cmake there). The version you get when installing it in Arch is... surprise.. Master. Which has the cmake stuff. Yeah, that tripped me up a few times already.

markg85 avatar Apr 12 '25 02:04 markg85