XRT
XRT copied to clipboard
XRT uses `rapidjson-dev` which does not compile on Ubuntu 24.04
XRT uses https://github.com/Tencent/rapidjson to parse JSON files but this is an archaic C++ which is mostly unchanged since 2016. Compiling XRT leads to
In file included from /home/rkeryell/Xilinx/Projects/AIE/xdna-driver/xrt/src/runtime_src/tools/xclbinutil/RapidJsonUtilities.h:24,
from /home/rkeryell/Xilinx/Projects/AIE/xdna-driver/xrt/src/runtime_src/tools/xclbinutil/RapidJsonUtilities.cxx:20:
/usr/include/rapidjson/document.h: In member function ‘rapidjson::GenericStringRef<CharType>& rapidjson::GenericStringRef<CharType>::operator=(const rapidjson::GenericStringRef<CharType>&)’:
/usr/include/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; }
|
which is actually https://github.com/Tencent/rapidjson/issues/718 which was opened and solved in... 2016! For some reasons Ubuntu/Debian distributes a version from 2016 from before this patch plus some Debian-specific changes.
I can see a few solutions by order of decreasing quality:
- get rid of this obsolete library and move to a modern library as there are many of them shipped in Linux distributions;
- ship the fixed file with XRT if the license allows it or use something like CMake/FetchContent to install our own;
- get the library updated on Debian/Ubuntu, but it will take some time;
- patch the library by commenting line 319 of
/usr/include/rapidjson/document.has
// GenericStringRef& operator=(const GenericStringRef& rhs) { s = rhs.s; length = rhs.length; }
(which is what I did to have XRT running on my laptop because I am lazy).
Some background information: https://github.com/Tencent/rapidjson https://packages.ubuntu.com/noble/rapidjson-dev https://packages.debian.org/sid/rapidjson-dev
In the following the members are const so obviously there cannot be an assignment operator...
template<typename CharType>
struct GenericStringRef {
GenericStringRef& operator=(const GenericStringRef& rhs) { s = rhs.s; length = rhs.length; }
const Ch* const s; //!< plain CharType pointer
const SizeType length; //!< length of the string (excluding the trailing NULL terminator)