Hello, 

I have this environment :
Debian 13.2, gcc 14.2.0-19, cmake 3.31.6-2

And I try to compile ignite 3.1.0 cpp client with the following :
git clone https://github.com/apache/ignite-3.git
cd ignite-3 && git checkout 3.1.0
cd /modules/platforms/cpp/
mkdir cmake-build-release && cd cmake-build-release
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . -j8

The build crash with this error :
~/ignite-3/modules/platforms/cpp/ignite/client/detail/cluster_connection.cpp: 
In member function ‘virtual void 
ignite::detail::cluster_connection::on_message_received(uint64_t, 
ignite::bytes_view)’:
~/ignite-3/modules/platforms/cpp/ignite/client/detail/cluster_connection.cpp:171:24:
 error: no matching function for call to 
‘find(std::vector<ignite::uuid>::const_iterator, 
std::vector<ignite::uuid>::const_iterator, ignite::uuid&)’
  171 |     auto it = std::find(cluster_ids.begin(), cluster_ids.end(), 
*current_cluster_id);
      |               
~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I have no ease with c++ ; but asking help to AI, we came up with this, which 
made client compile successfully :
-------------------------------------------------------------------------------
--- a/modules/platforms/cpp/ignite/client/detail/cluster_connection.cpp
+++ b/modules/platforms/cpp/ignite/client/detail/cluster_connection.cpp
@@ -26,6 +26,7 @@
 #include "ignite/protocol/writer.h"
 
 #include <iterator>
+#include <algorithm>
 
 namespace ignite::detail {
 
@@ -168,7 +169,15 @@ void cluster_connection::on_message_received(uint64_t id, 
bytes_view msg) {
     }
 
     const auto &cluster_ids = context.get_cluster_ids();
-    auto it = std::find(cluster_ids.begin(), cluster_ids.end(), 
*current_cluster_id);
+    auto it = cluster_ids.end();
+
+    const ignite::uuid& target = current_cluster_id.value();
+
+    it = std::find_if(cluster_ids.begin(), cluster_ids.end(),
+                        [&target](const ignite::uuid& id) {
+                            return id == target;
+                        });
+
     if (it == cluster_ids.end()) {
         std::stringstream message;
         message << "Node from unknown cluster: current_cluster_id=" << 
*current_cluster_id << ", node_cluster_ids=["
-------------------------------------------------------------------------------

What do you think ? Could this be included upstream, or is there a cleaner way 
to fix the build?

As a background, i am trying to have a golang way to use ignite-3 client. Maybe 
using cgo, or native, we'll see.
I worked on https://github.com/yo000/ignite-go-client and use it in some tools 
with ignite 2.17 instances.
Do you know of any golang work in progress ?

Regards

Reply via email to