realm / realm-cpp

Realm C++
Apache License 2.0
74 stars 17 forks source link

BUILD FAILED Debian 11 #98

Closed fxprime closed 1 year ago

fxprime commented 1 year ago

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

leemaguire commented 1 year ago

Hi @fxprime we are actively looking into this issue. Can you try build from the branch lm/gcc10 in the meantime and see if that solves your issue?

fxprime commented 1 year ago

Hi @fxprime we are actively looking into this issue. Can you try build from the branch lm/gcc10 in the meantime and see if that solves your issue?

Hi Thank you for your replied. I'm here anwser you while it's still building and it take longer time than i thought. Yes It's seem to fix the issue. I will let you know and close this issue after all unit tests pass. Thank you again. Cheers.

fxprime commented 1 year ago

Due to memory constrain issued on Odroid N2+ , i can't finish the build without comment the test part out.

I do some test using this simeple cmake and cpp file

cmake_minimum_required(VERSION 3.15)

project (odroidn2pcmake)

set(CMAKE_CXX_STANDARD 17)
add_executable(odroidn2pcmake helloworld.cpp)

include_directories(/usr/local/include/ ) 
link_directories(/usr/local/lib/)
link_directories(/usr/local/bin/)

target_link_libraries(odroidn2pcmake cpprealm  realm-object-store-dbg realm-sync-dbg realm-dbg realm-parser-dbg z curl uv ssl crypto pthread)

and this

#include <stdio.h>
#include <cpprealm/sdk.hpp>
#include <cpprealm/experimental/sdk.hpp>

namespace realm::experimental {
    struct Todo {
        primary_key<realm::object_id> _id{realm::object_id::generate()};
        std::string name;
        std::string status;
        // The ownerId property stores the user.identifier() of a
        // logged-in user. Omit this property for the non-sync example.
        std::string ownerId;
    };
    REALM_SCHEMA(Todo, _id, name, status, ownerId);
}

int main() {
    printf("Start testing\n");

    auto app = realm::App("APP_ID");
    realm::user mUser = app.login(realm::App::credentials::anonymous()).get();
    auto userId = mUser.identifier();
    auto realm = realm::experimental::db(mUser.flexible_sync_configuration());
    auto subscriptions = realm.subscriptions();
    auto updateSubscriptionSuccess = subscriptions.update([&](realm::mutable_sync_subscription_set &subs) {
        subs.add<realm::experimental::Todo>("todos", [&userId](auto &obj) {
            // For this example, get only Sync_Todo items where the ownerId
            // property value is equal to the userId of the logged-in user.
            return obj.ownerId == userId;
        });
    }).get();
    realm.get_sync_session()->wait_for_download_completion().get();
    realm.refresh(); 

    printf("DD DD\n");
    auto todos = realm.objects<realm::experimental::Todo>();

    printf("Cur object = %d\n", todos.size());
    if (todos.size() == 0) {
        realm.write([&]() {
            auto todoja = realm::experimental::Todo();
            todoja._id = realm::object_id::generate();
            todoja.name = "Espresso";
            todoja.status = "NN";
            auto managed_todoja = realm.add(std::move(todoja)); 
        });
    }

    printf("CC CC\n");
    return 0;
}

All seem work fine. So i'm happy to close this issue. I am grateful for your help. Thank you very much :)