Skip to content
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

Open
ashvardanian opened this issue Jan 22, 2023 · 45 comments
Open

Rust bindings #238

ashvardanian opened this issue Jan 22, 2023 · 45 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@ashvardanian
Copy link
Contributor

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.

@michaelgrigoryan25
Copy link

michaelgrigoryan25 commented Jan 26, 2023

This is doable for the most part. We can automatically generate raw bindings from ukv's C/C++ code base (or the SDK if it exists) either via the bindgen or cbindgen crates. From there, we can work towards implementing an additional safety layer.

@ashvardanian
Copy link
Contributor Author

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:

  1. Everyone knows how to work with dict, so our binary collections should have the same interfaces as dict[int, str].
  2. Pandas is the most popular package for tabular data, so our tabular interface mimics that.
  3. NetworkX is the most popular package for graphs, so our graph interface mimics that.

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?

@chungquantin

@michaelgrigoryan25
Copy link

michaelgrigoryan25 commented Jan 26, 2023

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 ukv-sys (Rust library with raw bindings) and then use it for creating ukv (the actual Rust library with Rust-friendly bindings using ukv-sys under-the-hood) which would provide a Rust-y interface to native ukv?

@chungquantin
Copy link

  1. For Pandas, Rust developers usually use this package Polars instead. Will see if we can convert between these two packages. Building a whole tabular interface can be duplicate

@chungquantin
Copy link

For C++ binding, this crate provides a better suite of tools for using C++ inside Rust: cxx
The difference between cxx and cbindgen / bindgen is that the later is more native but produces many unexpected bugs while the former allows doing FFI without unsafe mode.

@ashvardanian
Copy link
Contributor Author

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 ukv_arena_t and must be borrowed together. There should be a way to describe that logic in the bindings, but I am not sure how exactly. I will try to learn some Rust as we go :)

@ashvardanian
Copy link
Contributor Author

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.

@chungquantin
Copy link

The API ukv_database_init_t() have a field database which has type ukv_database_t. This type is opaque type void and as I understand, this is a pointer to the underlying storage. Hence, what is the way to initialize it?

@ashvardanian
Copy link
Contributor Author

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 ukv_database_init function call. Classic ANSI C.

@michaelgrigoryan25
Copy link

michaelgrigoryan25 commented Jan 26, 2023

The API ukv_database_init_t() have a field database which has type ukv_database_t. This type is opaque type void and as I understand, this is a pointer to the underlying storage. Hence, what is the way to initialize it?

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.

@chungquantin
Copy link

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

@michaelgrigoryan25
Copy link

michaelgrigoryan25 commented Jan 27, 2023

@chungquantin I did not really experience any issues during the build process, however, I have made some improvements in chungquantin#1. Let me know if I'm missing something here, because everything ran perfectly fine for me. There were some warnings about the code style because of the generated bindings, but I have made sure to address those too in the PR.

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()?;

@ashvardanian
Copy link
Contributor Author

Great to see your progress, guys! I have created a branch for this line of work - 238-rust-bindings. @chungquantin let's change your pull request to merge into this new branch. I am also curious if rust/src/ukv/bindings.rs should be included into .gitignore?

@michaelgrigoryan25
Copy link

michaelgrigoryan25 commented Jan 27, 2023

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.

@ashvardanian
Copy link
Contributor Author

Great, @michaelgrigoryan25 ! Let's wait for him to merge your updates, and then I will merge his into 238-rust-bindings.

@chungquantin
Copy link

@ashvardanian Sync the update from @michaelgrigoryan25. Changed the merged branch to 238-rust-bindings

@michaelgrigoryan25
Copy link

michaelgrigoryan25 commented Jan 27, 2023

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 .a or a .o file to successfully perform the process, and to do this, we might need cc as a build dependency if there is no direct way of building the library from the parent directory. @ashvardanian, @chungquantin, do you have any other ideas on how we can approach this issue?

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.

@ashvardanian
Copy link
Contributor Author

ashvardanian commented Jan 27, 2023

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.

@michaelgrigoryan25
Copy link

michaelgrigoryan25 commented Jan 27, 2023

As it is a native library it must be compiled and linked. So the CMake build should be called before building Rust extension.

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 build_release? I followed the documentation at https://unum.cloud/ukv/install.html and tried looking for them in build_release/lib and build_release/build/lib, but only found libbenchmark.a libbenchmark_main.a libfmt.a libleveldb.a librocksdb.a libsimdjson.a libukv_embedded_leveldb.a libukv_embedded_rocksdb.a libyyjson.a.

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.

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

@ashvardanian
Copy link
Contributor Author

@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:

  • libukv_embedded_umem
  • libukv_embedded_leveldb
  • libukv_embedded_rocksdb
  • libukv_flight_client

@michaelgrigoryan25
Copy link

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 uname -a if that is relevant:

Linux archlinux 5.15.90-1-lts #1 SMP Tue, 24 Jan 2023 12:46:03 +0000 x86_64 GNU/Linux

@ashvardanian
Copy link
Contributor Author

@ishkhan42

@ishkhan42
Copy link
Contributor

@michaelgrigoryan25 You need to have openssl libs installed on your system.

@michaelgrigoryan25
Copy link

michaelgrigoryan25 commented Jan 31, 2023

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

@ishkhan42
Copy link
Contributor

ishkhan42 commented Jan 31, 2023

I faced similar issue when building on cent os, the issue was resolved by building latest(3.0.7) openssl libs from source.
Below are the build instructions I used
Note the last 2 lines are required, you can try that, maybe that will be enough in your case

cd /usr/src && wget https://www.openssl.org/source/openssl-3.0.7.tar.gz
tar -zxf openssl-3.0.7.tar.gz && rm openssl-3.0.7.tar.gz && cd /usr/src/openssl-3.0.7
./config && make -j16 && make install
ln -s /usr/local/lib64/libssl.so.3 /usr/lib64/libssl.so.3
ln -s /usr/local/lib64/libcrypto.so.3 /usr/lib64/libcrypto.so.3

@michaelgrigoryan25
Copy link

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.

@ashvardanian
Copy link
Contributor Author

ashvardanian commented Jan 31, 2023

@michaelgrigoryan25, which compiler are you using? These commits would fix your current issue:

Both are on on main branches.

@michaelgrigoryan25
Copy link

michaelgrigoryan25 commented Jan 31, 2023

Thanks, I will try. I used gcc (GCC) 12.2.1 20230111 to compile this project specifically.

@michaelgrigoryan25
Copy link

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'

@ashvardanian
Copy link
Contributor Author

We haven't had such issues, at least mot lately. Can you please try with the most recent version?

@michaelgrigoryan25
Copy link

michaelgrigoryan25 commented Feb 2, 2023

We haven't had such issues, at least not lately. Can you please try 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

@ashvardanian
Copy link
Contributor Author

Thanks to unum-cloud/ucset@9634e35 by @DarvinHarutyunyan , this shouldn't be an issue anymore.

@michaelgrigoryan25
Copy link

michaelgrigoryan25 commented Feb 3, 2023

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>

@ashvardanian
Copy link
Contributor Author

@michaelgrigoryan25 my bad. I used C++ keywords in a C header in UKV. I just pushed an update: 8babde0

@michaelgrigoryan25
Copy link

Thanks. Let me quickly pull the changes and try again.

@michaelgrigoryan25
Copy link

michaelgrigoryan25 commented Feb 3, 2023

That did not seem to work, @ashvardanian. Maybe the issue comes from declarations such as the struct ArrowSchema*, which will need to be replaced with just ArrowSchema*?

  /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:162: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'
  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:162:11: error: incomplete definition of type 'struct ArrowSchema'\nfatal error: too many errors emitted, stopping now [-ferror-limit=]\n")', build.rs:121:10
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Edit

Just had a look into the arrow header, and noticed some things which might be related. The ArrowArray and other definitions are placed in an ifndef block which might not be invoked properly. It is possible that this is one of the reasons why the compilation fails. Here is a list:

@ashvardanian
Copy link
Contributor Author

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

@michaelgrigoryan25
Copy link

That's great @ashvardanian, seems like everything now started working! Just to be 100% sure, could you try running cargo test and see whether all the tests pass? Thanks.

@ashvardanian
Copy link
Contributor Author

@michaelgrigoryan25 I am getting a pretty generic Rust error - Blocking waiting for file lock on build directory. Had tried cleaning the cargo registry, and rebuilding the package, but still can't run the tests. Can you please also try on your end? I would recommend fetching updates from origin/dev before trying.

@michaelgrigoryan25
Copy link

michaelgrigoryan25 commented Feb 13, 2023

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.

@ashvardanian
Copy link
Contributor Author

@michaelgrigoryan25 I am trying both ways, will let you know once I have results.

@ashvardanian
Copy link
Contributor Author

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

@michaelgrigoryan25
Copy link

michaelgrigoryan25 commented Feb 13, 2023

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())

@ashvardanian
Copy link
Contributor Author

Yes, @michaelgrigoryan25 it helped! Now I get a ton of other undefined references. Please check out the bundled builds with the UKV_BUILD_BUNDLES option we use for GoLang and Java. It must help.

@michaelgrigoryan25
Copy link

michaelgrigoryan25 commented Feb 13, 2023

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 dst variable before the .build invocation:

.define("UKV_BUILD_BUNDLES", ENABLED)

Hope this helps.

Edit

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
No open projects
Status: No status
Development

When branches are created from issues, their pull requests are automatically linked.

4 participants