Realm C++ SDK 安装失败

问题描述 投票:0回答:2

我正在尝试使用

cmake
在ubuntu 20.04(gcc,g++版本9.4.0)上安装realm cpp sdk,遵循文档

我从 SDK 名称旁边的

页面
顶部获得了 GIT_TAG,并将其用于我的
CMakeList.txt

cmake_minimum_required(VERSION 3.15)
project(MyRealmCppProject)
set(CMAKE_CXX_STANDARD 17)
Include(FetchContent)
set(REALM_USE_SYSTEM_OPENSSL ON)
FetchContent_Declare(
  cpprealm
  GIT_REPOSITORY https://github.com/realm/realm-cpp.git
  GIT_TAG        5dab867db1e3ed63b1c4aba611991724d16cd0ce
)
FetchContent_MakeAvailable(cpprealm)
add_executable(myApp main.cpp)
target_link_libraries(myApp PRIVATE cpprealm)

看起来

cmake
运行良好,但最后一步
make
导致错误。

...
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

我认为问题可能来自于sdk本身,但我不确定。 我应该怎么做才能成功安装和构建 Realm C++ SDK?

c++ installation cmake realm ubuntu-20.04
2个回答
0
投票

根据我从github问题中得到的信息,据说低于GCC 11和Ubuntu 22.04的任何版本都还没有经过测试。由于我使用的是GCC 9.4.0和Ubuntu 20.04,可能存在兼容性问题(我认为starball说的是对的)。使用

cmake -DREALM_CPP_NO_TESTS=1 ..
阻止 SDK 执行测试应该可以成功构建。

以下代码在构建后成功运行。

#include <cpprealm/sdk.hpp>
#include <iostream> 

using namespace std;

int main(){
    cout << "hello realm" << endl;

    return 0;
}

既然我成功地以这种方式构建了 SDK,我认为这个问题已经得到解答。

但是,我仍然有点担心,因为跳过测试可能无法解决其根本问题。


0
投票

对于旧版本的 SDK,未使用低于 GCC 11 和 Ubuntu 22.04 的任何版本进行测试。您可以尝试将

REALM_CPP_NO_TESTS
设置为真值。前任。将
-DREALM_CPP_NO_TESTS=1
传递给 CMake 配置命令。

对于最新版本的 SDK,显然它支持 GCC 8.3 及更高版本。

另请参阅此问题提出者提出的此问题票

© www.soinside.com 2019 - 2024. All rights reserved.