surrealdb / surrealdb

A scalable, distributed, collaborative, document-graph database, for the realtime web

Home Page:https://surrealdb.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: Rust fails to build surrealdb

miladamery opened this issue · comments

commented

Describe the bug

cargo build fails with this message:

   Compiling rocksdb v0.21.0
   Compiling surrealdb-core v2.0.0-1.5.0
   Compiling surrealdb-core v1.4.2
   Compiling surrealdb v1.5.0
error[E0599]: no method named `with_temporary_directory` found for struct `Datastore` in the current scope
   --> /home/miladamery/.cargo/registry/src/index.crates.io-6f17d22bba15001f/surrealdb-1.5.0/src/api/engine/local/native.rs:156:17
    |
156 |         let kvs = kvs.with_temporary_directory(address.config.temporary_directory);
    | 

Steps to reproduce

cargo.toml

[dependencies]
surrealdb = {version = "1.5.0", features = ["kv-rocksdb"]}
serde = {version = "1.0.201", features = ["derive"]}
tokio = {version = "1.37.0", features = ["full"]}

main.rs

#[tokio::main]
async fn main() -> surrealdb::Result<()> {
    let db = Surreal::new::<RocksDb>("/home/miladamery/Pictures/ds")
        .await?;

    Ok(())
}

Expected behaviour

Build should be successful according to documentation

SurrealDB version

1.5.0

Contact Details

No response

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct

Have the same issue, I am unable to compile my app after update to 1.5.0

I can't build on Rust 1.78.0 ... no matter if use 1.3, 1.4, 1.5 version. For exampole, error

error[E0277]: the trait bound surrealdb_core::err::Error: Fromrevision::Error is not satisfied --> /Users/markocoric/.cargo/registry/src/index.crates.io-6f17d22bba15001f/surrealdb-1.5.0/src/api/engine/remote/ws/mod.rs:176:74

let kvs = kvs.with_temporary_directory(address.config.temporary_directory);

yup, no mater on version you select, this is my cargo build output

   Compiling speedb v0.0.4
   Compiling surrealdb-core v2.0.0-1.5.0
   Compiling surrealdb-core v1.4.2
   Compiling surrealdb v1.5.0
error[E0599]: no method named `with_temporary_directory` found for struct `Datastore` in the current scope
   --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/surrealdb-1.5.0/src/api/engine/local/native.rs:156:17
    |
156 |         let kvs = kvs.with_temporary_directory(address.config.temporary_directory);
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^ method not found in `Datastore`

For more information about this error, try `rustc --explain E0599`.

Screenshot 2024-05-15 at 14 40 16

Hey, for me it builds on Rust 1.78.0-aarch64-apple-darwin with surrealdb = { version = "1.3.1", features = ["kv-rocksdb", "kv-mem"] } , but fails when upgrading surrealdb to the versions above v1.3.1.

When trying to upgrade then downgrade surrealdb (eg. v1.3.1->v1.4.2->v1.3.1), cargo won't be able to downgrade deps' deps, and will continue to output build errors from surrealdb@v1.5.0 (even tho I upgraded to v1.4.2 not v1.5.0 before downgrading to v1.3.1) or else, so you must revert changes to the Cargo.lock (and not simply cargo clean or deleting it, it's weird/sad I know).

When upgrading from surrealdb from v1.3.1 to v1.4.2, cargo build tries to build surrealdb@v1.5.0, which fails with bunch of errors, and I've seen many more differents errors trying to tinker with surrealdb in Cargo.toml, so this log is not "exhaustive" and I also came accross the logs from previous comments.
error[E0599]: no method named `with_temporary_directory` found for struct `Datastore` in the current scope
   --> /Users/nil/.local/share/mise/installs/rust/1.78.0/registry/src/index.crates.io-6f17d22bba15001f/surrealdb-1.5.0/src/api/engine/local/native.rs:156:17
    |
156 |         let kvs = kvs.with_temporary_directory(address.config.temporary_directory);
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^ method not found in `Datastore`

error[E0277]: the trait bound `surrealdb_core::sql::Value: Revisioned` is not satisfied
   --> /Users/nil/.local/share/mise/installs/rust/1.78.0/registry/src/index.crates.io-6f17d22bba15001f/surrealdb-1.5.0/src/api/engine/remote/ws/native.rs:444:12
    |
444 | ...                   #[revisioned(revision = 1)]
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Revisioned` is not implemented for `surrealdb_core::sql::Value`, which is required by `std::option::Option<surrealdb_core::sql::Value>: Revisioned`
    |
    = help: the following other types implement trait `Revisioned`:
              bool
              char
              isize
              i8
              i16
              i32
              i64
              i128
            and 77 others
    = note: required for `std::option::Option<surrealdb_core::sql::Value>` to implement `Revisioned`
    = note: this error originates in the attribute macro `revisioned` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `surrealdb_core::sql::Value: Revisioned` is not satisfied
   --> /Users/nil/.local/share/mise/installs/rust/1.78.0/registry/src/index.crates.io-6f17d22bba15001f/surrealdb-1.5.0/src/api/engine/remote/ws/native.rs:447:17
    |
447 | ...                   id: Option<Value>,
    |                           ^^^^^^^^^^^^^ the trait `Revisioned` is not implemented for `surrealdb_core::sql::Value`, which is required by `std::option::Option<surrealdb_core::sql::Value>: Revisioned`
    |
    = help: the following other types implement trait `Revisioned`:
              bool
              char
              isize
              i8
              i16
              i32
              i64
              i128
            and 77 others
    = note: required for `std::option::Option<surrealdb_core::sql::Value>` to implement `Revisioned`

error[E0277]: the trait bound `surrealdb_core::sql::Value: Revisioned` is not satisfied
  --> /Users/nil/.local/share/mise/installs/rust/1.78.0/registry/src/index.crates.io-6f17d22bba15001f/surrealdb-1.5.0/src/api/engine/remote/ws/mod.rs:94:1
   |
94 | #[revisioned(revision = 1)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Revisioned` is not implemented for `surrealdb_core::sql::Value`
   |
   = help: the following other types implement trait `Revisioned`:
             bool
             char
             isize
             i8
             i16
             i32
             i64
             i128
           and 76 others
   = note: this error originates in the attribute macro `revisioned` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `QueryMethodResponse: Revisioned` is not satisfied
  --> /Users/nil/.local/share/mise/installs/rust/1.78.0/registry/src/index.crates.io-6f17d22bba15001f/surrealdb-1.5.0/src/api/engine/remote/ws/mod.rs:94:1
   |
94 | #[revisioned(revision = 1)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Revisioned` is not implemented for `QueryMethodResponse`, which is required by `Vec<QueryMethodResponse>: Revisioned`
   |
   = help: the following other types implement trait `Revisioned`:
             bool
             char
             isize
             i8
             i16
             i32
             i64
             i128
           and 76 others
   = note: required for `Vec<QueryMethodResponse>` to implement `Revisioned`
   = note: this error originates in the attribute macro `revisioned` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `surrealdb_core::dbs::Notification: Revisioned` is not satisfied
  --> /Users/nil/.local/share/mise/installs/rust/1.78.0/registry/src/index.crates.io-6f17d22bba15001f/surrealdb-1.5.0/src/api/engine/remote/ws/mod.rs:94:1
   |
94 | #[revisioned(revision = 1)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Revisioned` is not implemented for `surrealdb_core::dbs::Notification`
   |
   = help: the following other types implement trait `Revisioned`:
             bool
             char
             isize
             i8
             i16
             i32
             i64
             i128
           and 76 others
   = note: this error originates in the attribute macro `revisioned` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `surrealdb_core::sql::Value: Revisioned` is not satisfied
  --> /Users/nil/.local/share/mise/installs/rust/1.78.0/registry/src/index.crates.io-6f17d22bba15001f/surrealdb-1.5.0/src/api/engine/remote/ws/mod.rs:97:8
   |
97 |     Other(Value),
   |           ^^^^^ the trait `Revisioned` is not implemented for `surrealdb_core::sql::Value`
   |
   = help: the following other types implement trait `Revisioned`:
             bool
             char
             isize
             i8
             i16
             i32
             i64
             i128
           and 76 others

error[E0277]: the trait bound `QueryMethodResponse: Revisioned` is not satisfied
  --> /Users/nil/.local/share/mise/installs/rust/1.78.0/registry/src/index.crates.io-6f17d22bba15001f/surrealdb-1.5.0/src/api/engine/remote/ws/mod.rs:98:8
   |
98 |     Query(Vec<QueryMethodResponse>),
   |           ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Revisioned` is not implemented for `QueryMethodResponse`, which is required by `Vec<QueryMethodResponse>: Revisioned`
   |
   = help: the following other types implement trait `Revisioned`:
             bool
             char
             isize
             i8
             i16
             i32
             i64
             i128
           and 76 others
   = note: required for `Vec<QueryMethodResponse>` to implement `Revisioned`

error[E0277]: the trait bound `surrealdb_core::dbs::Notification: Revisioned` is not satisfied
  --> /Users/nil/.local/share/mise/installs/rust/1.78.0/registry/src/index.crates.io-6f17d22bba15001f/surrealdb-1.5.0/src/api/engine/remote/ws/mod.rs:99:7
   |
99 |     Live(Notification),
   |          ^^^^^^^^^^^^ the trait `Revisioned` is not implemented for `surrealdb_core::dbs::Notification`
   |
   = help: the following other types implement trait `Revisioned`:
             bool
             char
             isize
             i8
             i16
             i32
             i64
             i128
           and 76 others

error[E0277]: the trait bound `surrealdb_core::sql::Value: Revisioned` is not satisfied
   --> /Users/nil/.local/share/mise/installs/rust/1.78.0/registry/src/index.crates.io-6f17d22bba15001f/surrealdb-1.5.0/src/api/engine/remote/ws/mod.rs:154:1
    |
154 | #[revisioned(revision = 1)]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Revisioned` is not implemented for `surrealdb_core::sql::Value`, which is required by `std::option::Option<surrealdb_core::sql::Value>: Revisioned`
    |
    = help: the following other types implement trait `Revisioned`:
              bool
              char
              isize
              i8
              i16
              i32
              i64
              i128
            and 76 others
    = note: required for `std::option::Option<surrealdb_core::sql::Value>` to implement `Revisioned`
    = note: this error originates in the attribute macro `revisioned` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `surrealdb_core::sql::Value: Revisioned` is not satisfied
   --> /Users/nil/.local/share/mise/installs/rust/1.78.0/registry/src/index.crates.io-6f17d22bba15001f/surrealdb-1.5.0/src/api/engine/remote/ws/mod.rs:157:6
    |
157 |     id: Option<Value>,
    |         ^^^^^^^^^^^^^ the trait `Revisioned` is not implemented for `surrealdb_core::sql::Value`, which is required by `std::option::Option<surrealdb_core::sql::Value>: Revisioned`
    |
    = help: the following other types implement trait `Revisioned`:
              bool
              char
              isize
              i8
              i16
              i32
              i64
              i128
            and 76 others
    = note: required for `std::option::Option<surrealdb_core::sql::Value>` to implement `Revisioned`

error[E0599]: no method named `serialize_revisioned` found for reference `&surrealdb_core::sql::Value` in the current scope
   --> /Users/nil/.local/share/mise/installs/rust/1.78.0/registry/src/index.crates.io-6f17d22bba15001f/surrealdb-1.5.0/src/api/engine/remote/ws/mod.rs:164:9
    |
164 |         value.serialize_revisioned(&mut buf).map_err(|error| crate::Error::Db(error.into()))?;
    |               ^^^^^^^^^^^^^^^^^^^^ method not found in `&Value`
    |
    = help: items from traits can only be used if the trait is in scope
help: trait `Revisioned` which provides `serialize_revisioned` is implemented but not in scope; perhaps you want to import it
    |
3   + use revision::Revisioned;
    |

error[E0277]: the trait bound `surrealdb_core::err::Error: From<revision::Error>` is not satisfied
   --> /Users/nil/.local/share/mise/installs/rust/1.78.0/registry/src/index.crates.io-6f17d22bba15001f/surrealdb-1.5.0/src/api/engine/remote/ws/mod.rs:176:74
    |
176 |         return T::deserialize_revisioned(bytes).map_err(|x| crate::Error::Db(x.into()));
    |                                                                                ^^^^ the trait `From<revision::Error>` is not implemented for `surrealdb_core::err::Error`, which is required by `revision::Error: Into<_>`
    |
    = help: the following other types implement trait `From<T>`:
              <surrealdb_core::err::Error as From<echodb::err::Error>>
              <surrealdb_core::err::Error as From<async_channel::SendError<T>>>
              <surrealdb_core::err::Error as From<async_channel::RecvError>>
              <surrealdb_core::err::Error as From<Box<bincode::ErrorKind>>>
              <surrealdb_core::err::Error as From<revision::error::Error>>
              <surrealdb_core::err::Error as From<storekey::decode::Error>>
              <surrealdb_core::err::Error as From<storekey::encode::Error>>
              <surrealdb_core::err::Error as From<surrealdb_jsonwebtoken::errors::Error>>
            and 10 others
    = note: required for `revision::Error` to implement `Into<surrealdb_core::err::Error>`

error[E0599]: no method named `to_cond` found for struct `surrealdb_core::sql::Range` in the current scope
   --> /Users/nil/.local/share/mise/installs/rust/1.78.0/registry/src/index.crates.io-6f17d22bba15001f/surrealdb-1.5.0/src/api/method/live.rs:70:25
    |
70  |                         stmt.cond = range.to_cond();
    |                                           ^^^^^^^ method not found in `Range`
...
142 |     into_future! {}
    |     --------------- in this macro invocation
    |
    = note: this error originates in the macro `into_future` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no method named `to_cond` found for struct `surrealdb_core::sql::Range` in the current scope
   --> /Users/nil/.local/share/mise/installs/rust/1.78.0/registry/src/index.crates.io-6f17d22bba15001f/surrealdb-1.5.0/src/api/method/live.rs:70:25
    |
70  |                         stmt.cond = range.to_cond();
    |                                           ^^^^^^^ method not found in `Range`
...
153 |     into_future! {}
    |     --------------- in this macro invocation
    |
    = note: this error originates in the macro `into_future` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no method named `to_cond` found for struct `surrealdb_core::sql::Range` in the current scope
   --> /Users/nil/.local/share/mise/installs/rust/1.78.0/registry/src/index.crates.io-6f17d22bba15001f/surrealdb-1.5.0/src/api/method/live.rs:70:25
    |
70  |                         stmt.cond = range.to_cond();
    |                                           ^^^^^^^ method not found in `Range`
...
164 |     into_future! {}
    |     --------------- in this macro invocation
    |
    = note: this error originates in the macro `into_future` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no function or associated item named `new` found for struct `surrealdb_core::sql::Range` in the current scope
   --> /Users/nil/.local/share/mise/installs/rust/1.78.0/registry/src/index.crates.io-6f17d22bba15001f/surrealdb-1.5.0/src/api/opt/resource.rs:24:45
    |
24  |             Resource::Table(table) => Ok(sql::Range::new(table.0, range.start, range.end)),
    |                                                      ^^^ function or associated item not found in `Range`
    |
    = help: items from traits can only be used if the trait is implemented and in scope
note: `conn::Connection` defines an item `new`, perhaps you need to implement it
   --> /Users/nil/.local/share/mise/installs/rust/1.78.0/registry/src/index.crates.io-6f17d22bba15001f/surrealdb-1.5.0/src/api/conn.rs:170:1
    |
170 | pub trait Connection: Sized + Send + Sync + 'static {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: there is a method `ne` with a similar name, but with different arguments
   --> /Users/nil/.local/share/mise/installs/rust/1.78.0/toolchains/1.78.0-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs:263:5
    |
263 |     fn ne(&self, other: &Rhs) -> bool {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Some errors have detailed explanations: E0277, E0599.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `surrealdb` (lib) due to 17 previous errors

Working Cargo.toml with Rust 1.78.0-aarch64-apple-darwin

[workspace.dependencies]
surrealdb = { version = "1.3.1", features = ["kv-rocksdb", "kv-mem"] }

🤞💋🤖

Problem confirmed. We're figuring out the best way to solve this. We will provide updates promptly.

same here both on my Arch and ubuntu 22.04 server

same here

I Think it's the problem with kv features

commented

@emmanuel-keller Hi. any idea when your pull request will be merged?

@miladamery It should be merged to the branch 1.x by tomorrow. I will check with the team when it will be released

v1.5.1 is out, the compilation issue should be solved.

Successfully builds after upgrading surrealdb@1.3.1 to surrealdb@1.5.1 and running cargo update 🎉.

commented

After upgrading to surrealdb@1.5.1 compilation issue fixed.
Thank you @emmanuel-keller, Thanks everyone.
Im gona close this issue.