-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rust bindings #238
Comments
The ambition is not just to make bindings, which are pretty trivial, but to make them efficient and familiar to the end user. In the case of Python, our logic was:
Let's start not from automated bindings but by defining what the interface should look like. The 1st point is obvious. Every language has a standard library with associative containers. What about the second and the third? Which packages for Graphs and Docs/Tables do people love the most? Maybe some form of ORM? |
Well, there is always polars, which is widely used in the Rust ecosystem for working with tabular data. Not really sure whether there is a Rust-based alternative for NetworkX, but something I found is gchemol-graph. But I sort of don't get the point in doing it this way though. Why would we possibly sacrifice the performance benefits of ukv and not port the library directly into something like |
|
For C++ binding, this crate provides a better suite of tools for using C++ inside Rust: cxx |
Polars sounds cool. They support Apache Arrow representations, so we must be able to pass the data there without any copies. The only tricky part is remembering that every such table would still be backed by |
As for the Graph interface, there is a package previously called RetworkX, now RustworkX, which also aims to mimic NetworkX interface, reimplementing the algorithms in Rust for in-memory graphs. Their Rust interface looks very similar to Python: let mut g = Graph::new();
let a = g.add_node((0., 0.));
let b = g.add_node((2., 0.));
let c = g.add_node((1., 1.));
let d = g.add_node((0., 2.));
let e = g.add_node((3., 3.));
let f = g.add_node((4., 2.));
g.extend_with_edges(&[
(a, b, 2),
(a, d, 4),
(b, c, 1),
(b, f, 7),
(c, e, 5),
(e, f, 1),
(d, e, 1),
]); Performance-wise, it didn't perform that well in our benchmarks, but it can be a good reference point for API discussions. |
The API |
Exactly the same way as in the C guide: ukv_database_t db { NULL };
ukv_error_t error { NULL };
ukv_database_init_t init {
.db = &db,
.config = "{}",
.error = &error,
};
ukv_database_init(&init); You set it to NULL initially, and then a pointer is written into it by the |
We can use Rust's std::ffi::c_void, which is the equivalent of C void*. If for any reason we would want to convert a variable into a void*, we will do it the following way: let foo = &mut "abc" as *mut _ as *mut std::ffi::c_void; Basically, it converts the mutable reference to a raw mutable pointer (will require an unsafe block when accessing the pointer) with an inferred type and then convert it to a mutable void*. Making it a *const std::ffi::c_void is also possible. |
Add a language bindings and simple database close / open in this PR: #243. Currently have problems with generating bindings on header files with linked files. Have any idea about this issue? @michaelgrigoryan25 |
@chungquantin Edit: Never mind. I think you are relating to including other header files from the include directory in the wrapper.h file like this, right? #include "../include/ukv/db.h"
#include "../include/ukv/ukv.h" // this line creates an error and you most probably get this error: error: failed to run custom build command for `ukv v0.0.1 (/home/_/Public/ukv/rust)`
Caused by:
process didn't exit successfully: `/home/_/Public/ukv/rust/target/debug/build/ukv-a7df0344378206ed/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-changed=wrapper.h
cargo:rustc-link-search=../include/ukv
--- stderr
./../include/ukv/ukv.h:47:10: fatal error: 'ukv/db.h' file not found
Error: ClangDiagnostic("./../include/ukv/ukv.h:47:10: fatal error: 'ukv/db.h' file not found\n") Edit 2: Should be fixed in chungquantin@84b293a. Let me know when you give it a try. Clang needed some arguments to accomplish this: let bindings = bindgen::Builder::default()
.header("./wrapper.h")
.clang_args(&["-I../include", "-I../include/ukv"])
.detect_include_paths(true)
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
.generate()?; |
Great to see your progress, guys! I have created a branch for this line of work - |
I have removed the generated bindings in chungquantin#1 and it will not be tracked in git anymore, @ashvardanian. The PR is still pending though. There should be no need to add anything else to .gitignore after it is successfully merged. |
Great, @michaelgrigoryan25 ! Let's wait for him to merge your updates, and then I will merge his into |
@ashvardanian Sync the update from @michaelgrigoryan25. Changed the merged branch to |
We might have some issues here with the actual functionality with the SDK. As I was writing some unit tests, rewriting and improving some parts of the crate in my fork over at 072e5fc, I started getting some linkage errors when running cargo test. Here is the full stack trace for reference: ukv/rust/src/lib.rs:35: undefined reference to `ukv_database_init'
collect2: error: ld returned 1 exit status
= note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
= note: use the `-l` flag to specify native libraries to link
= note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/ca
rgo/reference/build-scripts.html#cargorustc-link-libkindname)
error: could not compile `ukv` due to previous error cargo check and cargo build will not output any errors, however; these errors will be present at the time when the end user adds the crate and actually starts using it. I believe we will need a The actual code of the unit test is pretty straightforward. I thought something like this might happen, so I have kept it simple stupid. You can find it here. |
As it is a native library it must be compiled and linked. So the CMake build should be called before building Rust extension. Is it a good practice to use relative import paths in Rust? Especially for parent directories? It is generally considered a code-smell in most languages. PS: We can schedule a short sync-up call one of the next days to synchronize work, if that would help. Ping me on Discord if it sounds useful. |
Thanks for your input, @ashvardanian! You are right. In that case, we can either use the cmake crate or just execute the build command specified in the documentation via std::process::Command, @chungquantin. By the way, after cmake-ing and make-ing, what is the location and the filename of the ukv library in
I would not say that it is absolutely discouraged, but generally speaking, folks usually prefer to use an environment variable or an absolute path instead of a relative one. Doing it this way also works. Current changes to build.rs in my fork are temporary. I have already prepared a function which would get the parent directory without manually specifying it as |
@michaelgrigoryan25 you have found exactly what you need. UKV has a number of compilation options (check the beginning of CMakeLists.txt), depending on which it will compile one or more libraries. Depending on the one you pick - you will get a different backend:
|
For some reason I am getting some errors related to OpenSSL when cmake-ing: [ 94%] Built target rocksdb
CMake Error at CMakeLists.txt:810 (add_dependencies):
The dependency target "OpenSSL::Crypto" of target "arrow_dependencies" does
not exist.
CMake Error at CMakeLists.txt:810 (add_dependencies):
The dependency target "OpenSSL::SSL" of target "arrow_dependencies" does
not exist.
[ 94%] Built target ukv_embedded_leveldb
[ 94%] Building CXX object CMakeFiles/ukv_embedded_rocksdb.dir/src/engine_rocksdb.cpp.o
[ 94%] Building CXX object CMakeFiles/ukv_embedded_rocksdb.dir/src/modality_docs.cpp.o
[ 96%] Building CXX object CMakeFiles/ukv_embedded_rocksdb.dir/src/modality_vectors.cpp.o
[ 96%] Building CXX object CMakeFiles/ukv_embedded_rocksdb.dir/src/modality_paths.cpp.o
[ 96%] Building CXX object CMakeFiles/ukv_embedded_rocksdb.dir/src/modality_graph.cpp.o
CMake Error at cmake_modules/ThirdpartyToolchain.cmake:3853 (set_target_properties):
The link interface of target "gRPC::grpc" contains:
OpenSSL::SSL
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
Call Stack (most recent call first):
cmake_modules/ThirdpartyToolchain.cmake:171 (build_grpc)
cmake_modules/ThirdpartyToolchain.cmake:278 (build_dependency)
cmake_modules/ThirdpartyToolchain.cmake:3915 (resolve_dependency)
CMakeLists.txt:496 (include)
CMake Error at cmake_modules/BuildUtils.cmake:283 (target_link_libraries):
Target "arrow_objlib" links to:
OpenSSL::Crypto
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
Call Stack (most recent call first):
src/arrow/CMakeLists.txt:580 (add_arrow_lib)
CMake Error at cmake_modules/BuildUtils.cmake:441 (target_link_libraries):
Target "arrow_static" links to:
OpenSSL::Crypto
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
Call Stack (most recent call first):
src/arrow/CMakeLists.txt:580 (add_arrow_lib)
CMake Error at cmake_modules/BuildUtils.cmake:283 (target_link_libraries):
Target "arrow_dataset_objlib" links to:
OpenSSL::Crypto
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
Call Stack (most recent call first):
src/arrow/dataset/CMakeLists.txt:62 (add_arrow_lib)
CMake Error at cmake_modules/BuildUtils.cmake:441 (target_link_libraries):
Target "arrow_dataset_static" links to:
OpenSSL::Crypto
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
Call Stack (most recent call first):
src/arrow/dataset/CMakeLists.txt:62 (add_arrow_lib)
CMake Error at cmake_modules/BuildUtils.cmake:283 (target_link_libraries):
Target "parquet_objlib" links to:
OpenSSL::Crypto
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
Call Stack (most recent call first):
src/parquet/CMakeLists.txt:245 (add_arrow_lib)
CMake Error at cmake_modules/BuildUtils.cmake:441 (target_link_libraries):
Target "parquet_static" links to:
OpenSSL::Crypto
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
Call Stack (most recent call first):
src/parquet/CMakeLists.txt:245 (add_arrow_lib)
-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.
make[2]: *** [CMakeFiles/Arrow-external.dir/build.make:92: _deps/arrow-stamp/Arrow-external-configure] Error 1
make[1]: *** [CMakeFiles/Makefile2:280: CMakeFiles/Arrow-external.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 96%] Linking CXX static library build/lib/libukv_embedded_rocksdb.a
[ 96%] Built target ukv_embedded_rocksdb
make: *** [Makefile:136: all] Error 2 One thing I can say for sure is that all the required dependencies are installed. Here is the output from running Linux archlinux 5.15.90-1-lts #1 SMP Tue, 24 Jan 2023 12:46:03 +0000 x86_64 GNU/Linux |
@michaelgrigoryan25 You need to have openssl libs installed on your system. |
Thanks for your input, @ishkhan42. OpenSSL was fully installed on my system before cmake-ing. For reference, here is the OpenSSL package in Arch package registry https://archlinux.org/packages/core/x86_64/openssl/. ➜ ~ sudo find / -name libcrypto.so
/usr/lib/libcrypto.so
/usr/lib/openssl-1.1/libcrypto.so
/usr/lib32/libcrypto.so
➜ ~ sudo find / -name libssl.so
/usr/lib/libssl.so
/usr/lib/openssl-1.1/libssl.so
/usr/lib32/libssl.so |
I faced similar issue when building on cent os, the issue was resolved by building latest(3.0.7) openssl libs from source.
|
Thanks, @ishkhan42! That worked like a charm (though I had to do it from the live CD). I think having a specific version of OpenSSL should definitely be addressed in the documentation. Now we have another issue, though. The compilation fails due to an error in the code. Here is the full stack trace: cmake \
-DUKV_BUILD_ENGINE_UMEM=1 \
-DUKV_BUILD_ENGINE_LEVELDB=1 \
-DUKV_BUILD_ENGINE_ROCKSDB=1 \
-DUKV_BUILD_TESTS=0 \
-DUKV_BUILD_BENCHMARKS=0 \
-DUKV_BUILD_API_FLIGHT_CLIENT=1 \
-DUKV_BUILD_API_FLIGHT_SERVER=1 \
-B ./build_release && \
make -j8 -C ./build_release
........
........
........
In file included from /_/_/_/ukv/src/engine_umem.cpp:26:
/_/_/_/ukv/build_release/_deps/ucset-src/include/ucset/consistent_avl.hpp: In constructor ‘unum::ucset::avl_tree_gt<entry_at, comparator_at, node_allocator_at>::avl_tree_gt(unum::ucset::avl_tree_gt<entry_at, comparator_at, node_allocator_at>&&)’:
/_/_/_/ukv/build_release/_deps/ucset-src/include/ucset/consistent_avl.hpp:583:22: error: ‘exchange’ is not a member of ‘std’
583 | : root_(std::exchange(other.root_, nullptr)), size_(std::exchange(other.size_, 0)) {}
| ^~~~~~~~
compilation terminated due to -Wfatal-errors.
make[2]: *** [CMakeFiles/ukv_embedded_umem.dir/build.make:76: CMakeFiles/ukv_embedded_umem.dir/src/engine_umem.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:310: CMakeFiles/ukv_embedded_umem.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[100%] Linking CXX static library build/lib/libukv_flight_client.a
[100%] Built target ukv_flight_client
[100%] Linking CXX executable build/bin/ukv_flight_server_rocksdb
[100%] Linking CXX executable build/bin/ukv_flight_server_leveldb
[100%] Built target ukv_flight_server_leveldb
[100%] Built target ukv_flight_server_rocksdb
make: *** [Makefile:136: all] Error 2 If there is a commit from the main branch which fixes this, maybe we will be able to merge the changes from there. |
@michaelgrigoryan25, which compiler are you using? These commits would fix your current issue:
Both are on on |
Thanks, I will try. I used |
Ok, I synced everything, removed the build cache completely via rm -rf $(cat .gitignore), and tried building again. Now, there is a new error. Here is the new stack trace: [100%] Built target ukv_flight_client
[100%] Built target ukv_flight_server_leveldb
[100%] Built target ukv_flight_server_rocksdb
In file included from /_/_/_/ukv/src/engine_umem.cpp:28:
/_/_/_/ukv/build_release/_deps/ucset-src/include/ucset/consistent_set.hpp: In instantiation of ‘unum::ucset::status_t unum::ucset::consistent_set_gt<element_at, comparator_at, allocator_at>::upsert(element_t&&) [with element_at = pair_t; comparator_at = pair_compare_t; allocator_at = std::allocator<unsigned char>; element_t = pair_t]’:
/_/_/_/ukv/build_release/_deps/ucset-src/include/ucset/locked.hpp:133:32: required from ‘unum::ucset::status_t unum::ucset::locked_gt<collection_at, shared_mutex_at>::upsert(element_t&&) [with collection_at = unum::ucset::consistent_set_gt<pair_t, pair_compare_t>; shared_mutex_at = std::shared_mutex; element_t = pair_t]’
/_/_/_/ukv/src/engine_umem.cpp:410:42: required from here
/_/_/_/ukv/build_release/_deps/ucset-src/include/ucset/consistent_set.hpp:474:18: error: cannot convert ‘unum::ucset::consistent_set_gt<pair_t, pair_compare_t>::element_t’ {aka ‘pair_t’} to ‘bool’ in initialization
474 | bool exists = element;
| ^~~~~~
compilation terminated due to -Wfatal-errors.
make[2]: *** [CMakeFiles/ukv_embedded_umem.dir/build.make:76: CMakeFiles/ukv_embedded_umem.dir/src/engine_umem.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:310: CMakeFiles/ukv_embedded_umem.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
make: Leaving directory '/_/_/_/ukv/build_release' |
We haven't had such issues, at least mot lately. Can you please try with the most recent version? |
I'm not sure whether this is an issue with divergent branches or not, but I have tried merging both main and dev (separately) into 238-rust-bindings, and still, nothing worked. I have the same issue with the same error message. I have checked the upstream branches too, and the issue is present there also (both in main and dev branches). Here is the full command: cmake \
-DUKV_BUILD_ENGINE_UMEM=1 \
-DUKV_BUILD_ENGINE_LEVELDB=1 \
-DUKV_BUILD_ENGINE_ROCKSDB=1 \
-DUKV_BUILD_TESTS=0 \
-DUKV_BUILD_BENCHMARKS=0 \
-DUKV_BUILD_API_FLIGHT_CLIENT=1 \
-DUKV_BUILD_API_FLIGHT_SERVER=1 \
-B ./build_release && \
make -j8 -C ./build_release |
Thanks to unum-cloud/ucset@9634e35 by @DarvinHarutyunyan , this shouldn't be an issue anymore. |
Thanks; that fixed the issue. I have made some updates to the fork, and now there are some other issues. This time, it is related to the actual linkage process and I believe has nothing to do with the source code. @chungquantin, do you mind having a look? I might be missing something here, though I have made sure that all the headers and libraries are being found and copied correctly. There are missing type definitions, though everything should technically be in place. Here is the full stack trace: ➜ rust (238-rust-bindings) RUST_BACKTRACE=full cargo build
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:115:44: warning: declaration of 'struct ArrowSchema' will not be visible outside of this function [-Wvisibility]
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:116:35: error: incomplete definition of type 'struct ArrowSchema'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:115:44: note: forward declaration of 'struct ArrowSchema'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:117:43: error: incomplete definition of type 'struct ArrowSchema'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:115:44: note: forward declaration of 'struct ArrowSchema'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:118:27: error: incomplete definition of type 'struct ArrowSchema'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:115:44: note: forward declaration of 'struct ArrowSchema'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:119:18: error: incomplete definition of type 'struct ArrowSchema'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:115:44: note: forward declaration of 'struct ArrowSchema'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:122:16: error: incomplete definition of type 'struct ArrowSchema'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:115:44: note: forward declaration of 'struct ArrowSchema'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:123:11: error: incomplete definition of type 'struct ArrowSchema'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:115:44: note: forward declaration of 'struct ArrowSchema'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:126:43: warning: declaration of 'struct ArrowArray' will not be visible outside of this function [-Wvisibility]
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:128:34: error: incomplete definition of type 'struct ArrowArray'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:126:43: note: forward declaration of 'struct ArrowArray'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:129:41: error: incomplete definition of type 'struct ArrowArray'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:126:43: note: forward declaration of 'struct ArrowArray'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:130:27: error: incomplete definition of type 'struct ArrowArray'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:126:43: note: forward declaration of 'struct ArrowArray'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:131:18: error: incomplete definition of type 'struct ArrowArray'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:126:43: note: forward declaration of 'struct ArrowArray'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:134:15: error: incomplete definition of type 'struct ArrowArray'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:126:43: note: forward declaration of 'struct ArrowArray'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:140:15: error: incomplete definition of type 'struct ArrowArray'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:126:43: note: forward declaration of 'struct ArrowArray'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:141:10: error: incomplete definition of type 'struct ArrowArray'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:126:43: note: forward declaration of 'struct ArrowArray'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:152:12: warning: declaration of 'struct ArrowSchema' will not be visible outside of this function [-Wvisibility]
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:153:12: warning: declaration of 'struct ArrowArray' will not be visible outside of this function [-Wvisibility]
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:157:11: error: incomplete definition of type 'struct ArrowSchema'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:152:12: note: forward declaration of 'struct ArrowSchema'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:158:11: error: incomplete definition of type 'struct ArrowSchema'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:152:12: note: forward declaration of 'struct ArrowSchema'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:159:11: error: incomplete definition of type 'struct ArrowSchema'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:152:12: note: forward declaration of 'struct ArrowSchema'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:160:11: error: incomplete definition of type 'struct ArrowSchema'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:152:12: note: forward declaration of 'struct ArrowSchema'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:161:11: error: incomplete definition of type 'struct ArrowSchema'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:152:12: note: forward declaration of 'struct ArrowSchema'
/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:161:26: error: use of undeclared identifier 'static_cast'
fatal error: too many errors emitted, stopping now [-ferror-limit=]
clang diag: /home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:115:44: warning: declaration of 'struct ArrowSchema' will not be visible outside of this function [-Wvisibility]
clang diag: /home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:126:43: warning: declaration of 'struct ArrowArray' will not be visible outside of this function [-Wvisibility]
clang diag: /home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:152:12: warning: declaration of 'struct ArrowSchema' will not be visible outside of this function [-Wvisibility]
clang diag: /home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:153:12: warning: declaration of 'struct ArrowArray' will not be visible outside of this function [-Wvisibility]
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ClangDiagnostic("/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:116:35: error: incomplete definition of type 'struct ArrowSchema'\n/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:117:43: error: incomplete definition of type 'struct ArrowSchema'\n/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:118:27: error: incomplete definition of type 'struct ArrowSchema'\n/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:119:18: error: incomplete definition of type 'struct ArrowSchema'\n/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:122:16: error: incomplete definition of type 'struct ArrowSchema'\n/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:123:11: error: incomplete definition of type 'struct ArrowSchema'\n/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:128:34: error: incomplete definition of type 'struct ArrowArray'\n/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:129:41: error: incomplete definition of type 'struct ArrowArray'\n/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:130:27: error: incomplete definition of type 'struct ArrowArray'\n/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:131:18: error: incomplete definition of type 'struct ArrowArray'\n/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:134:15: error: incomplete definition of type 'struct ArrowArray'\n/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:140:15: error: incomplete definition of type 'struct ArrowArray'\n/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:141:10: error: incomplete definition of type 'struct ArrowArray'\n/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:157:11: error: incomplete definition of type 'struct ArrowSchema'\n/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:158:11: error: incomplete definition of type 'struct ArrowSchema'\n/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:159:11: error: incomplete definition of type 'struct ArrowSchema'\n/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:160:11: error: incomplete definition of type 'struct ArrowSchema'\n/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:161:11: error: incomplete definition of type 'struct ArrowSchema'\n/home/michael/Public/ukv/rust/target/debug/build/ukv-2e2dbccf3761473d/out/include/ukv/arrow.h:161:26: error: use of undeclared identifier 'static_cast'\nfatal error: too many errors emitted, stopping now [-ferror-limit=]\n")', build.rs:121:10
stack backtrace:
0: 0x5653d70b9f20 - std::backtrace_rs::backtrace::libunwind::trace::h1d00f3fcf4cb5ac4
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x5653d70b9f20 - std::backtrace_rs::backtrace::trace_unsynchronized::h920a6ff332484ee2
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x5653d70b9f20 - std::sys_common::backtrace::_print_fmt::hd7323920c925af6d
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/sys_common/backtrace.rs:65:5
3: 0x5653d70b9f20 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h3155a8c966b4beb5
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/sys_common/backtrace.rs:44:22
4: 0x5653d70dff1e - core::fmt::write::h062c617411b691df
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/core/src/fmt/mod.rs:1209:17
5: 0x5653d70b6825 - std::io::Write::write_fmt::hb61fdf1275c61e1c
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/io/mod.rs:1682:15
6: 0x5653d70b9ce5 - std::sys_common::backtrace::_print::hd1b4d9664ab500e0
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/sys_common/backtrace.rs:47:5
7: 0x5653d70b9ce5 - std::sys_common::backtrace::print::hca896ae22beb06cb
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/sys_common/backtrace.rs:34:9
8: 0x5653d70bb70f - std::panicking::default_hook::{{closure}}::h0b5eeed5cf36ab5f
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/panicking.rs:267:22
9: 0x5653d70bb44a - std::panicking::default_hook::h8932b573145a321b
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/panicking.rs:286:9
10: 0x5653d70bbe08 - std::panicking::rust_panic_with_hook::h4b1447a24e3e94f8
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/panicking.rs:688:13
11: 0x5653d70bbba7 - std::panicking::begin_panic_handler::{{closure}}::h8701da9995a3820c
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/panicking.rs:579:13
12: 0x5653d70ba3cc - std::sys_common::backtrace::__rust_end_short_backtrace::hb696c5ed02a01598
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/sys_common/backtrace.rs:137:18
13: 0x5653d70bb8c2 - rust_begin_unwind
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/panicking.rs:575:5
14: 0x5653d6a017f3 - core::panicking::panic_fmt::h8aa706a976963c88
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/core/src/panicking.rs:65:14
15: 0x5653d6a01ab3 - core::result::unwrap_failed::h065c02f906ca4578
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/core/src/result.rs:1791:5
16: 0x5653d6a066a3 - core::result::Result<T,E>::unwrap::h9c1ee5421678b8d4
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/core/src/result.rs:1113:23
17: 0x5653d6a0c76a - build_script_build::main::hd4d164b9115e89a9
at /home/michael/Public/ukv/rust/build.rs:113:17
18: 0x5653d6a0836b - core::ops::function::FnOnce::call_once::hff8de126c623a6bc
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/core/src/ops/function.rs:251:5
19: 0x5653d6a06c8e - std::sys_common::backtrace::__rust_begin_short_backtrace::h3d313fc59180980b
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/sys_common/backtrace.rs:121:18
20: 0x5653d6a0c9d1 - std::rt::lang_start::{{closure}}::hba524146af18b1f5
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/rt.rs:166:18
21: 0x5653d70b1f1b - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h8cbb48ae40ddb046
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/core/src/ops/function.rs:286:13
22: 0x5653d70b1f1b - std::panicking::try::do_call::h92db802eb38b49b7
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/panicking.rs:483:40
23: 0x5653d70b1f1b - std::panicking::try::ha8949d2082cf3644
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/panicking.rs:447:19
24: 0x5653d70b1f1b - std::panic::catch_unwind::h5e34c1f8a5992ed9
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/panic.rs:137:14
25: 0x5653d70b1f1b - std::rt::lang_start_internal::{{closure}}::hea52a0bb3f8ff16a
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/rt.rs:148:48
26: 0x5653d70b1f1b - std::panicking::try::do_call::h5bc358faf3d68a8b
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/panicking.rs:483:40
27: 0x5653d70b1f1b - std::panicking::try::h675304212928379d
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/panicking.rs:447:19
28: 0x5653d70b1f1b - std::panic::catch_unwind::h7ce3ad349ed5c844
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/panic.rs:137:14
29: 0x5653d70b1f1b - std::rt::lang_start_internal::hcd7e45acd25ab5ab
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/rt.rs:148:20
30: 0x5653d6a0c9aa - std::rt::lang_start::h0de8d1c6eb995290
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/rt.rs:165:17
31: 0x5653d6a0c96e - main
32: 0x7f7c32575290 - <unknown>
33: 0x7f7c3257534a - __libc_start_main
34: 0x5653d6a01c95 - _start
35: 0x0 - <unknown> |
@michaelgrigoryan25 my bad. I used C++ keywords in a C header in UKV. I just pushed an update: 8babde0 |
Thanks. Let me quickly pull the changes and try again. |
That did not seem to work, @ashvardanian.
EditJust had a look into the arrow header, and noticed some things which might be related. The ArrowArray and other definitions are placed in an |
I have just fixed a minor thing there, and here is my result on your fork, @michaelgrigoryan25 : ~/Code/ukv-michaelgrigoryan25/rust$ cargo build
Compiling ukv v0.0.1 (/home/av/Code/ukv-michaelgrigoryan25/rust)
warning: `extern` block uses type `u128`, which is not FFI-safe
--> /home/av/Code/ukv-michaelgrigoryan25/rust/target/debug/build/ukv-fa09c7ad5ebf9a1c/out/bindings.rs:4685:7
|
4685 | ) -> u128;
| ^^^^ not FFI-safe
|
= note: 128-bit integers don't currently have a known stable ABI
= note: `#[warn(improper_ctypes)]` on by default
warning: `extern` block uses type `u128`, which is not FFI-safe
--> /home/av/Code/ukv-michaelgrigoryan25/rust/target/debug/build/ukv-fa09c7ad5ebf9a1c/out/bindings.rs:6080:12
|
6080 | __value: u128,
| ^^^^ not FFI-safe
|
= note: 128-bit integers don't currently have a known stable ABI
warning: `extern` block uses type `u128`, which is not FFI-safe
--> /home/av/Code/ukv-michaelgrigoryan25/rust/target/debug/build/ukv-fa09c7ad5ebf9a1c/out/bindings.rs:6088:12
|
6088 | __value: u128,
| ^^^^ not FFI-safe
|
= note: 128-bit integers don't currently have a known stable ABI
warning: `extern` block uses type `u128`, which is not FFI-safe
--> /home/av/Code/ukv-michaelgrigoryan25/rust/target/debug/build/ukv-fa09c7ad5ebf9a1c/out/bindings.rs:6096:12
|
6096 | __value: u128,
| ^^^^ not FFI-safe
|
= note: 128-bit integers don't currently have a known stable ABI
warning: `extern` block uses type `u128`, which is not FFI-safe
--> /home/av/Code/ukv-michaelgrigoryan25/rust/target/debug/build/ukv-fa09c7ad5ebf9a1c/out/bindings.rs:6123:12
|
6123 | __value: u128,
| ^^^^ not FFI-safe
|
= note: 128-bit integers don't currently have a known stable ABI
warning: `extern` block uses type `u128`, which is not FFI-safe
--> /home/av/Code/ukv-michaelgrigoryan25/rust/target/debug/build/ukv-fa09c7ad5ebf9a1c/out/bindings.rs:6133:12
|
6133 | __value: u128,
| ^^^^ not FFI-safe
|
= note: 128-bit integers don't currently have a known stable ABI
warning: `ukv` (lib) generated 6 warnings
Finished dev [unoptimized + debuginfo] target(s) in 6.92s |
That's great @ashvardanian, seems like everything now started working! Just to be 100% sure, could you try running |
@michaelgrigoryan25 I am getting a pretty generic Rust error - |
Sure. Are you using an IDE which automatically builds Rust projects? You'd usually get such a message when another build process is running for the same project. |
@michaelgrigoryan25 I am trying both ways, will let you know once I have results. |
I am receiving a linker error. I guess the path to binaries is wrong, @michaelgrigoryan25 = note: /home/linuxbrew/.linuxbrew/bin/ld: cannot find -lukv_embedded_umem: No such file or directory
collect2: error: ld returned 1 exit status |
OK. Can you try replacing the 80th line of build.rs with the following code, @ashvardanian: println!("cargo:rustc-link-search=native={}/build/build/lib", dst.display()) |
Yes, @michaelgrigoryan25 it helped! Now I get a ton of other undefined references. Please check out the bundled builds with the |
That's great to hear, @ashvardanian! Since I am not able to completely reproduce your environment (I still get the errors), could you try adding the following to the .define("UKV_BUILD_BUNDLES", ENABLED) Hope this helps. EditWe have had some discussions in the Discord server which have successfully led us to identifying the source of the issue which is currently being investigated.
This should be fixed after a patch is applied for #307. |
Rust may become one of the core officially maintained interfaces, but we still need an implementation proposal. A potential candidate for this job can find guidelines and recommendations for new bindings in our docs here. If you have questions or recommendations for that interface - as anyone on Discord or one of the maintainers here.
The text was updated successfully, but these errors were encountered: