rttr
rttr copied to clipboard
Cannot compile rttr on a Ubuntu 22.04 machine
Hello,
I am struggling to compile rttr
on a Ubuntu 22.04 machine. I am using the master
branch and the commit: https://github.com/rttrorg/rttr/commit/7edbd580cfad509a3253c733e70144e36f02ecd4. The error I get is:
~/rttr/3rd_party/rapidjson-1.1.0/rapidjson/document.h:1953:24: error: ‘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 [-Werror=class-memaccess]
1953 | std::memcpy(e, values, count * sizeof(GenericValue));
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~´
The CMake configuration is:
-- The CXX compiler identification is GNU 11.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Project version: 0.9.7
-- Architecture: x64
-- Enabled: use of RTTI
-- Performing Test HAS_NO_EXCEPT_TYPE_SIGNATURE_SUPPORT
-- Performing Test HAS_NO_EXCEPT_TYPE_SIGNATURE_SUPPORT - Success
-- Performing Test HAS_STL_NO_EXCEPT_TYPE_SIGNATURE_SUPPORT
-- Performing Test HAS_STL_NO_EXCEPT_TYPE_SIGNATURE_SUPPORT - Success
-- Performing Test HAS_CXX_CONSTEXPR
-- Performing Test HAS_CXX_CONSTEXPR - Success
-- Performing Test HAS_PARTIAL_SPECIALIZATION_FOR_ARRAYS
-- Performing Test HAS_PARTIAL_SPECIALIZATION_FOR_ARRAYS - Success
-- using C++: 17
I passed "-sd=c++11"
as CMAKE_CXX_FLAGS
but that led to the compiler being usable right in the CMake phase. How can I resolve the above error?
same as me . wait response
I manage to build rttr in Ubuntu 22.04 only after modifying two of the header files: In file I changed the following:
...
# else // CATCH_CONFIG_POSIX_SIGNALS is defined
#include <signal.h>
#undef SIGSTKSZ
#define SIGSTKSZ 32768
namespace Catch {
...
and in file
...
if (count) {
GenericValue* e = static_cast<GenericValue*>(allocator.Malloc(count * sizeof(GenericValue)));
SetElementsPointer(e);
//std::memcpy(e, values, count * sizeof(GenericValue));
e = values;
}
...
if (count) {
Member* m = static_cast<Member*>(allocator.Malloc(count * sizeof(Member)));
SetMembersPointer(m);
//std::memcpy(m, members, count * sizeof(Member));
m = members;
}
...