noib3 / nvim-oxi

:link: Rust bindings to all things Neovim
https://crates.io/crates/nvim-oxi
MIT License
878 stars 43 forks source link

Trying to compile 0.5.1 on macos and run into issue with serde. #180

Closed SeniorMars closed 2 months ago

SeniorMars commented 2 months ago

Here is the compile error:

   Compiling nvim-oxi-api v0.5.1
error: unknown serde variant attribute `untagged`
  --> /Users/charlie/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/nvim-oxi-api-0.5.1/src/types/window_relative_to.rs:21:13
   |
21 |     #[serde(untagged)]
   |             ^^^^^^^^

error[E0277]: the trait bound `window_relative_to::WindowRelativeTo: buffer::_::_serde::Deserialize<'_>` is not satisfied
    --> /Users/charlie/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/nvim-oxi-api-0.5.1/src/types/window_config.rs:83:19
     |
83   |     pub relative: Option<WindowRelativeTo>,
     |                   ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `buffer::_::_serde::Deserialize<'_>` is not implemented for `window_relative_to::Wi
ndowRelativeTo`, which is required by `std::option::Option<window_relative_to::WindowRelativeTo>: buffer::_::_serde::Deserialize<'_>`
     |
     = help: the following other types implement trait `buffer::_::_serde::Deserialize<'de>`:
               &'a Path
               &'a [u8]
               &'a str
               ()
               (T0, T1)
               (T0, T1, T2)
               (T0, T1, T2, T3)
               (T0, T1, T2, T3, T4)
             and 205 others
     = note: required for `std::option::Option<window_relative_to::WindowRelativeTo>` to implement `buffer::_::_serde::Deserialize<'_>`
note: required by a bound in `next_element`
    --> /Users/charlie/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.159/src/de/mod.rs:1729:12
     |
1727 |     fn next_element<T>(&mut self) -> Result<Option<T>, Self::Error>
     |        ------------ required by a bound in this associated function
1728 |     where
1729 |         T: Deserialize<'de>,
     |            ^^^^^^^^^^^^^^^^ required by this bound in `SeqAccess::next_element`

error[E0277]: the trait bound `window_relative_to::WindowRelativeTo: buffer::_::_serde::Deserialize<'_>` is not satisfied
    --> /Users/charlie/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/nvim-oxi-api-0.5.1/src/types/window_config.rs:83:19
     |
83   |     pub relative: Option<WindowRelativeTo>,
     |                   ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `buffer::_::_serde::Deserialize<'_>` is not implemented for `window_relative_to::Wi
ndowRelativeTo`, which is required by `std::option::Option<window_relative_to::WindowRelativeTo>: buffer::_::_serde::Deserialize<'_>`
     |
     = help: the following other types implement trait `buffer::_::_serde::Deserialize<'de>`:
               &'a Path
               &'a [u8]
               &'a str
               ()
               (T0, T1)
               (T0, T1, T2)
               (T0, T1, T2, T3)
               (T0, T1, T2, T3, T4)
             and 205 others
     = note: required for `std::option::Option<window_relative_to::WindowRelativeTo>` to implement `buffer::_::_serde::Deserialize<'_>`
note: required by a bound in `next_value`
    --> /Users/charlie/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.159/src/de/mod.rs:1868:12
     |
1866 |     fn next_value<V>(&mut self) -> Result<V, Self::Error>
     |        ---------- required by a bound in this associated function
1867 |     where
1868 |         V: Deserialize<'de>,
     |            ^^^^^^^^^^^^^^^^ required by this bound in `MapAccess::next_value`

error[E0277]: the trait bound `window_relative_to::WindowRelativeTo: buffer::_::_serde::Deserialize<'_>` is not satisfied
  --> /Users/charlie/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/nvim-oxi-api-0.5.1/src/types/window_config.rs:18:44
   |
18 | #[derive(Clone, Debug, Default, PartialEq, Deserialize)]
   |                                            ^^^^^^^^^^^ the trait `buffer::_::_serde::Deserialize<'_>` is not implemented for `window_relat
ive_to::WindowRelativeTo`, which is required by `std::option::Option<window_relative_to::WindowRelativeTo>: buffer::_::_serde::Deserialize<'_>`
   |
   = help: the following other types implement trait `buffer::_::_serde::Deserialize<'de>`:
             &'a Path
             &'a [u8]
             &'a str
             ()
             (T0, T1)
             (T0, T1, T2)
             (T0, T1, T2, T3)
             (T0, T1, T2, T3, T4)
           and 205 others
   = note: required for `std::option::Option<window_relative_to::WindowRelativeTo>` to implement `buffer::_::_serde::Deserialize<'_>`
note: required by a bound in `buffer::_::_serde::__private::de::missing_field`
  --> /Users/charlie/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.159/src/private/de.rs:22:8
   |
20 | pub fn missing_field<'de, V, E>(field: &'static str) -> Result<V, E>
   |        ------------- required by a bound in this function
21 | where
22 |     V: Deserialize<'de>,
   |        ^^^^^^^^^^^^^^^^ required by this bound in `missing_field`
   = note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0277`.
error: could not compile `nvim-oxi-api` (lib) due to 4 previous errors

Here is my toml

[package]
name = "render"
version = "0.1.0"
authors = ["SeniorMars <seniormars@rice.edu>"]
edition = "2021"

[lib]
name = "render"
crate-type = ["cdylib"]

[dependencies]
nvim-oxi = {version = "0.5.1", features=["neovim-nightly", "test", "mlua"]}
regex = "1.10.2"
magick_rust = "0.19.1"
serde = { version = "*", features = ["derive"] }
anyhow = "1"
base64 = "0.13"
tempfile = "3.1"

[dev-dependencies]
image = "0.24"

Thank you.

noib3 commented 2 months ago

What Rust version are you using? Can you try cargo cleaning before building?

SeniorMars commented 2 months ago

I fixed it. I think it had to do with serde???

[package]
name = "render"
version = "0.1.0"
authors = ["SeniorMars <seniormars@rice.edu>"]
edition = "2021"

[lib]
name = "render"
crate-type = ["cdylib"]

[dependencies]
nvim-oxi = { version = "0.5.1", features = ["neovim-nightly", "test", "libuv"] }
regex = "1.10.2"
serde = { version = "1.0.203", features = ["derive"] }
anyhow = "1"
base64 = "0.13"
tempfile = "3.1"
# magick_rust = "0.19.1"

[dev-dependencies]
image = "0.24"

I also added this since I was on mac:

λ in ~/PersonalC/render.nvim on main ❯❯ ccat .cargo/config.toml 
[target.x86_64-apple-darwin]
rustflags = [
  "-C", "link-arg=-undefined",
  "-C", "link-arg=dynamic_lookup",
]

[target.aarch64-apple-darwin]
rustflags = [
  "-C", "link-arg=-undefined",
  "-C", "link-arg=dynamic_lookup",
]