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

Build errors on 0.5.1 #116

Closed
wkirby opened this issue Jul 6, 2023 · 7 comments
Closed

Build errors on 0.5.1 #116

wkirby opened this issue Jul 6, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@wkirby
Copy link

wkirby commented Jul 6, 2023

When attempting to install this gem in my rails application, I am getting an error while installing with native extensions. I have installed clang:

root@2dea80f87d08:/app# clang --version
Debian clang version 11.0.1-2
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

And am running ruby 3.1 with RubyGems 3.4:

root@2dea80f87d08:/app# ruby --version
ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [aarch64-linux]
root@2dea80f87d08:/app# rubygems
bash: rubygems: command not found
root@2dea80f87d08:/app# gem --version
3.4.15

Adding the gem to my gemfile and running bundle install results in a rust build error:

Compiling yrb v0.5.1 (/bundle/ruby/3.1.0/gems/y-rb-0.5.1/ext/yrb)
error[E0603]: struct `Subscription` is private
  --> src/yawareness.rs:5:60
   |
5  | use y_sync::awareness::{Awareness, AwarenessUpdate, Event, Subscription};
   |                                                            ^^^^^^^^^^^^ private struct
   |
note: the struct `Subscription` is defined here
  --> /bundle/ruby/3.1.0/gems/y-rb-0.5.1/ext/yrb/.rb-sys/stable/cargo/registry/src/index.crates.io-6f17d22bba15001f/y-sync-0.3.1/src/awareness.rs:10:26
   |
10 | use yrs::{Doc, Observer, Subscription};
   |                          ^^^^^^^^^^^^

error[E0308]: mismatched types
  --> src/utils.rs:24:18
   |
24 |         a.insert(k, v);
   |           ------ ^ expected `Arc<str>`, found `Rc<_>`
   |           |
   |           arguments to this method are incorrect
   |
   = note: expected struct `Arc<str>`
              found struct `Rc<_>`
note: method defined here
  --> /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/collections/hash/map.rs:1103:12

error[E0308]: mismatched types
  --> src/yattrs.rs:26:30
   |
26 |                 attrs.insert(Rc::from(k), avalue);
   |                       ------ ^^^^^^^^^^^ expected `Arc<str>`, found `Rc<_>`
   |                       |
   |                       arguments to this method are incorrect
   |
   = note: expected struct `Arc<str>`
              found struct `Rc<_>`
note: method defined here
  --> /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/collections/hash/map.rs:1103:12

error[E0308]: mismatched types
  --> src/yawareness.rs:69:38
   |
69 |         YAwarenessSubscription::from(subscription)
   |         ---------------------------- ^^^^^^^^^^^^ expected `YAwarenessSubscription`, found `Subscription<Arc<dyn Fn(..., ...)>>`
   |         |
   |         arguments to this function are incorrect
   |
   = note: expected struct `YAwarenessSubscription`
              found struct `Subscription<Arc<(dyn for<'a, 'b> Fn(&'a y_sync::awareness::Awareness, &'b y_sync::awareness::Event) + 'static)>>`
note: associated function defined here
  --> /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/convert/mod.rs:548:8
help: try wrapping the expression in `yawareness::YAwarenessSubscription`
   |
69 |         YAwarenessSubscription::from(yawareness::YAwarenessSubscription(subscription))
   |                                      +++++++++++++++++++++++++++++++++++            +

Some errors have detailed explanations: E0308, E0603.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `yrb` (lib) due to 4 previous errors
make: *** [Makefile:555: target/release/libyrb.so] Error 101

make failed, exit code 2

I'm not sure why this is attempting to build with native extensions in the first place, as far as I'm aware there should be an included binary for my setup. In any case, it seems as though I've installed all the dependencies, but am still unable to build, a use-case which ought to work.

@eliias
Copy link
Collaborator

eliias commented Jul 6, 2023

@wkirby You are right, there should be no build step for most users (it can happen though for various reasons).

What confuses me a fair bit is that you seem to compile against a newer version of y-sync which is the actual reason it fails. The Subscription trait was made private recently and replaced by UpdateSubscription. I just fixed that on main yesterday. Could you do me a favor and try to install the gem from the GitHub repository? If it works I can break a new release.

@wkirby
Copy link
Author

wkirby commented Jul 6, 2023

@eliias sure thing, I'll test that out and come back.

@eliias
Copy link
Collaborator

eliias commented Jul 6, 2023

Ah man, it is the new dependency for sure. It was released as a non-breaking change and I do not pin the patch version here https://github.com/y-crdt/yrb/blob/v0.5.1/ext/yrb/Cargo.toml#L14. Should be y-sync = "=0.3.0" (= is missing). When you have to build, you will get 0.3.1 instead.

@wkirby
Copy link
Author

wkirby commented Jul 6, 2023

@eliias makes sense. Building off of main worked perfectly. I really appreciate your responsiveness!

I'm still curious why I'm building from source at all --- I still think I should be able to hit a bundled binary. Any insights there? I can share anything else you might need about the environment I'm working in.

@eliias
Copy link
Collaborator

eliias commented Jul 6, 2023

I'm still curious why I'm building from source at all --- I still think I should be able to hit a bundled binary. Any insights there? I can share anything else you might need about the environment I'm working in.

I haven't used any ARM 64 Linux builds myself, so it could be related to architecture/platform, but I think this is unlikely.

I don't know what specifically causes the issue here, but I have seen it before when:

I have released 0.5.2 if you want to install from RubyGems again.

@eliias eliias added the bug Something isn't working label Jul 6, 2023
@eliias
Copy link
Collaborator

eliias commented Jul 7, 2023

@wkirby I am going to close this issue. Let me know if you can find anything related to the installation problem (native extension compiling), otherwise I need to figure out how to reproduce.

@eliias eliias closed this as completed Jul 7, 2023
@wkirby
Copy link
Author

wkirby commented Jul 7, 2023

  • A project Gemfile.lock specifically requires the ruby platform

This is it, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants