Coder Social home page Coder Social logo

realm-cpp's People

Contributors

cbush avatar dacharyc avatar fealebenpae avatar jsflax avatar kneth avatar leemaguire avatar nirinchev avatar otso avatar samdal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

realm-cpp's Issues

Windows build error `'realm::property': no matching overloaded function found`

This schema seems to cause a build issue on Windows.

Compiler used is Visual Studio 17 2022

this is with 0.4.0.

struct TonalDBKey
{
    // This is because we can't have a vector of optional types in Realm.
    std::optional<int64_t>     degree = std::nullopt;
    std::optional<int64_t>     period = std::nullopt;
    std::optional<std::string> name;
};
REALM_EMBEDDED_SCHEMA (TonalDBKey, degree, period, name)

struct TonalDBMapping
{
    bool                     customKeyMap = false;
    std::string              noteLayout = std::string (magic_enum::enum_name (tonaldb::NoteLayout::chromatic));
    int64_t                  referenceNote = 69;
    double                   referenceFrequency = 440.0;
    int64_t                  rootNote = 60;
    std::vector<TonalDBKey*> keyMap = {};
};
REALM_EMBEDDED_SCHEMA (TonalDBMapping, customKeyMap, noteLayout, referenceNote, referenceFrequency, rootNote, keyMap)

That last line starting with REALM_EMBEDDED_SCHEMA is line 38.

C:\Gitlab-Runner\builds\s-QzEZ_-a\1\entonal-studio\entonal-studio\Source\Database\TonalDB.cpp(38,1): error C2672: 'realm::property': no matching overloaded function found [C:\Gitlab-Runner\builds\s-QzEZ_-a\1\entonal-studio\entonal-studio\entonal-studio-cbd4218a\Source\Database\TonalDB.vcxproj]
C:\Gitlab-Runner\CPM\Cache\cpprealm\82861d8f148f882c91383ed93f0449af70b35891\src\cpprealm/schema.hpp(368,27): message : could be 'auto realm::property(const char *)' [C:\Gitlab-Runner\builds\s-QzEZ_-a\1\entonal-studio\entonal-studio\entonal-studio-cbd4218a\Source\Database\TonalDB.vcxproj]
C:\Gitlab-Runner\builds\s-QzEZ_-a\1\entonal-studio\entonal-studio\Source\Database\TonalDB.cpp(38,1): message : 'realm::property': too many template arguments [C:\Gitlab-Runner\builds\s-QzEZ_-a\1\entonal-studio\entonal-studio\entonal-studio-cbd4218a\Source\Database\TonalDB.vcxproj]
C:\Gitlab-Runner\builds\s-QzEZ_-a\1\entonal-studio\entonal-studio\Source\Database\TonalDB.cpp(38,1): error C3615: constexpr function 'realm::schema' cannot result in a constant expression [C:\Gitlab-Runner\builds\s-QzEZ_-a\1\entonal-studio\entonal-studio\entonal-studio-cbd4218a\Source\Database\TonalDB.vcxproj]
C:\Gitlab-Runner\CPM\Cache\cpprealm\82861d8f148f882c91383ed93f0449af70b35891\src\cpprealm/schema.hpp(395,43): message : failure was caused by an uninitialized variable declaration [C:\Gitlab-Runner\builds\s-QzEZ_-a\1\entonal-studio\entonal-studio\entonal-studio-cbd4218a\Source\Database\TonalDB.vcxproj]
  INTERNAL COMPILER ERROR in 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\bin\HostX64\x64\CL.exe'
      Please choose the Technical Support command on the Visual C++
      Help menu, or open the Technical Support help file for more information

Possible bug: `_id.value.to_string()` value one character off actual saved id

I am storing the id of a saved object in another struct, using the to_string function.

However, I can't find the saved object by ID after saving.

It seems that the stored ID always has its last char incremented compared to the one returned by object_id::to_string(). For example:

to_string: 655d458fecd6b76d1ce273c4
actual id: 655d458fecd6b76d1ce273c5

Compile errors with v0.5.0-preview on Windows

After updating to 0.5.0 from 0.4.0 I get the following compilation errors:

cpprealm/experimental/managed_list.hpp(139): error C2143: syntax error: missing ';' before '<'
cpprealm/experimental/managed_list.hpp(143): note: see reference to class template instantiation 'realm::experimental::managed<std::vector<_Ty,std::allocator<_Ty>>,enable_if<is_primitive<T>::value,void>::type>' being compiled
cpprealm/experimental/managed_list.hpp(139): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
cpprealm/experimental/managed_list.hpp(139): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
cpprealm/experimental/managed_list.hpp(316): error C2143: syntax error: missing ';' before '<'
cpprealm/experimental/managed_list.hpp(343): note: see reference to class template instantiation 'realm::experimental::managed<std::vector<T*,std::allocator<T*>>,void>' being compiled
cpprealm/experimental/managed_list.hpp(316): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
cpprealm/experimental/managed_list.hpp(316): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
cpprealm/experimental/managed_list.hpp(323): error C2143: syntax error: missing ';' before '<'
cpprealm/experimental/managed_list.hpp(323): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
cpprealm/experimental/managed_list.hpp(323): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
cpprealm/experimental/managed_list.hpp(332): error C2143: syntax error: missing ';' before '<'
cpprealm/experimental/managed_list.hpp(332): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
cpprealm/experimental/managed_list.hpp(332): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
cpprealm/experimental/managed_list.hpp(338): error C2143: syntax error: missing ';' before '<'
cpprealm/experimental/managed_list.hpp(338): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
cpprealm/experimental/managed_list.hpp(338): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
[464/468] Building CXX object _deps\cpprealm-build\src\CMakeFiles\cpprealm.dir\cpprealm\internal\network\network_transport.cpp.obj

token index not respecting current results set

I'm using a notification token to get updates about changes.

I have a couple of different views into the same collection ("public" and "user").

I expected that the index returned by the deletions/insertions/modifications vectors in changes would report based on the results set. What I'm seeing is based on the entire collection.

For example if I modify the last created item, I get the index of the last item of the entire collection, not of the current results set.

If this is tricky - would it be possible to get the ID of deleted or modified items?

How can I store a persistent `notification_token`?

It seems that notification_token is designed to not be copied or assigned.

Wrapping with a unique_ptr did not solve it.

How can I store a persistent token in a class, to keep track of changes?

Or do I need to create it in the initialiser?

Design: Reflection / Object Mapping

There are a couple of considerations that need to be taken into account, some of which apply to other bindings as well, and some of which are unique to the C++ binding.

The problem we need to solve is this: How do we give users type-safe and convenient access to objects stored in Realm?

To answer that question, there are several subproblems that need to be answered:

  • Object metaphor (do we let users think in terms of Realm objects like in the other bindings, or do we need a different abstraction, such as "rows"?).
  • Reflection (mapping type-safe structures to dynamically typed Realm rows, suggestions below).
  • How intrusive is Realm to the model, assuming an object-oriented approach? (single base class? modifications required in the class definition?)
  • Do we support multiple inheritance?
  • Memory management of objects in Realm.
  • How do we intercept get/set for zero-copy semantics? (suggestions below)

These decisions should be informed by the imagined use cases for Realm C++, which are slightly more diverse given the nature of the apps in which people choose to make use of C++. Realm C++ might have to coexist with existing, diverging implementations of things like reflection (for example, game engines generally have this in some form), and users of Realm C++ are very likely to already have strong opinions about how their memory should be managed.

In the following, I am mostly concerned with the user experience that we provide, and not so much about what our internal reflection APIs would look like. For the relevant scenarios, presume an API that looks similar to C++'s own type_info set of functions, but with added information about struct fields.

Reflection Proposal 1: Macro-based structs

An nearly-sufficient implementation of this already exists in Core in src/realm/table_macros.hpp.

Pros:

  • Already written (although it is in a very neglected state, and is missing many features, including links).
  • Not many moving parts.
  • Easily achieves zero-copy semantics.

However, this approach has several severe drawbacks:

  • Table/row metaphor (rather than "object" oriented).
  • Macros are out of fashion, and for a reason.
  • No high-level features (such as what's provided by Object Store).

Example:

REALM_TABLE_4(MyTable,
    my_integer, int,
    my_string, std::string,
    my_link, Link<MyOtherTable>,
    ...
);

Reflection Proposal 2: Qt-like Meta Object Compiler

This would go in a different direction, where users would be able to define their classes like normally, and then add a minimal amount of annotation. We would then ship a tool that parses the header files defining these objects and outputs some C++ code providing the guts of the reflection machinery.

A base class realm::Object containing the row accessor is presumed.

Pros:

  • Well-understood solution to the problem.
  • Very low friction (can seem "magical").
  • Very flexible (large amount of customization possible, such as renaming fields and annotating things).

Cons:

  • Huge maintenance cost for us.
  • Huge maintenance cost for our users (needs build system integration, and everybody has weird build systems, not to mention different compilers and platforms).
  • Requires special work for zero-copy semantics.

Example:

class MyObject: realm::Object {
public:
    int m_integer REALM_PROPERTY("my_integer" REALM_PRIMARY_KEY);
    std::string my_string REALM_PROPERTY(REALM_DEFAULT_VALUE("foo"));
    realm::Link<MyOtherObject> m_link REALM_PROPERTY();
};

Reflection Proposal 3: Pure Template Based

It is possible to achieve something fairly elegant using only standard C++ primitives (no macros), but it does require a small amount of boilerplate. The upside is that it makes it easy to map existing classes and objects to Realm.

Pros:

  • Easy to reason about.
  • Flexible and extensible.

Cons:

  • Requires special work for zero-copy semantics.
  • Slightly more boilerplate.

Example:

class MyObject: realm::Object {
    int m_integer;
    std::string m_string;
    realm::Link<MyOtherObject> m_link;

    static void reflect(realm::Reflector<MyObject>& r)
    {
        r.property(&MyObject::m_integer, "my_integer").primary_key();
        r.property(&MyObject::m_string, "my_string").default_value("foo");
        r.property(&MyObject::m_link, "my_link");
    } 
};

Proposal: Achieving Zero-Copy Semantics

In general, the problem is that we can't reliably intercept get/set operations on fields in an unobtrusive way, since C++ has no such thing as "properties" in other languages. We could introduce a special Property<T> type that can be used to solve this.

The class Property<T> would be defined as such:

template<class T>
struct Property {
    size_t offset_in_object;

    operator T() const;
    Property<T>& operator=(T&&);
};

When getting and setting the value of the property, we would use the offset_in_object to find the beginning of the encapsulating object ((realm::Object*)((char*)this - offset_in_object)), which would allow us to find both the (dynamic) type of the encapsulating object as well as which property is being accessed, so that we can issue the appropriate function calls into Core.

The realm::Link property implicitly already has the same functionality, so doesn't need to be wrapped in realm::Property.

(This technique would also work in the MOC proposal.)

Pros:

  • Safe. Even methods on the object itself can modify their state through the this pointer without any manual step to put the data into Realm.

Cons:

  • Intrusive.
  • Initialization of the Property members needs to be thought through -- it may be the case that a bit of trickery is necessary to support the expected behavior in user-defined constructors.

Example:

class MyObject: realm::Object {
    realm::Property<int> m_integer;
    realm::Property<std::string> m_string;
    realm::Link<MyOtherObject> m_link;

    static void reflect(realm::Reflector<MyObject>& r)
    {
        r.property(&MyObject::m_integer, "my_integer").primary_key();
        r.property(&MyObject::m_string, "my_string").default_value("foo");
        r.property(&MyObject::m_link, "my_link");
    } 
};

Proposal: Multiple Inheritance

I propose that we do not support it. :-)

Installation and usage guide for Windows

Hello!

Just wanted to ask if there's an existing installation guide for Windows. I'm currently trying to integrate this SDK to a C++ desktop app. I installed cmake, cloned the realm-cpp and realm-core repo, and tried to follow the commands for Mac / Linux because there's no guide for Windows:

git submodule update --init --recursive
mkdir build.debug
cd build.debug
cmake -D CMAKE_BUILD_TYPE=debug ..
sudo cmake --build . --target install 

I encountered some errors along the way which I was able to resolve. However, there are a few that I'm not sure how to fix. They occur during the command

cmake -D CMAKE_BUILD_TYPE=debug ..

I get the following:

-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19043.
-- The C compiler identification is MSVC 19.29.30140.0
-- The CXX compiler identification is MSVC 19.29.30140.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Dependencies: PACKAGE_NAME=realm-core;VERSION=11.10.0;OPENSSL_VERSION=1.1.1g;MDBREALM_TEST_SERVER_TAG=2022-01-29
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.33.0.windows.2")
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Could NOT find BISON (missing: BISON_EXECUTABLE) (Required is exact version "3.8.2")
-- Could NOT find FLEX (missing: FLEX_EXECUTABLE) (Required is exact version "2.6.4")
CMake Error at C:/Program Files/CMake/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
  system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY
  OPENSSL_INCLUDE_DIR) (found version "1.1.1g")
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  C:/Program Files/CMake/share/cmake-3.22/Modules/FindOpenSSL.cmake:574 (find_package_handle_standard_args)
  realm-core/CMakeLists.txt:256 (find_package)

-- Configuring incomplete, errors occurred!

Building Target > Install : Fails

Hi,

It's been quite a journey for me to research and integrate realm-cpp into my existing application. I tried to identify "INCLUDES" and "LIBARIES" to add into my existing CMakeLists.txt. So expected that the "Install" target to help me (because my direct integration effort with my existing CMakeLists.txt FAILED)

Here is my observation: I am able to successfully run "myApp" target (refer my Make file below) without any issues (Thanks to @leemaguire he who helped earlier), but running "install" fails. Please see my error messages pasted below.

CMakeLists.txt

cmake_minimum_required(VERSION 3.23)

project(MyRealmCppProject)

# Minimum C++ standard
set(CMAKE_CXX_STANDARD 17)

# In a Windows install, set these compiler flags:
if(MSVC)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:preprocessor /bigobj")
endif()

Include(FetchContent)

# Declare the version of the Realm C++ SDK you want to download
FetchContent_Declare(
  cpprealm
  GIT_REPOSITORY https://github.com/realm/realm-cpp.git
  GIT_TAG        v0.6.1-preview
)

FetchContent_MakeAvailable(cpprealm)

# Create an executable target called myApp with the source file main.cpp
add_executable(myApp main_static.cpp)

 
if(MSVC)
    set_property(TARGET myApp PROPERTY
        MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()


target_link_libraries(myApp PUBLIC cpprealm)

Error Message
You get this error when you run "install" as your target.

[build] C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(159,5): **error MSB3073: The command "setlocal** [C:\CPP_WS\realm-cpp\build\install.vcxproj]

[build] C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(159,5): error MSB3073: "C:\Program Files\CMake\bin\cmake.exe" -DBUILD_TYPE=Debug -P cmake_install.cmake [C:\CPP_WS\realm-cpp\build\install.vcxproj]

[build] C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(159,5): **error MSB3073**: if %errorlevel% neq 0 goto :cmEnd [C:\CPP_WS\realm-cpp\build\install.vcxproj]

[build] C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(159,5): **error MSB3073**: :cmEnd [C:\CPP_WS\realm-cpp\build\install.vcxproj]

[build] C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(159,5): **error MSB3073**: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone [C:\CPP_WS\realm-cpp\build\install.vcxproj]

[build] C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(159,5): **error MSB3073**: :cmErrorLevel [C:\CPP_WS\realm-cpp\build\install.vcxproj]

[build] C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(159,5): error MSB3073: exit /b %1 [C:\CPP_WS\realm-cpp\build\install.vcxproj]

[build] C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(159,5): error MSB3073: :cmDone [C:\CPP_WS\realm-cpp\build\install.vcxproj]

[build] C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(159,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd [C:\CPP_WS\realm-cpp\build\install.vcxproj]

[build] C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(159,5): error MSB3073: :VCEnd" exited with code 1. [C:\CPP_WS\realm-cpp\build\install.vcxproj]

[proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/THARMA/CPP_WS/realm-cpp/build --config Debug --target install -j 10 -- exited with code: 1
[driver] Build completed: 00:00:10.901
[build] Build finished with exit code 1

Please help me to identify what I am missing. Thanks in advance.

BUILD FAILED Debian 11

Hi.

Can someone help me on this error please?

[ 56%] Building CXX object realm-core/src/realm/object-store/c_api/CMakeFiles/RealmFFIStatic.dir/sync.cpp.o
[ 56%] Building CXX object realm-core/src/realm/object-store/c_api/CMakeFiles/RealmFFIStatic.dir/socket_provider.cpp.o
[ 57%] Linking CXX static library librealm-ffi-static-dbg.a
[ 57%] Built target RealmFFIStatic
Scanning dependencies of target cpprealm
[ 57%] Building CXX object src/CMakeFiles/cpprealm.dir/cpprealm/app.cpp.o
/home/fxprime/dev/realm-cpp/src/cpprealm/app.cpp:38:81: error: invalid use of incomplete type 'struct realm::internal::bridge::SizeCheck<78, 88>'
   38 | tic_assert(internal::bridge::SizeCheck<78, sizeof(realm::app::AppError)>{});
      |                                                                          ^

In file included from /home/fxprime/dev/realm-cpp/src/cpprealm/internal/bridge/uuid.hpp:5,
                 from /home/fxprime/dev/realm-cpp/src/cpprealm/internal/type_info.hpp:5,
                 from /home/fxprime/dev/realm-cpp/src/cpprealm/persisted.hpp:22,
                 from /home/fxprime/dev/realm-cpp/src/cpprealm/notifications.hpp:22,
                 from /home/fxprime/dev/realm-cpp/src/cpprealm/object.hpp:22,
                 from /home/fxprime/dev/realm-cpp/src/cpprealm/asymmetric_object.hpp:22,
                 from /home/fxprime/dev/realm-cpp/src/cpprealm/db.hpp:25,
                 from /home/fxprime/dev/realm-cpp/src/cpprealm/app.hpp:23,
                 from /home/fxprime/dev/realm-cpp/src/cpprealm/app.cpp:1:
/home/fxprime/dev/realm-cpp/src/cpprealm/internal/bridge/utils.hpp:12:12: note: declaration of 'struct realm::internal::bridge::SizeCheck<78, 88>'
   12 |     struct SizeCheck;
      |            ^~~~~~~~~
gmake[2]: *** [src/CMakeFiles/cpprealm.dir/build.make:82: src/CMakeFiles/cpprealm.dir/cpprealm/app.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:637: src/CMakeFiles/cpprealm.dir/all] Error 2
gmake: *** [Makefile:149: all] Error 2

Involve libs version:
cmake version 3.18.4
gcc version 10.2.1 20210110 (Debian 10.2.1-6)

Building with:
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye

Thank you advanced

Why the requirement for macOS 12 or later?

I'm concerned that requiring macOS 12 will exclude a sizeable chunk of my customers.

Some data from another vendor in our industry (audio plugins):

macOS 10.x = 31%
macOS 11   = 8%
macOS 12   = 23%
macOS 13   = 25%
macOS 14   = 10%

Assuming this data also represents my customers, I'd potentially be excluding 39% of them by forcing this requirement. A lot of music producers will stay on older macOS versions for various reasons.

Can you please explain why this requirement is necessary, and if there is a way to reduce it, ideally back to Catalina or Mojave?

Thank you

Issue with REALM_SCHEMA usage

I am observing an issue with REALM_SCHEMA usage in Coffee project , details below

SDK: V0.2.0 preview for SDK c++
Ubuntu 20.04
Qt Creator 4.11.1

ISSUE: realm_models.hpp:17:5: error: reference to local variable 'ptr' declared in enclosing lambda expression
macros.hpp:273:5: note: expanded from macro 'REALM_SCHEMA'
macros.hpp:303:26: note: expanded from macro 'DECLARE_REALM_SCHEMA'
realm_models.hpp:17:5: note: 'ptr' declared here
macros.hpp:273:5: note: expanded from macro 'REALM_SCHEMA'
macros.hpp:301:39: note: expanded from macro 'DECLARE_REALM_SCHEMA'

type alias redefinition for Realm_Config

SDK: 0.4.0-preview
macOS 13.4

I'm getting the following build error when integrating Realm into an existing C++ CMake project:

cmake-build-debug/_deps/cpprealm-build/src/cpprealm/internal/bridge/bridge_types.hpp:46:8: error: type alias redefinition with different types ('std::aligned_storage<312, 8>::type' vs 'std::aligned_storage<368, 16>::type')
;using Realm_Config = std::aligned_storage<312, 8>::type;
       ^
cmake-build-debug/_deps/cpprealm-build/src/cpprealm/internal/bridge/bridge_types.hpp:9:8: note: previous definition is here
;using Realm_Config = std::aligned_storage<368, 16>::type;

json exception in 0.6.1

Version: 0.6.1-preview

When adding an item to a fresh realm on Windows, hitting the following exception:

[json.exception.parse_error.101] parse error at line 1, column 13: syntax error while parsing object separator - unexpected ','; expected ':'

Adding records in a nested "struct" format facing challeneges

Hi,

I am looking to load data into Realm with a kind of nested relationship, as depicted by this:
[ChildParents] contains vector of [ParentNodes] cotains vector of PropertyValues.

namespace realm::experimental {

  struct ChildParents {
          realm::experimental::primary_key<realm::object_id> _id;
          int64_t child; 
          std::vector<ParentNodes*> parents;
      };
      REALM_SCHEMA(ChildParents, _id, child, parents)
	  
	  
  struct ParentNodes {
          realm::experimental::primary_key<realm::object_id> _id;
          int64_t name;
          std::vector<PropertyValue*> propValue;
      };
      REALM_SCHEMA(ParentNodes, _id, name, propValue)
	  
	  
  
  struct PropertyValue {
          realm::experimental::primary_key<realm::object_id> _id;
          std::string pName;
          std::double_t pValue;
      };
      REALM_SCHEMA(PropertyValue, _id, pName, pValue)
 
 
};

Since the vectors take explicit pointers to the child documents, it is quite challenging for me to manage the scope of the pointers esp., when we need to transform JSON kind of structure (with varying number of ParentNodes and PropertyValue) and formulate "ChildParents" before "writing" into Realm. The dynamically added pointers into the vector lose the scope. Leveraging smart_ptr is again out of scope as REALM_SCHEMA macro does not support that.

Possible workaround: Loading the data using a piece-meal approach... for example load first "PropertyValue", then "ParentNodes", and then "ChildParents". I did not try this, but it should work though. But I do not prefer the workaround as it, as said, a piece-meal approach that forces us to break our data into pieces.

So I am wondering if there is a better approach? Thanks, in advance.

Here is a sample JSON that gets converted to REALM structures for loading into database:

{
	"child": 10202,
	"ParentNodes": [ 
		{
			"name": "X",
			"propValue": [       <--------------  can contain any number of elements
				{
					"name": "p1",
					"value": 0.9
				},
				{
					"name": "p2",
					"value": 0.9
				}
			]
		},
		{
			"name": "Y",
			"propValue": [
				{
					"name": "q1",
					"value": 0.9
				},
				{
					"name": "q2",
					"value": 0.9
				},
				{
					"name": "q2",
					"value": 0.9
				}
			]
		}
	]
}

Thanks,
Tharma

Dependency Management to Embed Realm into my existing C++ App

I ran into issues in several stages and finally could do the following successfully:

  • Run "install" target
  • Use the lib and include it in an external app (CMakeLists.txt)

Here I am sharing a little "bug" in the code and the post-process (of install for integration) so that someone might benefit from my experience.

Bug:
realm-cpp/iinstall/include/cpprealm/sdk.hpp: This header at line 46 has an issue. It should not have the below line as the corresponding file (results.hpp) is not part of the current (sdk) module; it is rather part of "experimental." So need to remove that line.

#include <cpprealm/results.hpp>

Enhancement on Install target:
This target could copy necessary Windows Platform SDKs libs (e.g., iphlpapi.lib, UserEnv.Lib) into the "install" lib folder. I am not sure if that is a good practice (maybe not), but I faced a little challenge figuring that out, and someone else might face it as well. Also, it has a dependency on "zlib.lib" as well. Maybe that can also be taken care of by the "install" target.
However, the "include" (of install target) is just perfect.

Anyway, in spite of those little glitches, no doubt, it is an impressive piece of work, and it works. Thank you, team, for the great work! I am really thankful for that.

I trust this brief overview might assist someone encountering similar challenges.

Thanks,
Tharma

Crash when calling `flexible_sync_configuration()` from an audio plugin

I am testing using Realm sync from within an audio plugin, using the JUCE library.

The standalone build works without issues, but the VST3 plugin fails when calling flexible_sync_configuration().

Below is the stack trace. I'm on macOS.

__pthread_kill 0x00000001a0048724
pthread_kill 0x00000001a007fc28
abort 0x000000019ff8dae8
please_report_this_issue_in_github_realm_realm_core_v_13_23_1() terminate.cpp:65
realm::util::terminate_internal(std::basic_stringstream<โ€ฆ> &) terminate.cpp:143
realm::util::terminate_with_info(const char *, const char *, long, const char *, std::initializer_list<โ€ฆ> &&) terminate.cpp:162
realm::util::terminate(const char *, const char *, long, std::initializer_list<โ€ฆ> &&) terminate.cpp:149
realm::SyncManager::path_for_realm(const realm::SyncConfig &, std::optional<โ€ฆ>) const sync_manager.cpp:559
realm::internal::bridge::sync_manager::path_for_realm(const realm::internal::bridge::realm::sync_config &) const sync_manager.cpp:7
realm::user::flexible_sync_configuration() const app.hpp:144
AudioPluginAudioProcessorEditor::AudioPluginAudioProcessorEditor(AudioPluginAudioProcessor &) PluginEditor.cpp:13
AudioPluginAudioProcessorEditor::AudioPluginAudioProcessorEditor(AudioPluginAudioProcessor &) PluginEditor.cpp:7
AudioPluginAudioProcessor::createEditor() PluginProcessor.cpp:164
juce::AudioProcessor::createEditorIfNeeded() juce_AudioProcessor.cpp:893
juce::JuceVST3EditController::JuceVST3Editor::ContentWrapperComponent::createEditor(juce::AudioProcessor &) juce_audio_plugin_client_VST3.cpp:2092
juce::JuceVST3EditController::JuceVST3Editor::createContentWrapperComponentIfNeeded() juce_audio_plugin_client_VST3.cpp:2272
juce::JuceVST3EditController::JuceVST3Editor::JuceVST3Editor(juce::JuceVST3EditController &, juce::JuceAudioProcessor &) juce_audio_plugin_client_VST3.cpp:1743
juce::JuceVST3EditController::JuceVST3Editor::JuceVST3Editor(juce::JuceVST3EditController &, juce::JuceAudioProcessor &) juce_audio_plugin_client_VST3.cpp:1742
juce::JuceVST3EditController::createView(const char *) juce_audio_plugin_client_VST3.cpp:1267
<unknown> 0x0000000106b10d64
<unknown> 0x0000000106b0b6ec
<unknown> 0x0000000106b0b570
<unknown> 0x0000000106b1ac14
<unknown> 0x0000000106ab1348
<unknown> 0x0000000106a97b98
<unknown> 0x0000000106a97c34
<unknown> 0x000000010552ecac
<unknown> 0x00000001055285ac
<unknown> 0x0000000106a97a58
<unknown> 0x0000000106aaa340
<unknown> 0x000000010568d548
<unknown> 0x000000010568be90
<unknown> 0x0000000105412654
<unknown> 0x00000001054121d0
<unknown> 0x0000000105620c9c
__NSFireTimer 0x00000001a110e448
__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ 0x00000001a01783c8
__CFRunLoopDoTimer 0x00000001a0178070
__CFRunLoopDoTimers 0x00000001a0177bc8
__CFRunLoopRun 0x00000001a015d348
CFRunLoopRunSpecific 0x00000001a015c4b8
RunCurrentEventLoopInMode 0x00000001a99a6c40
ReceiveNextEventCommon 0x00000001a99a6a7c
_BlockUntilNextEventMatchingListInModeWithFilter 0x00000001a99a67d4
_DPSNextEvent 0x00000001a337dd44
-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] 0x00000001a337cee0
-[NSApplication run] 0x00000001a3371344
<unknown> 0x0000000105620068
start 0x000000019fd27f28

Exception (EXC_BAD_ACCESS) when accessing vector in nested type object

I have the following schema:

struct TonalDBMapping
{
    bool                      customKeyMap = false;
    tonaldb::NoteLayout       noteLayout = tonaldb::NoteLayout::all;
    std::optional<int64_t>    referenceNote = std::nullopt;
    std::optional<double>     referenceFrequency = std::nullopt;
    std::optional<int64_t>    rootNote = std::nullopt;
    std::vector<realm::mixed> keyMap = { std::monostate() };
};
REALM_EMBEDDED_SCHEMA (TonalDBMapping, customKeyMap, noteLayout, referenceNote, referenceFrequency, rootNote, keyMap)

struct TonalDBTuning
{
    primary_key<realm::object_id> _id { realm::object_id::generate() };
    std::string                   title;
    std::string                   shortTitle;
    std::string                   description;
    std::string                   author;
    std::string                   period;
    std::vector<TonalDBPitch*>    pitches;
    TonalDBMapping*               mapping;
    // The ownerId property stores the user.identifier() of the logged-in user.
    std::string ownerId;
};
REALM_SCHEMA (TonalDBTuning, _id, title, shortTitle, description, author, period, pitches, mapping, ownerId)

When I call add:

       syncedRealm->write ([&]
                                   { syncedRealm->add (std::move (newTuning)); });
    }

I am hitting a EXC_BAD_ACCESS crash. It seems to be to do with the std::variant i.e. the realm::mixed type.

I'm on macOS Ventura, building with clang.

Screenshot 2023-11-20 at 21 23 02 Screenshot 2023-11-20 at 21 25 46

Here is the stack trace:

decltype(auto) std::__1::__variant_detail::__visitation::__base::__visit_alt_at[abi:v15006]<void std::__1::__variant_detail::__ctor<std::__1::__variant_detail::__traits<std::__1::monostate, long long, bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, double, std::__1::vector<unsigned char, std::__1::allocator<unsigned char>>, std::__1::chrono::time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000l>>>, realm::uuid, realm::object_id, realm::decimal128>>::__generic_construct[abi:v15006]<std::__1::__variant_detail::__copy_constructor<std::__1::__variant_detail::__traits<std::__1::monostate, long long, bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, double, std::__1::vector<unsigned char, std::__1::allocator<unsigned char>>, std::__1::chrono::time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000l>>>, realm::uuid, realm::object_id, realm::decimal128>, (std::__1::__variant_detail::_Trait)1> const&>(std::__1::__variant_detail::__ctor<std::__1::__variant_detail::__traits<std::__1::monostate, long long, bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, double, std::__1::vector<unsigned char, std::__1::allocator<unsigned char>>, std::__1::chrono::time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000l>>>, realm::uuid, realm::object_id, realm::decimal128>>&, std::__1::__variant_detail::__copy_constructor<std::__1::__variant_detail::__traits<std::__1::monostate, long long, bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, double, std::__1::vector<unsigned char, std::__1::allocator<unsigned char>>, std::__1::chrono::time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000l>>>, realm::uuid, realm::object_id, realm::decimal128>, (std::__1::__variant_detail::_Trait)1> const&)::'lambda'(std::__1::__variant_detail::__copy_constructor<std::__1::__variant_detail::__traits<std::__1::monostate, long long, bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, double, std::__1::vector<unsigned char, std::__1::allocator<unsigned char>>, std::__1::chrono::time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000l>>>, realm::uuid, realm::object_id, realm::decimal128>, (std::__1::__variant_detail::_Trait)1> const&, auto&&), std::__1::__variant_detail::__ctor<std::__1::__variant_detail::__traits<std::__1::monostate, long long, bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, double, std::__1::vector<unsigned char, std::__1::allocator<unsigned char>>, std::__1::chrono::time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000l>>>, realm::uuid, realm::object_id, realm::decimal128>>&, std::__1::__variant_detail::__copy_constructor<std::__1::__variant_detail::__traits<std::__1::monostate, long long, bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, double, std::__1::vector<unsigned char, std::__1::allocator<unsigned char>>, std::__1::chrono::time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000l>>>, realm::uuid, realm::object_id, realm::decimal128>, (std::__1::__variant_detail::_Trait)1> const&>(unsigned long, std::__1::__variant_detail::__copy_constructor<std::__1::__variant_detail::__traits<std::__1::monostate, long long, bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, double, std::__1::vector<unsigned char, std::__1::allocator<unsigned char>>, std::__1::chrono::time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000l>>>, realm::uuid, realm::object_id, realm::decimal128>, (std::__1::__variant_detail::_Trait)1> const&, std::__1::__variant_detail::__ctor<std::__1::__variant_detail::__traits<std::__1::monostate, long long, bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, double, std::__1::vector<unsigned char, std::__1::allocator<unsigned char>>, std::__1::chrono::time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000l>>>, realm::uuid, realm::object_id, realm::decimal128>>&, std::__1::__variant_detail::__copy_constructor<std::__1::__variant_detail::__traits<std::__1::monostate, long long, bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, double, std::__1::vector<unsigned char, std::__1::allocator<unsigned char>>, std::__1::chrono::time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000l>>>, realm::uuid, realm::object_id, realm::decimal128>, (std::__1::__variant_detail::_Trait)1> const&) variant:500
std::__variant_detail::__ctor::__generic_construct[abi:v15006]<โ€ฆ>(std::__variant_detail::__ctor<โ€ฆ> &, const std::__variant_detail::__copy_constructor<โ€ฆ> &) variant:898
std::__variant_detail::__copy_constructor::__copy_constructor(const std::__variant_detail::__copy_constructor<โ€ฆ> &) variant:977
std::__variant_detail::__assignment::__assignment(const std::__variant_detail::__assignment<โ€ฆ> &) variant:991
std::__variant_detail::__move_assignment::__move_assignment(const std::__variant_detail::__move_assignment<โ€ฆ> &) variant:1076
std::__variant_detail::__copy_assignment::__copy_assignment(const std::__variant_detail::__copy_assignment<โ€ฆ> &) variant:1117
std::__variant_detail::__impl::__impl(const std::__variant_detail::__impl<โ€ฆ> &) variant:1137
std::__variant_detail::__impl::__impl(const std::__variant_detail::__impl<โ€ฆ> &) variant:1137
std::variant::variant(const std::variant<โ€ฆ> &) variant:1305
std::variant::variant(const std::variant<โ€ฆ> &) variant:1305
realm::internal::bridge::obj::set_list_values<โ€ฆ>(const realm::internal::bridge::col_key &, const std::vector<โ€ฆ> &) obj.hpp:196
realm::experimental::accessor::set(realm::internal::bridge::obj &, realm::internal::bridge::col_key &&, const realm::internal::bridge::realm &, const std::vector<โ€ฆ> &) accessors.hpp:266
auto realm::experimental::accessor<TonalDBMapping*, void>::set(realm::internal::bridge::obj&, realm::internal::bridge::col_key&&, realm::internal::bridge::realm const&, TonalDBMapping*)::'lambda'(auto&&...)::operator()<realm::schemagen::property<&TonalDBMapping::customKeyMap, false> const&, realm::schemagen::property<&TonalDBMapping::noteLayout, false> const&, realm::schemagen::property<&TonalDBMapping::referenceNote, false> const&, realm::schemagen::property<&TonalDBMapping::referenceFrequency, false> const&, realm::schemagen::property<&TonalDBMapping::rootNote, false> const&, realm::schemagen::property<&TonalDBMapping::keyMap, false> const&>(auto&&...) const accessors.hpp:430
decltype(std::declval<realm::experimental::accessor<TonalDBMapping*, void>::set(realm::internal::bridge::obj&, realm::internal::bridge::col_key&&, realm::internal::bridge::realm const&, TonalDBMapping*)::'lambda'(auto&&...)>()(std::declval<realm::schemagen::property<&TonalDBMapping::customKeyMap, false> const&>(), std::declval<realm::schemagen::property<&TonalDBMapping::noteLayout, false> const&>(), std::declval<realm::schemagen::property<&TonalDBMapping::referenceNote, false> const&>(), std::declval<realm::schemagen::property<&TonalDBMapping::referenceFrequency, false> const&>(), std::declval<realm::schemagen::property<&TonalDBMapping::rootNote, false> const&>(), std::declval<realm::schemagen::property<&TonalDBMapping::keyMap, false> const&>())) std::__1::__invoke[abi:v15006]<realm::experimental::accessor<TonalDBMapping*, void>::set(realm::internal::bridge::obj&, realm::internal::bridge::col_key&&, realm::internal::bridge::realm const&, TonalDBMapping*)::'lambda'(auto&&...), realm::schemagen::property<&TonalDBMapping::customKeyMap, false> const&, realm::schemagen::property<&TonalDBMapping::noteLayout, false> const&, realm::schemagen::property<&TonalDBMapping::referenceNote, false> const&, realm::schemagen::property<&TonalDBMapping::referenceFrequency, false> const&, realm::schemagen::property<&TonalDBMapping::rootNote, false> const&, realm::schemagen::property<&TonalDBMapping::keyMap, false> const&>(realm::experimental::accessor<TonalDBMapping*, void>::set(realm::internal::bridge::obj&, realm::internal::bridge::col_key&&, realm::internal::bridge::realm const&, TonalDBMapping*)::'lambda'(auto&&...)&&, realm::schemagen::property<&TonalDBMapping::customKeyMap, false> const&, realm::schemagen::property<&TonalDBMapping::noteLayout, false> const&, realm::schemagen::property<&TonalDBMapping::referenceNote, false> const&, realm::schemagen::property<&TonalDBMapping::referenceFrequency, false> const&, realm::schemagen::property<&TonalDBMapping::rootNote, false> const&, realm::schemagen::property<&TonalDBMapping::keyMap, false> const&) invoke.h:394
decltype(auto) std::__1::__apply_tuple_impl[abi:v15006]<realm::experimental::accessor<TonalDBMapping*, void>::set(realm::internal::bridge::obj&, realm::internal::bridge::col_key&&, realm::internal::bridge::realm const&, TonalDBMapping*)::'lambda'(auto&&...), std::__1::tuple<realm::schemagen::property<&TonalDBMapping::customKeyMap, false>, realm::schemagen::property<&TonalDBMapping::noteLayout, false>, realm::schemagen::property<&TonalDBMapping::referenceNote, false>, realm::schemagen::property<&TonalDBMapping::referenceFrequency, false>, realm::schemagen::property<&TonalDBMapping::rootNote, false>, realm::schemagen::property<&TonalDBMapping::keyMap, false>> const&, 0ul, 1ul, 2ul, 3ul, 4ul, 5ul>(realm::experimental::accessor<TonalDBMapping*, void>::set(realm::internal::bridge::obj&, realm::internal::bridge::col_key&&, realm::internal::bridge::realm const&, TonalDBMapping*)::'lambda'(auto&&...)&&, std::__1::tuple<realm::schemagen::property<&TonalDBMapping::customKeyMap, false>, realm::schemagen::property<&TonalDBMapping::noteLayout, false>, realm::schemagen::property<&TonalDBMapping::referenceNote, false>, realm::schemagen::property<&TonalDBMapping::referenceFrequency, false>, realm::schemagen::property<&TonalDBMapping::rootNote, false>, realm::schemagen::property<&TonalDBMapping::keyMap, false>> const&, std::__1::__tuple_indices<0ul, 1ul, 2ul, 3ul, 4ul, 5ul>) tuple:1789
decltype(auto) std::__1::apply[abi:v15006]<realm::experimental::accessor<TonalDBMapping*, void>::set(realm::internal::bridge::obj&, realm::internal::bridge::col_key&&, realm::internal::bridge::realm const&, TonalDBMapping*)::'lambda'(auto&&...), std::__1::tuple<realm::schemagen::property<&TonalDBMapping::customKeyMap, false>, realm::schemagen::property<&TonalDBMapping::noteLayout, false>, realm::schemagen::property<&TonalDBMapping::referenceNote, false>, realm::schemagen::property<&TonalDBMapping::referenceFrequency, false>, realm::schemagen::property<&TonalDBMapping::rootNote, false>, realm::schemagen::property<&TonalDBMapping::keyMap, false>> const&>(realm::experimental::accessor<TonalDBMapping*, void>::set(realm::internal::bridge::obj&, realm::internal::bridge::col_key&&, realm::internal::bridge::realm const&, TonalDBMapping*)::'lambda'(auto&&...)&&, std::__1::tuple<realm::schemagen::property<&TonalDBMapping::customKeyMap, false>, realm::schemagen::property<&TonalDBMapping::noteLayout, false>, realm::schemagen::property<&TonalDBMapping::referenceNote, false>, realm::schemagen::property<&TonalDBMapping::referenceFrequency, false>, realm::schemagen::property<&TonalDBMapping::rootNote, false>, realm::schemagen::property<&TonalDBMapping::keyMap, false>> const&) tuple:1798
realm::experimental::accessor::set(realm::internal::bridge::obj &, realm::internal::bridge::col_key &&, const realm::internal::bridge::realm &, TonalDBMapping *) accessors.hpp:429
auto realm::experimental::managed<std::__1::remove_const<TonalDBTuning>::type, void> realm::experimental::db::add<TonalDBTuning>(TonalDBTuning&&)::'lambda'(auto&&...)::operator()<realm::schemagen::property<&TonalDBTuning::_id, false> const&, realm::schemagen::property<&TonalDBTuning::title, false> const&, realm::schemagen::property<&TonalDBTuning::shortTitle, false> const&, realm::schemagen::property<&TonalDBTuning::description, false> const&, realm::schemagen::property<&TonalDBTuning::author, false> const&, realm::schemagen::property<&TonalDBTuning::period, false> const&, realm::schemagen::property<&TonalDBTuning::pitches, false> const&, realm::schemagen::property<&TonalDBTuning::mapping, false> const&, realm::schemagen::property<&TonalDBTuning::ownerId, false> const&>(auto&&...) const db.hpp:84
decltype(std::declval<TonalDBTuning>()(std::declval<realm::schemagen::property<&TonalDBTuning::_id, false> const&>(), std::declval<realm::schemagen::property<&TonalDBTuning::title, false> const&>(), std::declval<realm::schemagen::property<&TonalDBTuning::shortTitle, false> const&>(), std::declval<realm::schemagen::property<&TonalDBTuning::description, false> const&>(), std::declval<realm::schemagen::property<&TonalDBTuning::author, false> const&>(), std::declval<realm::schemagen::property<&TonalDBTuning::period, false> const&>(), std::declval<realm::schemagen::property<&TonalDBTuning::pitches, false> const&>(), std::declval<realm::schemagen::property<&TonalDBTuning::mapping, false> const&>(), std::declval<realm::schemagen::property<&TonalDBTuning::ownerId, false> const&>())) std::__1::__invoke[abi:v15006]<realm::experimental::managed<std::__1::remove_const<TonalDBTuning>::type, void> realm::experimental::db::add<TonalDBTuning>(TonalDBTuning&&)::'lambda'(auto&&...), realm::schemagen::property<&TonalDBTuning::_id, false> const&, realm::schemagen::property<&TonalDBTuning::title, false> const&, realm::schemagen::property<&TonalDBTuning::shortTitle, false> const&, realm::schemagen::property<&TonalDBTuning::description, false> const&, realm::schemagen::property<&TonalDBTuning::author, false> const&, realm::schemagen::property<&TonalDBTuning::period, false> const&, realm::schemagen::property<&TonalDBTuning::pitches, false> const&, realm::schemagen::property<&TonalDBTuning::mapping, false> const&, realm::schemagen::property<&TonalDBTuning::ownerId, false> const&>(TonalDBTuning&&, realm::schemagen::property<&TonalDBTuning::_id, false> const&, realm::schemagen::property<&TonalDBTuning::title, false> const&, realm::schemagen::property<&TonalDBTuning::shortTitle, false> const&, realm::schemagen::property<&TonalDBTuning::description, false> const&, realm::schemagen::property<&TonalDBTuning::author, false> const&, realm::schemagen::property<&TonalDBTuning::period, false> const&, realm::schemagen::property<&TonalDBTuning::pitches, false> const&, realm::schemagen::property<&TonalDBTuning::mapping, false> const&, realm::schemagen::property<&TonalDBTuning::ownerId, false> const&) invoke.h:394
decltype(auto) std::__1::__apply_tuple_impl[abi:v15006]<realm::experimental::managed<std::__1::remove_const<TonalDBTuning>::type, void> realm::experimental::db::add<TonalDBTuning>(TonalDBTuning&&)::'lambda'(auto&&...), std::__1::tuple<realm::schemagen::property<&TonalDBTuning::_id, false>, realm::schemagen::property<&TonalDBTuning::title, false>, realm::schemagen::property<&TonalDBTuning::shortTitle, false>, realm::schemagen::property<&TonalDBTuning::description, false>, realm::schemagen::property<&TonalDBTuning::author, false>, realm::schemagen::property<&TonalDBTuning::period, false>, realm::schemagen::property<&TonalDBTuning::pitches, false>, realm::schemagen::property<&TonalDBTuning::mapping, false>, realm::schemagen::property<&TonalDBTuning::ownerId, false>> const&, 0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul, 7ul, 8ul>(TonalDBTuning&&, std::__1::tuple<realm::schemagen::property<&TonalDBTuning::_id, false>, realm::schemagen::property<&TonalDBTuning::title, false>, realm::schemagen::property<&TonalDBTuning::shortTitle, false>, realm::schemagen::property<&TonalDBTuning::description, false>, realm::schemagen::property<&TonalDBTuning::author, false>, realm::schemagen::property<&TonalDBTuning::period, false>, realm::schemagen::property<&TonalDBTuning::pitches, false>, realm::schemagen::property<&TonalDBTuning::mapping, false>, realm::schemagen::property<&TonalDBTuning::ownerId, false>> const&, std::__1::__tuple_indices<0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul, 7ul, 8ul>) tuple:1789
decltype(auto) std::__1::apply[abi:v15006]<realm::experimental::managed<std::__1::remove_const<TonalDBTuning>::type, void> realm::experimental::db::add<TonalDBTuning>(TonalDBTuning&&)::'lambda'(auto&&...), std::__1::tuple<realm::schemagen::property<&TonalDBTuning::_id, false>, realm::schemagen::property<&TonalDBTuning::title, false>, realm::schemagen::property<&TonalDBTuning::shortTitle, false>, realm::schemagen::property<&TonalDBTuning::description, false>, realm::schemagen::property<&TonalDBTuning::author, false>, realm::schemagen::property<&TonalDBTuning::period, false>, realm::schemagen::property<&TonalDBTuning::pitches, false>, realm::schemagen::property<&TonalDBTuning::mapping, false>, realm::schemagen::property<&TonalDBTuning::ownerId, false>> const&>(TonalDBTuning&&, std::__1::tuple<realm::schemagen::property<&TonalDBTuning::_id, false>, realm::schemagen::property<&TonalDBTuning::title, false>, realm::schemagen::property<&TonalDBTuning::shortTitle, false>, realm::schemagen::property<&TonalDBTuning::description, false>, realm::schemagen::property<&TonalDBTuning::author, false>, realm::schemagen::property<&TonalDBTuning::period, false>, realm::schemagen::property<&TonalDBTuning::pitches, false>, realm::schemagen::property<&TonalDBTuning::mapping, false>, realm::schemagen::property<&TonalDBTuning::ownerId, false>> const&) tuple:1798
realm::experimental::db::add<โ€ฆ>(TonalDBTuning &&) db.hpp:83
<lambda>::operator()() const TonalDB.cpp:187
realm::experimental::db::write<โ€ฆ>(<lambda> &&) const db.hpp:66
...

Can't build application with cpprealm library

Hello,

Recently found cpp implementation for Realm and tried to build test program, but failed.
I have latest OpenSUSE Tumbleweed. Here is build Realm result:

sudo cmake --build . --target install
[  0%] Building C object realm-core/src/external/IntelRDFPMathLib20U2/CMakeFiles/Bid.dir/LIBRARY/src/bid128.c.o
[  0%] Building C object realm-core/src/external/IntelRDFPMathLib20U2/CMakeFiles/Bid.dir/LIBRARY/src/bid128_compare.c.o
[  0%] Building C object realm-core/src/external/IntelRDFPMathLib20U2/CMakeFiles/Bid.dir/LIBRARY/src/bid128_mul.c.o
[  1%] Building C object realm-core/src/external/IntelRDFPMathLib20U2/CMakeFiles/Bid.dir/LIBRARY/src/bid128_div.c.o
[  1%] Building C object realm-core/src/external/IntelRDFPMathLib20U2/CMakeFiles/Bid.dir/LIBRARY/src/bid128_add.c.o
[  1%] Building C object realm-core/src/external/IntelRDFPMathLib20U2/CMakeFiles/Bid.dir/LIBRARY/src/bid128_fma.c.o
[  2%] Building C object realm-core/src/external/IntelRDFPMathLib20U2/CMakeFiles/Bid.dir/LIBRARY/src/bid128_string.c.o
[  2%] Building C object realm-core/src/external/IntelRDFPMathLib20U2/CMakeFiles/Bid.dir/LIBRARY/src/bid128_2_str_tables.c.o
[  2%] Building C object realm-core/src/external/IntelRDFPMathLib20U2/CMakeFiles/Bid.dir/LIBRARY/src/bid64_to_bid128.c.o
[  2%] Building C object realm-core/src/external/IntelRDFPMathLib20U2/CMakeFiles/Bid.dir/LIBRARY/src/bid128_to_int64.c.o
[  3%] Building C object realm-core/src/external/IntelRDFPMathLib20U2/CMakeFiles/Bid.dir/LIBRARY/src/bid128_quantize.c.o
[  3%] Building C object realm-core/src/external/IntelRDFPMathLib20U2/CMakeFiles/Bid.dir/LIBRARY/src/bid_convert_data.c.o
[  3%] Building C object realm-core/src/external/IntelRDFPMathLib20U2/CMakeFiles/Bid.dir/LIBRARY/src/bid_decimal_data.c.o
[  4%] Building C object realm-core/src/external/IntelRDFPMathLib20U2/CMakeFiles/Bid.dir/LIBRARY/src/bid_decimal_globals.c.o
[  4%] Building C object realm-core/src/external/IntelRDFPMathLib20U2/CMakeFiles/Bid.dir/LIBRARY/src/bid_from_int.c.o
[  4%] Building C object realm-core/src/external/IntelRDFPMathLib20U2/CMakeFiles/Bid.dir/LIBRARY/src/bid_round.c.o
[  4%] Built target Bid
[  4%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/query.cpp.o
[  4%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/array.cpp.o
[  5%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/array_with_find.cpp.o
[  5%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/alloc.cpp.o
[  5%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/alloc_slab.cpp.o
[  6%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/array_backlink.cpp.o
[  6%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/array_binary.cpp.o
[  6%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/array_blob.cpp.o
[  6%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/array_blobs_small.cpp.o
[  7%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/array_blobs_big.cpp.o
[  7%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/array_decimal128.cpp.o
[  7%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/array_fixed_bytes.cpp.o
[  9%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/array_integer.cpp.o
[  9%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/array_key.cpp.o
[  9%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/array_mixed.cpp.o
[ 10%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/array_unsigned.cpp.o
[ 10%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/array_string.cpp.o
[ 10%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/array_string_short.cpp.o
[ 10%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/array_timestamp.cpp.o
[ 11%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/bplustree.cpp.o
[ 11%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/chunked_binary.cpp.o
[ 11%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/cluster.cpp.o
[ 12%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/collection.cpp.o
[ 12%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/cluster_tree.cpp.o
[ 12%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/error_codes.cpp.o
[ 12%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/table_cluster_tree.cpp.o
[ 13%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/column_binary.cpp.o
[ 13%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/decimal128.cpp.o
[ 13%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/dictionary.cpp.o
[ 14%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/disable_sync_to_disk.cpp.o
[ 14%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/exceptions.cpp.o
[ 14%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/group.cpp.o
[ 14%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/db.cpp.o
[ 15%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/group_writer.cpp.o
[ 15%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/history.cpp.o
[ 15%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/impl/copy_replication.cpp.o
[ 17%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/impl/output_stream.cpp.o
[ 17%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/impl/simulated_failure.cpp.o
[ 17%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/impl/transact_log.cpp.o
[ 18%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/index_string.cpp.o
[ 18%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/link_translator.cpp.o
[ 18%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/list.cpp.o
[ 18%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/node.cpp.o
[ 19%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/mixed.cpp.o
[ 19%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/obj.cpp.o
[ 19%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/object_converter.cpp.o
[ 20%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/global_key.cpp.o
[ 20%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/query_engine.cpp.o
[ 20%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/query_expression.cpp.o
[ 20%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/query_value.cpp.o
[ 21%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/replication.cpp.o
[ 21%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/set.cpp.o
[ 21%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/spec.cpp.o
[ 22%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/string_data.cpp.o
[ 22%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/table.cpp.o
[ 22%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/table_ref.cpp.o
[ 23%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/obj_list.cpp.o
[ 23%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/object_id.cpp.o
[ 23%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/table_view.cpp.o
[ 23%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/transaction.cpp.o
[ 25%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/sort_descriptor.cpp.o
[ 25%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/status.cpp.o
[ 25%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/unicode.cpp.o
[ 26%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/utilities.cpp.o
[ 26%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/uuid.cpp.o
[ 26%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/version.cpp.o
[ 26%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/backup_restore.cpp.o
[ 27%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/metrics/metrics.cpp.o
[ 27%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/metrics/metric_timer.cpp.o
[ 27%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/metrics/query_info.cpp.o
[ 28%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/metrics/transaction_info.cpp.o
[ 28%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/interprocess_mutex.cpp.o
[ 28%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/backtrace.cpp.o
[ 28%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/base64.cpp.o
[ 29%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/basic_system_errors.cpp.o
[ 29%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/cli_args.cpp.o
[ 29%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/compression.cpp.o
[ 30%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/encrypted_file_mapping.cpp.o
[ 30%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/fifo_helper.cpp.o
[ 30%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/file.cpp.o
[ 31%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/file_mapper.cpp.o
[ 31%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/interprocess_condvar.cpp.o
[ 31%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/logger.cpp.o
[ 31%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/memory_stream.cpp.o
[ 32%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/platform_info.cpp.o
[ 32%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/misc_errors.cpp.o
[ 32%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/serializer.cpp.o
[ 34%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/sha_crypto.cpp.o
[ 34%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/terminate.cpp.o
[ 34%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/time.cpp.o
[ 34%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/timestamp_formatter.cpp.o
[ 35%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/timestamp_logger.cpp.o
[ 35%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/thread.cpp.o
[ 35%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/to_string.cpp.o
[ 36%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/copy_dir_recursive.cpp.o
[ 36%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/demangle.cpp.o
[ 36%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/duplicating_logger.cpp.o
[ 36%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/enum.cpp.o
[ 37%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/file_is_regular.cpp.o
[ 37%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/http.cpp.o
[ 37%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/json_parser.cpp.o
[ 38%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/load_file.cpp.o
[ 38%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/misc_ext_errors.cpp.o
[ 38%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/parent_dir.cpp.o
[ 39%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/random.cpp.o
[ 39%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/resource_limits.cpp.o
[ 39%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/substitute.cpp.o
[ 39%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/util/uri.cpp.o
[ 40%] Linking CXX static library librealm-dbg.a
[ 40%] Built target Storage
[ 40%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/config.cpp.o
[ 40%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/noinst/changeset_index.cpp.o
[ 42%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/noinst/client_history_impl.cpp.o
[ 42%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/noinst/client_impl_base.cpp.o
[ 42%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/noinst/client_reset.cpp.o
[ 42%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/noinst/client_reset_operation.cpp.o
[ 43%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/noinst/client_reset_recovery.cpp.o
[ 43%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/noinst/compact_changesets.cpp.o
[ 43%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/noinst/pending_bootstrap_store.cpp.o
[ 44%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/noinst/protocol_codec.cpp.o
[ 44%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/noinst/sync_metadata_schema.cpp.o
[ 44%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/changeset_encoder.cpp.o
[ 45%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/changeset_parser.cpp.o
[ 45%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/changeset.cpp.o
[ 45%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/client.cpp.o
[ 45%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/history.cpp.o
[ 46%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/instruction_applier.cpp.o
[ 46%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/instruction_replication.cpp.o
[ 46%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/instructions.cpp.o
[ 47%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/object_id.cpp.o
[ 47%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/protocol.cpp.o
[ 47%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/subscriptions.cpp.o
[ 47%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/transform.cpp.o
[ 48%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/__/util/network_ssl.cpp.o
[ 48%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/__/util/network.cpp.o
[ 48%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/__/util/websocket.cpp.o
[ 50%] Building CXX object realm-core/src/realm/sync/CMakeFiles/Sync.dir/__/util/ez_websocket.cpp.o
[ 50%] Linking CXX static library librealm-sync-dbg.a
[ 50%] Built target Sync
[ 51%] Building CXX object realm-core/src/realm/parser/CMakeFiles/QueryParser.dir/driver.cpp.o
[ 51%] Building CXX object realm-core/src/realm/parser/CMakeFiles/QueryParser.dir/keypath_mapping.cpp.o
[ 51%] Building CXX object realm-core/src/realm/parser/CMakeFiles/QueryParser.dir/generated/query_flex.cpp.o
[ 52%] Building CXX object realm-core/src/realm/parser/CMakeFiles/QueryParser.dir/generated/query_bison.cpp.o
[ 52%] Linking CXX static library librealm-parser-dbg.a
[ 52%] Built target QueryParser
[ 53%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/binding_callback_thread_observer.cpp.o
[ 53%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/collection.cpp.o
[ 53%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/collection_notifications.cpp.o
[ 53%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/dictionary.cpp.o
[ 54%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/index_set.cpp.o
[ 54%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/list.cpp.o
[ 54%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/object.cpp.o
[ 55%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/object_changeset.cpp.o
[ 55%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/object_schema.cpp.o
[ 55%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/object_store.cpp.o
[ 55%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/results.cpp.o
[ 56%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/schema.cpp.o
[ 56%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/sectioned_results.cpp.o
[ 56%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/set.cpp.o
[ 57%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/shared_realm.cpp.o
[ 57%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/thread_safe_reference.cpp.o
[ 57%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/impl/collection_change_builder.cpp.o
[ 59%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/impl/collection_notifier.cpp.o
[ 59%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/impl/deep_change_checker.cpp.o
[ 59%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/impl/list_notifier.cpp.o
[ 59%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/impl/object_notifier.cpp.o
[ 60%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/impl/realm_coordinator.cpp.o
[ 60%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/impl/results_notifier.cpp.o
[ 60%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/impl/transact_log_handler.cpp.o
[ 61%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/impl/weak_realm_notifier.cpp.o
[ 61%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/util/scheduler.cpp.o
[ 61%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/util/uuid.cpp.o
[ 61%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/sync/app.cpp.o
[ 62%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/sync/app_utils.cpp.o
[ 62%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/sync/app_credentials.cpp.o
[ 62%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/sync/generic_network_transport.cpp.o
[ 63%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/sync/async_open_task.cpp.o
[ 63%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/sync/sync_manager.cpp.o
[ 63%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/sync/sync_session.cpp.o
[ 64%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/sync/sync_user.cpp.o
[ 64%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/sync/mongo_client.cpp.o
[ 64%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/sync/mongo_collection.cpp.o
[ 64%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/sync/mongo_database.cpp.o
[ 65%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/sync/push_client.cpp.o
[ 65%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/sync/impl/sync_file.cpp.o
[ 65%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/sync/impl/sync_metadata.cpp.o
[ 67%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/util/bson/bson.cpp.o
[ 67%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/util/bson/regular_expression.cpp.o
[ 67%] Building CXX object realm-core/src/realm/object-store/CMakeFiles/ObjectStore.dir/impl/epoll/external_commit_helper.cpp.o
[ 67%] Linking CXX static library librealm-object-store-dbg.a
[ 67%] Built target ObjectStore
[ 68%] Building CXX object CMakeFiles/cpprealm.dir/src/cpprealm/sdk.cpp.o
[ 68%] Building CXX object CMakeFiles/cpprealm.dir/src/cpprealm/analytics.cpp.o
[ 68%] Building CXX object CMakeFiles/cpprealm.dir/src/cpprealm/internal/curl/network_transport.cpp.o
[ 68%] Linking CXX shared library libcpprealm.so
[ 68%] Built target cpprealm
[ 68%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/reporters/catch_reporter_automake.cpp.o
[ 69%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/reporters/catch_reporter_combined_tu.cpp.o
[ 69%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/reporters/catch_reporter_common_base.cpp.o
[ 69%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/reporters/catch_reporter_compact.cpp.o
[ 70%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/reporters/catch_reporter_console.cpp.o
[ 70%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/reporters/catch_reporter_cumulative_base.cpp.o
[ 70%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/reporters/catch_reporter_junit.cpp.o
[ 71%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/reporters/catch_reporter_multi.cpp.o
[ 71%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/reporters/catch_reporter_registrars.cpp.o
[ 71%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/reporters/catch_reporter_sonarqube.cpp.o
[ 71%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/reporters/catch_reporter_streaming_base.cpp.o
[ 72%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/reporters/catch_reporter_tap.cpp.o
[ 72%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/reporters/catch_reporter_teamcity.cpp.o
[ 72%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/reporters/catch_reporter_xml.cpp.o
[ 73%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/catch_approx.cpp.o
[ 73%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_assertion_handler.cpp.o
[ 73%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/catch_assertion_result.cpp.o
[ 73%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/matchers/internal/catch_matchers_combined_tu.cpp.o
[ 75%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_clara.cpp.o
[ 75%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_commandline.cpp.o
[ 75%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_source_line_info.cpp.o
[ 76%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/catch_config.cpp.o
[ 76%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_case_insensitive_comparisons.cpp.o
[ 76%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_console_colour.cpp.o
[ 76%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_context.cpp.o
[ 77%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_debug_console.cpp.o
[ 77%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_debugger.cpp.o
[ 77%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_enforce.cpp.o
[ 78%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_enum_values_registry.cpp.o
[ 78%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_exception_translator_registry.cpp.o
[ 78%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_fatal_condition_handler.cpp.o
[ 79%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_floating_point_helpers.cpp.o
[ 79%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_istream.cpp.o
[ 79%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/generators/internal/catch_generators_combined_tu.cpp.o
[ 79%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/interfaces/catch_interfaces_combined_tu.cpp.o
[ 80%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/interfaces/catch_interfaces_generatortracker.cpp.o
[ 80%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/interfaces/catch_interfaces_reporter.cpp.o
[ 80%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_list.cpp.o
[ 81%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/matchers/catch_matchers_floating_point.cpp.o
[ 81%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/matchers/catch_matchers_string.cpp.o
[ 81%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/matchers/catch_matchers_templated.cpp.o
[ 81%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/catch_message.cpp.o
[ 82%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_output_redirect.cpp.o
[ 82%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/catch_registry_hub.cpp.o
[ 82%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_combined_tu.cpp.o
[ 84%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_random_number_generator.cpp.o
[ 84%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_random_seed_generation.cpp.o
[ 84%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_reporter_registry.cpp.o
[ 85%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_reporter_spec_parser.cpp.o
[ 85%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_result_type.cpp.o
[ 85%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_run_context.cpp.o
[ 85%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_section.cpp.o
[ 86%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_stdstreams.cpp.o
[ 86%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/catch_session.cpp.o
[ 86%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_singletons.cpp.o
[ 87%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_reusable_string_stream.cpp.o
[ 87%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_stringref.cpp.o
[ 87%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_string_manip.cpp.o
[ 87%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_tag_alias_registry.cpp.o
[ 88%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/catch_test_case_info.cpp.o
[ 88%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_test_case_registry_impl.cpp.o
[ 88%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_test_case_tracker.cpp.o
[ 89%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_test_registry.cpp.o
[ 89%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_textflow.cpp.o
[ 89%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/catch_test_spec.cpp.o
[ 89%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_test_spec_parser.cpp.o
[ 90%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/catch_timer.cpp.o
[ 90%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/catch_tostring.cpp.o
[ 90%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/catch_totals.cpp.o
[ 92%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/catch_version.cpp.o
[ 92%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_wildcard_pattern.cpp.o
[ 92%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_xmlwriter.cpp.o
[ 93%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/internal/catch_test_case_info_hasher.cpp.o
[ 93%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/generators/catch_generators_random.cpp.o
[ 93%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/benchmark/internal/catch_benchmark_combined_tu.cpp.o
[ 93%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/benchmark/detail/catch_stats.cpp.o
[ 94%] Linking CXX static library libCatch2d.a
[ 94%] Built target Catch2
[ 95%] Building CXX object CMakeFiles/cpprealm_exe_tests.dir/tests/str_tests.cpp.o
[ 95%] Building CXX object CMakeFiles/cpprealm_exe_tests.dir/tests/list_tests.cpp.o
[ 95%] Building CXX object CMakeFiles/cpprealm_exe_tests.dir/tests/query_tests.cpp.o
[ 96%] Building CXX object CMakeFiles/cpprealm_exe_tests.dir/tests/main.cpp.o
[ 96%] Building CXX object CMakeFiles/cpprealm_exe_tests.dir/tests/admin_utils.cpp.o
[ 96%] Building CXX object CMakeFiles/cpprealm_exe_tests.dir/tests/date_tests.cpp.o
[ 96%] Building CXX object CMakeFiles/cpprealm_exe_tests.dir/tests/mixed_tests.cpp.o
[ 97%] Building CXX object CMakeFiles/cpprealm_exe_tests.dir/tests/results_tests.cpp.o
[ 97%] Building CXX object CMakeFiles/cpprealm_exe_tests.dir/tests/binary_tests.cpp.o
[ 97%] Building CXX object CMakeFiles/cpprealm_exe_tests.dir/tests/flx_sync_tests.cpp.o
[ 98%] Building CXX object CMakeFiles/cpprealm_exe_tests.dir/tests/app_tests.cpp.o
[ 98%] Building CXX object CMakeFiles/cpprealm_exe_tests.dir/tests/embedded_object_tests.cpp.o
[ 98%] Building CXX object CMakeFiles/cpprealm_exe_tests.dir/tests/opt_tests.cpp.o
[100%] Linking CXX executable cpprealm_exe_tests
[100%] Built target cpprealm_exe_tests
[100%] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2WithMain.dir/catch2/internal/catch_main.cpp.o
[100%] Linking CXX static library libCatch2Maind.a
[100%] Built target Catch2WithMain
Install the project...
-- Install configuration: "debug"
-- Installing: /usr/local/lib64/libcpprealm.so
-- Up-to-date: /usr/local/include/cpprealm/sdk.hpp
-- Up-to-date: /usr/local/include/cpprealm/app.hpp
-- Up-to-date: /usr/local/include/cpprealm/db.hpp
-- Up-to-date: /usr/local/include/cpprealm/notifications.hpp
-- Up-to-date: /usr/local/include/cpprealm/object.hpp
-- Up-to-date: /usr/local/include/cpprealm/persisted.hpp
-- Up-to-date: /usr/local/include/cpprealm/results.hpp
-- Up-to-date: /usr/local/include/cpprealm/schema.hpp
-- Up-to-date: /usr/local/include/cpprealm/task.hpp
-- Up-to-date: /usr/local/include/cpprealm/thread_safe_reference.hpp
-- Up-to-date: /usr/local/include/cpprealm/type_info.hpp
-- Up-to-date: /usr/local/include/cpprealm/flex_sync.hpp
-- Up-to-date: /usr/local/include/cpprealm/persisted_string.hpp
-- Up-to-date: /usr/local/include/cpprealm/persisted_bool.hpp
-- Up-to-date: /usr/local/include/cpprealm/persisted_int.hpp
-- Up-to-date: /usr/local/include/cpprealm/persisted_optional.hpp
-- Up-to-date: /usr/local/include/cpprealm/persisted_enum.hpp
-- Up-to-date: /usr/local/include/cpprealm/persisted_timestamp.hpp
-- Up-to-date: /usr/local/include/cpprealm/persisted_uuid.hpp
-- Up-to-date: /usr/local/include/cpprealm/persisted_list.hpp
-- Up-to-date: /usr/local/include/cpprealm/persisted_embedded.hpp
-- Up-to-date: /usr/local/include/cpprealm/persisted_binary.hpp
-- Up-to-date: /usr/local/include/cpprealm/persisted_mixed.hpp
-- Up-to-date: /usr/local/include/cpprealm/analytics.hpp
-- Up-to-date: /usr/local/include/cpprealm/generic_network_transport.hpp

So build process looks OK.
Then I make project with Realm cpp code

#include <cpprealm/sdk.hpp>

and CMakeList.txt is:

cmake_minimum_required(VERSION 3.5)
project(dbbench LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_executable(dbbench main.cpp test_realm.cpp)
target_link_libraries(dbbench fmt cpprealm)

But got error:

dbbench.dir/test_realm.cpp.o -c /home/sergey/Work/dbtest/dbbench/dbbench/test_realm.cpp
In file included from /usr/local/include/cpprealm/sdk.hpp:24,
                 from /home/sergey/Work/dbtest/dbbench/dbbench/test_realm.cpp:16:
/usr/local/include/cpprealm/type_info.hpp:25:10: fatal error: realm/object-store/property.hpp: No such file or directory

I guess some incude files was not installed and add include paths to CMakeLists.txt:

include_directories(SYSTEM "/Work/realm-cpp/realm-core/src/")
include_directories(SYSTEM "/Work/realm-cpp/build.release/realm-core/src/")
include_directories(SYSTEM "/Work/realm-cpp/src/")

With this additions I could compile, but got a lot of link errors:

: && /usr/bin/g++ -DQT_QML_DEBUG -g  CMakeFiles/dbbench.dir/main.cpp.o CMakeFiles/dbbench.dir/test_realm.cpp.o -o dbbench  -Wl,-rpath,/usr/local/lib:  -lfmt  -lcpprealm && :
/usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/dbbench.dir/test_realm.cpp.o: in function `__static_initialization_and_destruction_0(int, int)':
/home/sergey/Work/realm-cpp/src/cpprealm/db.hpp:109: undefined reference to `realm::util::Scheduler::make_default()'
/usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/dbbench.dir/test_realm.cpp.o: in function `realm::util::detail::ExceptionWithBacktraceBase::ExceptionWithBacktraceBase()':
/home/sergey/Work/realm-cpp/realm-core/src/realm/util/backtrace.hpp:101: undefined reference to `realm::util::Backtrace::capture()'
/usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/dbbench.dir/test_realm.cpp.o: in function `realm::util::File::Streambuf::seekpos(std::fpos<__mbstate_t>, std::_Ios_Openmode)':
/home/sergey/Work/realm-cpp/realm-core/src/realm/util/file.hpp:1315: undefined reference to `realm::util::File::seek(long)'
/usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/dbbench.dir/test_realm.cpp.o: in function `realm::util::File::Streambuf::flush()':
/home/sergey/Work/realm-cpp/realm-core/src/realm/util/file.hpp:1323: undefined reference to `realm::util::File::write(char const*, unsigned long)'
/usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/dbbench.dir/test_realm.cpp.o: in function `realm::util::detail::ExceptionWithBacktraceBase::~ExceptionWithBacktraceBase()':
/Work/realm-cpp/realm-core/src/realm/util/backtrace.hpp:98: undefined reference to `realm::util::Backtrace::~Backtrace()'
/usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/dbbench.dir/test_realm.cpp.o: in function `realm::LogicError::LogicError(realm::LogicError::ErrorKind)':
/Work/realm-cpp/realm-core/src/realm/exceptions.hpp:405: undefined reference to `vtable for realm::LogicError'
/usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: /Work/realm-cpp/realm-core/src/realm/exceptions.hpp:405: undefined reference to `vtable for realm::LogicError'

I found several static libs in build directory and one by one added to target_link_libraries, and almost eliminated link errors.

link_directories("/Work/realm-cpp/build.release/realm-core/src/realm/"
    "/Work/realm-cpp/build.release/realm-core/openssl/lib/"
    "/Work/realm-cpp/build.release/realm-core/src/realm/object-store/"
    "/Work/realm-cpp/build.release/realm-core/src/realm/sync/"
)

target_link_libraries(dbbench fmt realm realm-object-store realm-sync uv cpprealm)

but finally got unresolved SSL_write@@OPENSSL_1_1_0
I added ssl & crypto to target_link_libraries and then got a lot of new unresolved:

undefined reference to `realm::make_in_realm_history()'
undefined reference to `realm::Status::Status(realm::ErrorCodes::Error, char const*)'
...

Then I fill tired and guess I do something wrong....
Could you help me to build and test cpp-realm application ?

realm::experimental::db as std::unique_ptr?

I'm setting up my syncRealm (realm::experimental::db) as a unique_ptr.

I'm getting a crash when calling add. Is there something in the design that means it should be used in a unique_ptr? Or am I doing something else wrong?

Installation using cmake failed

OS

  • Ubuntu 20.04

gcc, g++ version

  • 9.4.0 (also tried 10.3.0, but turned out worse than 9.4.0)

What I wanted to do

  • install realm cpp sdk

What I did - I got the GIT_TAG from the top of the page next to the SDK name

  1. create directory cloud_db_test
  2. add CMakeList.txt, following instructions from the documentations
    cmake_minimum_required(VERSION 3.15)
    
    project(MyRealmCppProject)
    
    # Minimum C++ standard
    set(CMAKE_CXX_STANDARD 17)
    
    # Include the FetchContent module so you can download the Realm C++ SDK
    Include(FetchContent)
    
    # Force Realm to use whatever version of OpenSSL you have installed on your system
    set(REALM_USE_SYSTEM_OPENSSL ON)
    
    # Declare the version of the Realm C++ SDk you want to download
    # While it's in alpha, use a git commit hash instead of a tagged release
    FetchContent_Declare(
      cpprealm
      GIT_REPOSITORY https://github.com/realm/realm-cpp.git
      GIT_TAG        5dab867db1e3ed63b1c4aba611991724d16cd0ce
    
    )
    
    # The MakeAvailable command ensures the named dependencies have been populated
    FetchContent_MakeAvailable(cpprealm)
    
    # Create an executable target called myApp with the source file main.cpp
    add_executable(myApp main.cpp)
    
    target_link_libraries(myApp PRIVATE cpprealm)
    
  3. create main.cpp under cloud_db_test
    #include <cpprealm/sdk.hpp>
    #include <iostream> 
    using namespace std;
    int main(){
        cout << "hello realm" << endl;
        return 0;
    }
    
  4. create directory cloud_db_test/build
  5. from cloud_db_test_/build, run
    cmake ..
    
  6. from cloud_db_test_/build, run
    make
    

The result (for step 5 which is the make command)

...
Scanning dependencies of target cpprealm_exe_tests
[ 90%] Building CXX object _deps/cpprealm-build/CMakeFiles/cpprealm_exe_tests.dir/tests/str_tests.cpp.o
[ 90%] Building CXX object _deps/cpprealm-build/CMakeFiles/cpprealm_exe_tests.dir/tests/list_tests.cpp.o
/home/malacoda/am_offline_db/cloud_db_test/build/_deps/cpprealm-src/tests/list_tests.cpp: In lambda function:
/home/malacoda/am_offline_db/cloud_db_test/build/_deps/cpprealm-src/tests/list_tests.cpp:331:19: error: use of deleted function โ€˜realm::notification_token::notification_token(const realm::notification_token&)โ€™
  331 |            return token;
      |                   ^~~~~
In file included from /home/malacoda/am_offline_db/cloud_db_test/build/_deps/cpprealm-src/src/cpprealm/object.hpp:22,
                 from /home/malacoda/am_offline_db/cloud_db_test/build/_deps/cpprealm-src/src/cpprealm/persisted_embedded.hpp:22,
                 from /home/malacoda/am_offline_db/cloud_db_test/build/_deps/cpprealm-src/src/cpprealm/sdk.hpp:29,
                 from /home/malacoda/am_offline_db/cloud_db_test/build/_deps/cpprealm-src/tests/main.hpp:5,
                 from /home/malacoda/am_offline_db/cloud_db_test/build/_deps/cpprealm-src/tests/list_tests.cpp:1:
/home/malacoda/am_offline_db/cloud_db_test/build/_deps/cpprealm-src/src/cpprealm/notifications.hpp:39:8: note: โ€˜realm::notification_token::notification_token(const realm::notification_token&)โ€™ is implicitly declared as deleted because โ€˜realm::notification_tokenโ€™ declares a move constructor or move assignment operator
   39 | struct notification_token {
      |        ^~~~~~~~~~~~~~~~~~
/home/malacoda/am_offline_db/cloud_db_test/build/_deps/cpprealm-src/tests/list_tests.cpp: In lambda function:
/home/malacoda/am_offline_db/cloud_db_test/build/_deps/cpprealm-src/tests/list_tests.cpp:371:19: error: use of deleted function โ€˜realm::notification_token::notification_token(const realm::notification_token&)โ€™
  371 |            return token;
      |                   ^~~~~
/home/malacoda/am_offline_db/cloud_db_test/build/_deps/cpprealm-src/tests/list_tests.cpp: In lambda function:
/home/malacoda/am_offline_db/cloud_db_test/build/_deps/cpprealm-src/tests/list_tests.cpp:402:19: error: use of deleted function โ€˜realm::notification_token::notification_token(const realm::notification_token&)โ€™
  402 |            return token;
      |                   ^~~~~
/home/malacoda/am_offline_db/cloud_db_test/build/_deps/cpprealm-src/tests/list_tests.cpp: In function โ€˜void CATCH2_INTERNAL_TEST_0()โ€™:
/home/malacoda/am_offline_db/cloud_db_test/build/_deps/cpprealm-src/tests/list_tests.cpp:445:37: error: cannot convert โ€˜intโ€™ to โ€˜const std::variant<std::monostate, long int, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double, std::vector<unsigned char, std::allocator<unsigned char> >, std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long int, std::ratio<1, 1000000000> > >, realm::uuid, realm::object_id>&โ€™
  445 |        obj.list_mixed_col.push_back(42);
      |                                     ^~
      |                                     |
      |                                     int
In file included from /home/malacoda/am_offline_db/cloud_db_test/build/_deps/cpprealm-src/src/cpprealm/sdk.hpp:32,
                 from /home/malacoda/am_offline_db/cloud_db_test/build/_deps/cpprealm-src/tests/main.hpp:5,
                 from /home/malacoda/am_offline_db/cloud_db_test/build/_deps/cpprealm-src/tests/list_tests.cpp:1:
/home/malacoda/am_offline_db/cloud_db_test/build/_deps/cpprealm-src/src/cpprealm/persisted_list.hpp:171:33: note:   initializing argument 1 of โ€˜void realm::persisted<std::vector<Duration>, typename std::enable_if<std::negation<std::disjunction<std::is_same<typename realm::internal::type_info::type_info<ValueType, void>::internal_type, std::optional<realm::internal::bridge::obj_key> >, std::is_same<typename realm::internal::type_info::type_info<ValueType, void>::internal_type, realm::internal::bridge::obj_key>, std::is_same<typename realm::internal::type_info::type_info<ValueType, void>::internal_type, realm::internal::bridge::list>, std::is_same<typename realm::internal::type_info::type_info<ValueType, void>::internal_type, realm::internal::bridge::dictionary> > >::value, void>::type>::push_back(const T&) [with T = std::variant<std::monostate, long int, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double, std::vector<unsigned char, std::allocator<unsigned char> >, std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long int, std::ratio<1, 1000000000> > >, realm::uuid, realm::object_id>; typename std::enable_if<std::negation<std::disjunction<std::is_same<typename realm::internal::type_info::type_info<ValueType, void>::internal_type, std::optional<realm::internal::bridge::obj_key> >, std::is_same<typename realm::internal::type_info::type_info<ValueType, void>::internal_type, realm::internal::bridge::obj_key>, std::is_same<typename realm::internal::type_info::type_info<ValueType, void>::internal_type, realm::internal::bridge::list>, std::is_same<typename realm::internal::type_info::type_info<ValueType, void>::internal_type, realm::internal::bridge::dictionary> > >::value, void>::type = void]โ€™
  171 |         void push_back(const T& value)
      |                        ~~~~~~~~~^~~~~
make[2]: *** [_deps/cpprealm-build/CMakeFiles/cpprealm_exe_tests.dir/build.make:76: _deps/cpprealm-build/CMakeFiles/cpprealm_exe_tests.dir/tests/list_tests.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:374: _deps/cpprealm-build/CMakeFiles/cpprealm_exe_tests.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

Any advice that can help me install the C++ SDK is appreciated.

Optional string in a model throws partial specializations ambiguity error

Defining an optional string in a model throws a Ambiguous partial specializations of 'persisted_type<std::optional<std::string>>' compilation error in Xcode. I'm defining a model as such:

struct Model: realm::object {
  realm::persisted<std::optional<std::string>> optional_string;

  using schema = realm::schema<"model",
  realm::property<"optional_string", &Model::optional_string>
  >;
};

How is it possible to define an optional string? Thank you :)

fPIC required on Linux

My Linux build server reports the following linker error:

ld.lld: error: relocation R_X86_64_PC32 cannot be used against symbol 'vtable for realm::internal::DefaultTransport'; recompile with -fPIC
>>> defined in ../_deps/cpprealm-build/src/libcpprealm.a(network_transport.cpp.o)
>>> referenced by network_transport.cpp
>>>               network_transport.cpp.o:(realm::internal::DefaultTransport::~DefaultTransport()) in archive ../_deps/cpprealm-build/src/libcpprealm.a

I have solved this issue with our own libraries with the following:

set_target_properties(${PROJECT_NAME} PROPERTIES
        POSITION_INDEPENDENT_CODE TRUE

creating pointer to "realm instance" inside a class context - The idea is to persist & reuse the instance for multiple READ/WRITE operations

Hi,

For my app, I would like to create a class that can serve as an interface between my application code and realm DB.
So I am writing a class called "MyRealmInf" with a constructor that creates and initialize the pointer to "realm_instance" like this:

// Header:

class MyRealmInf
{
	private:
	realm::experimental::db* realm_instance = nullptr;

	public:
		MyRealmInf();
};

# .CPP file. The below is inside the constructor

 // .... create config

 auto realm = realm::experimental::db(std::move(config));
 realm_instance = &realm

...

My code compiles, but throws runtime exception when I use the "realm_instance" to write record(s). I am unable to figure out what is causing the error.

It would be great if someone could educate me what I am missing in the above design... Or perhaps, can guide me with a better design given my requirement stated above. Thanks, in advance.

Exception when calling `credentials::username_password`

I am trying out username/password authentication.

I am getting the following exception (not caught by the try/catch block):

ERROR: App: log_in_with_credentials failed: 401 message: http error code considered fatal: {"error":"invalid username/password","error_code":"InvalidPassword","link":"https://realm.mongodb.com/groups/6545ff69c5df044009a5bfd9/apps/654601d24b6daef7f4f26da9/logs?co_id=6548c5bf2e4e293eaac6f424"}. Client Error: 401
libc++abi: terminating due to uncaught exception of type realm::app_error

Here is my code:

    auto app = realm::App (realmConfig);
    realm::user user;
    try
    {
        std::future_status status;
        auto userFuture = app.login (realm::App::credentials::username_password (
            "[email protected]", "password1"));
        do
        {
            switch (status = userFuture.wait_for (50ms); status)
            {
                case std::future_status::deferred:
                    std::cout << "deferred\n";
                    break;
                case std::future_status::timeout:
                    std::cout << "timeout\n";
                    break;
                case std::future_status::ready:
                    std::cout << "ready!\n";
                    break;
            }
        } while (status != std::future_status::ready);

        user = userFuture.get();
        std::cout << "result is " << user.identifier() << '\n';
    }
    catch (std::exception& e)
    {
        std::cout << "Error logging in: " << e.what() << std::endl;
    }

I'm not sure what's going wrong.

Error downloading OpenSSL static lib for Windows CI builds (Ninja)

I'm hitting the following error when running my Windows CI builds:

-- Getting https://static.realm.io/downloads/dependencies/openssl/3.0.8/openssl-3.0.8--windows-static.tar.gz...
CMake Error at C:/Gitlab-Runner/CPM/Cache/cpprealm/a112b5bb90cb3776710c6a09806b2adf70fad799/realm-core/tools/cmake/AcquireRealmDependency.cmake:38 (message):
  Downloading ...  Failed.  Status: 22;"HTTP response code said error"

Could we perhaps have a variable with the location of a local installation to avoid having to re-download it for each build?

Android Example app build fails

The example android project in the repo fails to build. Apparently realm-core was updated, because it can not find realm/util/http.hpp:

/Users/user/repo/github/realm-cpp/src/cpprealm/internal/android/network_transport.cpp:20:10: fatal error: 'realm/util/http.hpp' file not found

Quick search in the root directory shows that it is located in ./realm-core/src/realm/sync/network/http.hpp. If I try to fix the include line, it gives a lot of new build errors related to realm::util

Could you please look into it? And if the example android app builds successfully?

error: no template named 'managed';

When building from the main branch.

Probably related to the removal of the experimental namespace:

Without

using namespace realm;

I get

 error: no template named 'managed'; did you mean 'realm::managed'?
REALM_EMBEDDED_SCHEMA (TonalDBKey, degree, period, name)
^

Offline usage

Should it currently be possible to use a synced Realm instance offline?

If I run the app while offline for the first time (with no realm created yet), open throws an exception: http error code considered fatal. Server Error: 500.

If restart the app when offline (after realm has been created), it currently seems to block when calling subscriptions.update, reporting this sync error Failed to connect to sync: Host not found (authoritative).

If I go offline after successful startup (while online), and for example create a new document, I then get the sync error but it is non blocking. Is it possible to get this behaviour also when first opening a synced realm instance?

If not, what is the current recommended workaround? Should I manually check and instantiate a local vs synced instance depending on the connection status?

musl aarch64 build fails

Hey,
i'm trying to build realm-cpp with musl instead of libc, build fails.

Musl Version: 1.2.3
Openssl: 3.0.7
Zlib: 1.2.13
Curl: 7.86.0
Toolchain: https://github.com/dockcross/dockcross Image: linux-arm64-musl

Build Error:

[ 21%] Building CXX object realm-core/src/realm/CMakeFiles/Storage.dir/query.cpp.o
In file included from /usr/aarch64-linux-musl-cross/aarch64-linux-musl/include/c++/9.4.0/cstdint:41,
from /work/build/thirdParty/realm-cpp/external-realm-cpp/src/external-realm-cpp/realm-core/src/realm/query.hpp:22,
from /work/build/thirdParty/realm-cpp/external-realm-cpp/src/external-realm-cpp/realm-core/src/realm/query.cpp:19:
/usr/include/stdint.h:26:10: fatal error: bits/libc-header-start.h: No such file or directory
26 | #include <bits/libc-header-start.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
gmake[5]: *** [realm-core/src/realm/CMakeFiles/Storage.dir/build.make:76: realm-core/src/realm/CMakeFiles/Storage.dir/query.cpp.o] Error 1
gmake[4]: *** [CMakeFiles/Makefile2:379: realm-core/src/realm/CMakeFiles/Storage.dir/all] Error 2
gmake[4]: *** Waiting for unfinished jobs....
[ 21%] Building CXX object _deps/catch2-build/src/CMakeFiles/

undeclared identifier 'coro'

I'm working on the C++ examples on macOS, using a synced Realm instance, and getting the following compiler errors:

                                                                          ^
/Users/adamwilson/dev/node-audio/realm-test/Libs/cpprealm-src/src/cpprealm/experimental/observation.hpp:249:33: error: use of undeclared identifier 'coro'
            using handle_type = coro::coroutine_handle<promise_type>;
                                ^
/Users/adamwilson/dev/node-audio/realm-test/Libs/cpprealm-src/src/cpprealm/experimental/observation.hpp:260:17: error: use of undeclared identifier 'coro'
                coro::suspend_always initial_suspend() { return {}; }
                ^
/Users/adamwilson/dev/node-audio/realm-test/Libs/cpprealm-src/src/cpprealm/experimental/observation.hpp:262:17: error: use of undeclared identifier 'coro'
                coro::suspend_always final_suspend() noexcept {
                ^
/Users/adamwilson/dev/node-audio/realm-test/Libs/cpprealm-src/src/cpprealm/experimental/observation.hpp:272:17: error: use of undeclared identifier 'coro'
                coro::suspend_always yield_value(From &&from) {
                ^
/Users/adamwilson/dev/node-audio/realm-test/Libs/cpprealm-src/src/cpprealm/experimental/observation.hpp:284:13: error: unknown type name 'handle_type'
            handle_type h_;
            ^
/Users/adamwilson/dev/node-audio/realm-test/Libs/cpprealm-src/src/cpprealm/experimental/observation.hpp:286:23: error: unknown type name 'handle_type'
            generator(handle_type h)
                      ^
/Users/adamwilson/dev/node-audio/realm-test/Libs/cpprealm-src/src/cpprealm/experimental/observation.hpp:303:13: error: use of undeclared identifier 'coro'
            coro::coroutine_handle<> out_h;
            ^
/Users/adamwilson/dev/node-audio/realm-test/Libs/cpprealm-src/src/cpprealm/experimental/observation.hpp:257:38: error: use of undeclared identifier 'handle_type'
                    return generator(handle_type::from_promise(*this));
                                     ^
/Users/adamwilson/dev/node-audio/realm-test/Libs/cpprealm-src/src/cpprealm/experimental/observation.hpp:326:48: error: no member named 'freeze' in 'realm::internal::bridge::object'
                      m_object(internal_object.freeze(internal_object.get_realm().freeze())) {}
                               ~~~~~~~~~~~~~~~ ^
/Users/adamwilson/dev/node-audio/realm-test/Libs/cpprealm-src/src/cpprealm/experimental/observation.hpp:326:83: error: no member named 'freeze' in 'realm::internal::bridge::realm'
                      m_object(internal_object.freeze(internal_object.get_realm().freeze())) {}
                                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/Users/adamwilson/dev/node-audio/realm-test/Libs/cpprealm-src/src/cpprealm/experimental/observation.hpp:349:39: error: no member named 'obj' in 'realm::internal::bridge::object'
                auto table = m_object.obj().get_table();
                             ~~~~~~~~ ^
/Users/adamwilson/dev/node-audio/realm-test/Libs/cpprealm-src/src/cpprealm/experimental/observation.hpp:384:80: warning: 'dispatch_get_current_queue' is deprecated: first deprecated in macOS 10.9 - unsupported interface [-Wdeprecated-declarations]
                    config.set_scheduler(realm::util::Scheduler::make_dispatch(dispatch_get_current_queue()));
                                                                               ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/include/dispatch/queue.h:556:1: note: 'dispatch_get_current_queue' has been explicitly marked deprecated here
dispatch_get_current_queue(void);

Is there something I'm missing?

I'm using v0.4.0-preview branch and set it to C++20 in the CMakeLists.txt

Crash when using nested object with fresh database

SDK and version

SDK : C++
Version: 0.4.0

Observations

  • How frequent do the crash occur? When first generating the schema
  • Does it happen in production or during dev/test? Debug
  • Can the crash be reproduced by you? Yes
  • Can you provide instructions for how we can reproduce it? Yes

Crash log / stacktrace

[realm-core-13.23.1] Assertion failed: type == ColumnTypeTraits<T>::column_id
0   Entonal Studio                      0x0000000105b36960 _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28
1   Entonal Studio                      0x0000000105b36940 _ZN5realm4util19terminate_with_infoEPKcS2_lS2_OSt16initializer_listINS0_9PrintableEE + 308
2   Entonal Studio                      0x0000000105b3680c _ZN5realm4util19terminate_with_infoEPKcS2_lS2_OSt16initializer_listINS0_9PrintableEE + 0
3   Entonal Studio                      0x0000000105a00814 _ZNK5realm3Obj3getINS_10StringDataEEET_NS_6ColKeyE + 140
4   Entonal Studio                      0x0000000105169ca0 _ZN5realm8internal6bridge3getINSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEEET_RKNS1_3objERKNS1_7col_keyE + 68
5   Entonal Studio                      0x00000001051505a4 _ZNK5realm8internal6bridge3obj3getINSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEET_RKNS1_7col_keyE + 40
6   Entonal Studio                      0x000000010515239c _ZNK5realm12experimental7managedINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEvE3getEv + 40
7   Entonal Studio                      0x0000000105152adc _ZNK5realm12experimental7managedINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEvE6detachEv + 32
8   Entonal Studio                      0x000000010510fbb0 _ZZNK5realm12experimental7managedIP14TonalDBMappingvE6detachEvENKUlRT_E_clINSt3__14pairINS_9schemagen8propertyIXadL_ZNS2_10noteLayoutEEELb0EEEMNS1_IS2_vEENS1_INS9_12basic_stringIcNS9_11char_traitsIcEENS9_9allocatorIcEEEEvEEEEEEDaS6_ + 56
9   Entonal Studio                      0x000000010510fadc _ZZNK5realm12experimental7managedIP14TonalDBMappingvE6detachEvENKUlDpOT_E_clIJRNSt3__14pairINS_9schemagen8propertyIXadL_ZNS2_12customKeyMapEEELb0EEEMNS1_IS2_vEENS1_IbvEEEERNSB_INSD_IXadL_ZNS2_10noteLayoutEEELb0EEEMSF_NS1_INSA_12basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEvEEEERNSB_INSD_IXadL_ZNS2_13referenceNoteEEELb0EEEMSF_NS1_IxvEEEERNSB_INSD_IXadL_ZNS2_18referenceFrequencyEEELb0EEEMSF_NS1_IdvEEEERNSB_INSD_IXadL_ZNS2_8rootNoteEEELb0EEESX_EERNSB_INSD_IXadL_ZNS2_6keyMapEEELb0EEEMSF_NS1_INSA_6vectorIP10TonalDBKeyNSO_IS1B_EEEEvEEEEEEEDaS7_ + 76
10  Entonal Studio                      0x000000010510f998 _ZNSt3__18__invokeB6v15006IZNK5realm12experimental7managedIP14TonalDBMappingvE6detachEvEUlDpOT_E_JRNS_4pairINS1_9schemagen8propertyIXadL_ZNS4_12customKeyMapEEELb0EEEMNS3_IS4_vEENS3_IbvEEEERNSB_INSD_IXadL_ZNS4_10noteLayoutEEELb0EEEMSF_NS3_INS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEvEEEERNSB_INSD_IXadL_ZNS4_13referenceNoteEEELb0EEEMSF_NS3_IxvEEEERNSB_INSD_IXadL_ZNS4_18referenceFrequencyEEELb0EEEMSF_NS3_IdvEEEERNSB_INSD_IXadL_ZNS4_8rootNoteEEELb0EEESX_EERNSB_INSD_IXadL_ZNS4_6keyMapEEELb0EEEMSF_NS3_INS_6vectorIP10TonalDBKeyNSO_IS1B_EEEEvEEEEEEEDTclclsr3stdE7declvalIT_EEspclsr3stdE7declvalIT0_EEEEOS1I_DpOS1J_ + 72
11  Entonal Studio                      0x000000010510f944 _ZNSt3__118__apply_tuple_implB6v15006IZNK5realm12experimental7managedIP14TonalDBMappingvE6detachEvEUlDpOT_E_RNS_5tupleIJNS_4pairINS1_9schemagen8propertyIXadL_ZNS4_12customKeyMapEEELb0EEEMNS3_IS4_vEENS3_IbvEEEENSC_INSE_IXadL_ZNS4_10noteLayoutEEELb0EEEMSG_NS3_INS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEvEEEENSC_INSE_IXadL_ZNS4_13referenceNoteEEELb0EEEMSG_NS3_IxvEEEENSC_INSE_IXadL_ZNS4_18referenceFrequencyEEELb0EEEMSG_NS3_IdvEEEENSC_INSE_IXadL_ZNS4_8rootNoteEEELb0EEESW_EENSC_INSE_IXadL_ZNS4_6keyMapEEELb0EEEMSG_NS3_INS_6vectorIP10TonalDBKeyNSO_IS17_EEEEvEEEEEEEJLm0ELm1ELm2ELm3ELm4ELm5EEEEDcOT_OT0_NS_15__tuple_indicesIJXspT1_EEEE + 128
12  Entonal Studio                      0x000000010510de88 _ZNSt3__15applyB6v15006IZNK5realm12experimental7managedIP14TonalDBMappingvE6detachEvEUlDpOT_E_RNS_5tupleIJNS_4pairINS1_9schemagen8propertyIXadL_ZNS4_12customKeyMapEEELb0EEEMNS3_IS4_vEENS3_IbvEEEENSC_INSE_IXadL_ZNS4_10noteLayoutEEELb0EEEMSG_NS3_INS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEvEEEENSC_INSE_IXadL_ZNS4_13referenceNoteEEELb0EEEMSG_NS3_IxvEEEENSC_INSE_IXadL_ZNS4_18referenceFrequencyEEELb0EEEMSG_NS3_IdvEEEENSC_INSE_IXadL_ZNS4_8rootNoteEEELb0EEESW_EENSC_INSE_IXadL_ZNS4_6keyMapEEELb0EEEMSG_NS3_INS_6vectorIP10TonalDBKeyNSO_IS17_EEEEvEEEEEEEEEDcOT_OT0_ + 32
13  Entonal Studio                      0x000000010510dd10 _ZNK5realm12experimental7managedIP14TonalDBMappingvE6detachEv + 288
14  Entonal Studio                      0x000000010510c430 _ZZNK5realm12experimental7managedI13TonalDBTuningvE6detachEvENKUlRT_E_clINSt3__14pairINS_9schemagen8propertyIXadL_ZNS2_7mappingEEELb0EEEMS3_NS1_IP14TonalDBMappingvEEEEEEDaS5_ + 48
15  Entonal Studio                      0x000000010510c07c _ZZNK5realm12experimental7managedI13TonalDBTuningvE6detachEvENKUlDpRT_E_clIJNSt3__14pairINS_9schemagen8propertyIXadL_ZNS2_3_idEEELb0EEEMS3_NS1_INS0_11primary_keyINS_4uuidEEEvEEEENSA_INSC_IXadL_ZNS2_9createdAtEEELb0EEEMS3_NS1_INS9_6chrono10time_pointINSL_12system_clockENSL_8durationIxNS9_5ratioILl1ELl1000000EEEEEEEvEEEENSA_INSC_IXadL_ZNS2_9updatedAtEEELb0EEESU_EENSA_INSC_IXadL_ZNS2_5titleEEELb0EEEMS3_NS1_INS9_12basic_stringIcNS9_11char_traitsIcEENS9_9allocatorIcEEEEvEEEENSA_INSC_IXadL_ZNS2_10shortTitleEEELb0EEES16_EENSA_INSC_IXadL_ZNS2_11descriptionEEELb0EEES16_EENSA_INSC_IXadL_ZNS2_6authorEEELb0EEES16_EENSA_INSC_IXadL_ZNS2_6periodEEELb0EEES16_EENSA_INSC_IXadL_ZNS2_7pitchesEEELb0EEEMS3_NS1_INS9_6vectorIP12TonalDBPitchNS12_IS1J_EEEEvEEEENSA_INSC_IXadL_ZNS2_7mappingEEELb0EEEMS3_NS1_IP14TonalDBMappingvEEEENSA_INSC_IXadL_ZNS2_7ownerIdEEELb0EEEMS3_NS1_INS9_8optionalIS14_EEvEEEEEEEDaS6_ + 240
16  Entonal Studio                      0x000000010510bdcc _ZNSt3__18__invokeB6v15006IZNK5realm12experimental7managedI13TonalDBTuningvE6detachEvEUlDpRT_E_JRNS_4pairINS1_9schemagen8propertyIXadL_ZNS4_3_idEEELb0EEEMS5_NS3_INS2_11primary_keyINS1_4uuidEEEvEEEERNSA_INSC_IXadL_ZNS4_9createdAtEEELb0EEEMS5_NS3_INS_6chrono10time_pointINSM_12system_clockENSM_8durationIxNS_5ratioILl1ELl1000000EEEEEEEvEEEERNSA_INSC_IXadL_ZNS4_9updatedAtEEELb0EEESV_EERNSA_INSC_IXadL_ZNS4_5titleEEELb0EEEMS5_NS3_INS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEvEEEERNSA_INSC_IXadL_ZNS4_10shortTitleEEELb0EEES19_EERNSA_INSC_IXadL_ZNS4_11descriptionEEELb0EEES19_EERNSA_INSC_IXadL_ZNS4_6authorEEELb0EEES19_EERNSA_INSC_IXadL_ZNS4_6periodEEELb0EEES19_EERNSA_INSC_IXadL_ZNS4_7pitchesEEELb0EEEMS5_NS3_INS_6vectorIP12TonalDBPitchNS15_IS1R_EEEEvEEEERNSA_INSC_IXadL_ZNS4_7mappingEEELb0EEEMS5_NS3_IP14TonalDBMappingvEEEERNSA_INSC_IXadL_ZNS4_7ownerIdEEELb0EEEMS5_NS3_INS_8optionalIS17_EEvEEEEEEEDTclclsr3stdE7declvalIT_EEspclsr3stdE7declvalIT0_EEEEOS2C_DpOS2D_ + 148
17  Entonal Studio                      0x000000010510bd2c _ZNSt3__118__apply_tuple_implB6v15006IZNK5realm12experimental7managedI13TonalDBTuningvE6detachEvEUlDpRT_E_RNS_5tupleIJNS_4pairINS1_9schemagen8propertyIXadL_ZNS4_3_idEEELb0EEEMS5_NS3_INS2_11primary_keyINS1_4uuidEEEvEEEENSB_INSD_IXadL_ZNS4_9createdAtEEELb0EEEMS5_NS3_INS_6chrono10time_pointINSM_12system_clockENSM_8durationIxNS_5ratioILl1ELl1000000EEEEEEEvEEEENSB_INSD_IXadL_ZNS4_9updatedAtEEELb0EEESV_EENSB_INSD_IXadL_ZNS4_5titleEEELb0EEEMS5_NS3_INS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEvEEEENSB_INSD_IXadL_ZNS4_10shortTitleEEELb0EEES17_EENSB_INSD_IXadL_ZNS4_11descriptionEEELb0EEES17_EENSB_INSD_IXadL_ZNS4_6authorEEELb0EEES17_EENSB_INSD_IXadL_ZNS4_6periodEEELb0EEES17_EENSB_INSD_IXadL_ZNS4_7pitchesEEELb0EEEMS5_NS3_INS_6vectorIP12TonalDBPitchNS13_IS1K_EEEEvEEEENSB_INSD_IXadL_ZNS4_7mappingEEELb0EEEMS5_NS3_IP14TonalDBMappingvEEEENSB_INSD_IXadL_ZNS4_7ownerIdEEELb0EEEMS5_NS3_INS_8optionalIS15_EEvEEEEEEEJLm0ELm1ELm2ELm3ELm4ELm5ELm6ELm7ELm8ELm9ELm10EEEEDcOT_OT0_NS_15__tuple_indicesIJXspT1_EEEE + 228
18  Entonal Studio                      0x000000010510aac4 _ZNSt3__15applyB6v15006IZNK5realm12experimental7managedI13TonalDBTuningvE6detachEvEUlDpRT_E_RNS_5tupleIJNS_4pairINS1_9schemagen8propertyIXadL_ZNS4_3_idEEELb0EEEMS5_NS3_INS2_11primary_keyINS1_4uuidEEEvEEEENSB_INSD_IXadL_ZNS4_9createdAtEEELb0EEEMS5_NS3_INS_6chrono10time_pointINSM_12system_clockENSM_8durationIxNS_5ratioILl1ELl1000000EEEEEEEvEEEENSB_INSD_IXadL_ZNS4_9updatedAtEEELb0EEESV_EENSB_INSD_IXadL_ZNS4_5titleEEELb0EEEMS5_NS3_INS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEvEEEENSB_INSD_IXadL_ZNS4_10shortTitleEEELb0EEES17_EENSB_INSD_IXadL_ZNS4_11descriptionEEELb0EEES17_EENSB_INSD_IXadL_ZNS4_6authorEEELb0EEES17_EENSB_INSD_IXadL_ZNS4_6periodEEELb0EEES17_EENSB_INSD_IXadL_ZNS4_7pitchesEEELb0EEEMS5_NS3_INS_6vectorIP12TonalDBPitchNS13_IS1K_EEEEvEEEENSB_INSD_IXadL_ZNS4_7mappingEEELb0EEEMS5_NS3_IP14TonalDBMappingvEEEENSB_INSD_IXadL_ZNS4_7ownerIdEEELb0EEEMS5_NS3_INS_8optionalIS15_EEvEEEEEEEEEDcOT_OT0_ + 32
19  Entonal Studio                      0x00000001050ef074 _ZNK5realm12experimental7managedI13TonalDBTuningvE6detachEv + 144
20  Entonal Studio                      0x00000001050f0e28 _ZNK7tonaldb7TonalDB10getTuningsEv + 316
21  Entonal Studio                      0x00000001044c4f58 _ZN8DatabaseC2EbRN7tonaldb7TonalDBE + 140
22  Entonal Studio                      0x00000001044c5dc8 _ZN8DatabaseC1EbRN7tonaldb7TonalDBE + 56
23  Entonal Studio                      0x0000000104678fe8 _ZNSt3__111make_uniqueB6v15006I8DatabaseJbRN7tonaldb7TonalDBEEEENS_11__unique_ifIT_E15__unique_singleEDpOT0_ + 60
24  Entonal Studio                      0x00000001046781fc _ZN27EntonalStudioAudioProcessorC2Ev + 2492
25  Entonal Studio                      0x0000000104679a4c _ZN27EntonalStudioAudioProcessorC1Ev + 28
26  Entonal Studio                      0x000000010467afe4 _Z18createPluginFilterv + 28
27  Entonal Studio                      0x00000001043e2460 _ZN4juce24createPluginFilterOfTypeENS_14AudioProcessor11WrapperTypeE + 28
28  Entonal Studio                      0x00000001043d7fec _ZN4juce22StandalonePluginHolder12createPluginEv + 32
29  Entonal Studio                      0x00000001043d73f4 _ZN4juce22StandalonePluginHolderC2EPNS_11PropertySetEbRKNS_6StringEPKNS_18AudioDeviceManager16AudioDeviceSetupERKNS_5ArrayINS0_12PluginInOutsENS_20DummyCriticalSectionELi0EEEb + 556
30  Entonal Studio                      0x00000001043d5944 _ZN4juce22StandalonePluginHolderC1EPNS_11PropertySetEbRKNS_6StringEPKNS_18AudioDeviceManager16AudioDeviceSetupERKNS_5ArrayINS0_12PluginInOutsENS_20DummyCriticalSectionELi0EEEb + 96
31  Entonal Studio                      0x00000001043d5654 _ZN4juce22StandaloneFilterWindowC2ERKNS_6StringENS_6ColourEPNS_11PropertySetEbS3_PKNS_18AudioDeviceManager16AudioDeviceSetupERKNS_5ArrayINS_22StandalonePluginHolder12PluginInOutsENS_20DummyCriticalSectionELi0EEEb + 444
32  Entonal Studio                      0x00000001043d538c _ZN4juce22StandaloneFilterWindowC1ERKNS_6StringENS_6ColourEPNS_11PropertySetEbS3_PKNS_18AudioDeviceManager16AudioDeviceSetupERKNS_5ArrayINS_22StandalonePluginHolder12PluginInOutsENS_20DummyCriticalSectionELi0EEEb + 132
33  Entonal Studio                      0x00000001043d237c _ZN4juce19StandaloneFilterApp12createWindowEv + 204
34  Entonal Studio                      0x00000001043d20d4 _ZN4juce19StandaloneFilterApp10initialiseERKNS_6StringE + 40
35  Entonal Studio                      0x0000000104cbdd08 _ZN4juce19JUCEApplicationBase13initialiseAppEv + 196
36  Entonal Studio                      0x00000001049e8d84 _ZN4juce15JUCEApplication13initialiseAppEv + 24
37  Entonal Studio                      0x0000000104cbda84 _ZN4juce19JUCEApplicationBase4mainEv + 300
38  Entonal Studio                      0x0000000104cbd900 _ZN4juce19JUCEApplicationBase4mainEiPPKc + 68
39  Entonal Studio                      0x00000001043d1cf8 main + 56
40  dyld                                0x00000001852fbf28 start + 2236

Steps & Code to Reproduce

I'll create a test project if required to reproduce the issue.

Make Realm go vvrrroooommmm

One way to make this code more performant is to use batched writes. Currently, the code performs a write transaction for each object added to the Realm, which can be slow and inefficient for large numbers of objects. By batching writes, we can significantly reduce the number of transactions and improve performance.

NOTE: You'll discover that syncing in batches, and not individual documents can improve performance of realm almost five fold based on use-case, this is more centered around IoT devices and IIoT, and use cases around large quantities of similar data like a meter reader, etc.

Here's an updated version of the code that uses batched writes, as for things iOT especially, performance matters enormously.:

#include <cpprealm/sdk.hpp>

// Define your models like regular structs.
struct Dog: realm::object {
    realm::persisted<std::string> name;
    realm::persisted<int> age;

    static constexpr auto schema = realm::schema("Dog",
                                                 realm::property<&Dog::name>("name"),
                                                 realm::property<&Dog::age>("age"));
};

struct Person: realm::object {
    realm::persisted<std::string> _id;
    realm::persisted<std::string> name;
    realm::persisted<int> age;
    // Create relationships by pointing an Object field to another Class
    realm::persisted<std::optional<Dog>> dog;

    static constexpr auto schema = realm::schema("Person",
                                                 realm::property<&Person::_id, true>("_id"), // primary key
                                                 realm::property<&Person::name>("name"),
                                                 realm::property<&Person::age>("age"),
                                                 realm::property<&Person::dog>("dog"));
};

int main() {
    // Use them like regular objects.
    auto dog = Dog { .name = "Rex", .age = 1 };
    std::cout<<"name of dog: "<<dog.name<<std::endl;

    // Get the default Realm with compile time schema checking.
    auto realm = realm::open<Person, Dog>();

    // Batched writes
    realm.begin_write();
    for (int i = 0; i < 1000; ++i) {
        Dog dog = { .name = "Dog " + std::to_string(i), .age = i };
        realm.add(dog);
    }
    realm.commit_write();

    // Query with type safety.
    auto dogs = realm.objects<Dog>();
    auto adult_dogs = dogs.where([](auto& d) {
        return d.age > 2;
    });
    
    return 0;
}

In this updated version, we use realm.begin_write() to start a write transaction and realm.commit_write() to commit the changes. Inside the transaction, we loop over 1000 dogs and add them to the Realm using realm.add(). This will perform a single transaction for all 1000 dogs, which is much more efficient than performing 1000 transactions.

Additionally, we've added some randomization to the Dog objects to better simulate real-world data. We've also removed the Person object as it was not being used in the code sample.

For the second section of code:

To improve performance, we can move the realm write operation outside of the observer callback. We can also add additional error handling to catch any exceptions that might be thrown during the observer callback.

// Open the default realm.
auto realm = realm::open<Person, Dog>();

// Create a dog in the realm.
auto dog = Dog { .name = "Max" };
realm.write([&realm, &dog] {
    realm.add(dog);
});

// Set up the listener & observe object notifications.
realm::notification_token token = dog.observe<Dog>([](auto&& change) {
    try {
        if (change.error) {
            std::cerr << "An error occurred: " << change.error << std::endl;
        } else if (change.is_deleted) {
            std::cout << "The object was deleted." << std::endl;
        } else {
            auto property = change.get_modifications().front();
            std::cout << "Property " << property.property_name << " changed to " << property.new_value << std::endl;
        }
    } catch (const std::exception& ex) {
        std::cerr << "Error in observer callback: " << ex.what() << std::endl;
    }
});

// Update the dog's name to see the effect.
realm.write([&dog] {
    dog.name = "Wolfie";
});

// Unsubscribe from notifications.
token.unsubscribe();

In addition to moving the realm write operation outside of the observer callback, we've also added a try-catch block to catch any exceptions that might be thrown during the observer callback, and we've added error handling for the observer callback itself. Finally, we've added a call to unsubscribe() to remove the notification token and stop receiving notifications.

To improve the third section of code:
To make this code more performant, you could consider using batched updates instead of updating each car one by one. This would reduce the number of write transactions and can significantly improve performance.

Here's an example that updates all the cars in a single transaction, and changed cars to dogs because dogs are superior:


auto app = realm::App("<app-id>");
auto user = app.login(realm::App::credentials::anonymous()).get_future().get();
auto synced_realm_ref = user.realm<Dog>("foo").get_future().get();
auto realm = synced_realm_ref.resolve();

auto dogs = realm.results<Dog>();
realm.write([&]() {
    for (auto& dog : dogs) {
        dog.bark();
    }
});

// Add error handling
if (realm.is_in_transaction()) {
    try {
        realm.commit_transaction();
    } catch (const std::exception& ex) {
        std::cerr << "Error committing transaction: " << ex.what() << std::endl;
        realm.cancel_transaction();
    }
} else {
    std::cerr << "Error: Realm is not in a write transaction" << std::endl;
}

In addition to this, I added error handling that checks whether the realm is currently in a transaction and handles any errors that might occur when committing the transaction. If an error occurs, the transaction is rolled back and an error message is printed.

`realm::open` creates a Realm file with a `.realm.realm` extension

When opening a Realm using realm::open, the locally-created Realm file ends with .realm.realm. However, opening a Realm using realm::async_open creates a Realm file with .realm extension. This can cause two Realm files to be created when using both methods to open a Realm in the app.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.