Libelektra: Rust bindings only works with path dependency

Created on 29 Nov 2019  ·  4Comments  ·  Source: ElektraInitiative/libelektra

Using dependency from crates.io doesn't work.
I can only use the rust bindings if I compile them in the Elektra proejct first, and then use the compiled (replace macros) directory as a path dependency.

Steps to Reproduce the Problem

# Create a new cargo project
cargo new test-elektra-rs
cd test-elektra-rs
# Add the elektra dependency
echo "elektra = \"0.9\"" >> Cargo.toml
# Build the project
cargo build

Expected Result

Build successful

Actual Result

Error:

error[E0425]: cannot find function `keyIsDirectBelow` in crate `elektra_sys`
   -->CARGO_DIR/registry/src/github.com/elektra-0.9.0/src/readable.rs:231:31
    |
231 |         unsafe { elektra_sys::keyIsDirectBelow(other.as_ref(), self.as_ref()) == 1 }
    |                               ^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `keyIsDirectlyBelow`

error[E0425]: cannot find value `KDB_O_NOCASE` in crate `elektra_sys`
  --> CARGO_DIR/registry/src/github.com/elektra-0.9.0/src/keyset.rs:24:43
   |
24 |         const KDB_O_NOCASE = elektra_sys::KDB_O_NOCASE as elektra_sys::option_t;
   |                                           ^^^^^^^^^^^^ help: a constant with a similar name exists: `KDB_O_NONE`

error[E0425]: cannot find value `KDB_O_WITHOWNER` in crate `elektra_sys`
  --> CARGO_DIR/registry/src/github.com/elektra-0.9.0/src/keyset.rs:26:46
   |
26 |         const KDB_O_WITHOWNER = elektra_sys::KDB_O_WITHOWNER as elektra_sys::option_t;
   |                                              ^^^^^^^^^^^^^^^ not found in `elektra_sys`

error[E0425]: cannot find value `KDB_O_NOALL` in crate `elektra_sys`
  --> CARGO_DIR/registry/src/github.com/elektra-0.9.0/src/keyset.rs:28:42
   |
28 |         const KDB_O_NOALL = elektra_sys::KDB_O_NOALL as elektra_sys::option_t;
   |                                          ^^^^^^^^^^^ help: a constant with a similar name exists: `KDB_O_NONE`

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0425`.
error: could not compile `elektra`.

To learn more, run the command again with --verbose.
lanrust

Most helpful comment

It is working now :)

All 4 comments

Thank you for reporting this problem!

It seems like the binding on crates are not up-to-date or your Elektra is too old. E.g. keyIsDirectBelow was renamed to keyIsDirectlyBelow. It was renamed by the author of the Rust bindings, so maybe he can give us more insight what exactly is wrong here :wink:

Thanks for the report!

Since the latest Elektra release of 0.9.1 I haven't gotten around yet to release the updated bindings to crates.io. So you're probably using rust-bindings 0.9 with Elektra 0.9.1, which is not compatible. I will release the update very soon and then you shouldn't have any problems anymore. I will let you know once it's done.

I just published new elektra and elektra-sys versions to crates.io. Let me know if you have any further problems.

It is working now :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mpranj picture mpranj  ·  3Comments

markus2330 picture markus2330  ·  4Comments

markus2330 picture markus2330  ·  3Comments

markus2330 picture markus2330  ·  4Comments

dominicjaeger picture dominicjaeger  ·  3Comments