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 issue on Ubuntu #2

Closed
l0calh05t opened this issue Sep 27, 2020 · 14 comments
Closed

Build issue on Ubuntu #2

l0calh05t opened this issue Sep 27, 2020 · 14 comments

Comments

@l0calh05t
Copy link
Contributor

First off, thank you for a great project! I have been meaning to try something similar too. However, I have run into several issues with the build process on Ubuntu (WSL, actually):

Building aa_standalone fails with

   Compiling midir v0.6.2 (https://github.com/bgaster/midir#0bc86b9a)
error[E0308]: mismatched types
   --> /home/xxxxxxxx/.cargo/git/checkouts/midir-eba5c0209c46141b/0bc86b9/src/backend/alsa/mod.rs:654:45
    |
654 |             Err(ref e) if e.errno() == Some(self::nix::errno::Errno::ENOSPC) => {
    |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `nix::errno::consts::Errno`, found enum `backend::alsa::nix::errno::Errno`
    |
    = note: perhaps two different versions of crate `nix` are being used?

error[E0308]: mismatched types
   --> /home/xxxxxxxx/.cargo/git/checkouts/midir-eba5c0209c46141b/0bc86b9/src/backend/alsa/mod.rs:658:45
    |
658 |             Err(ref e) if e.errno() == Some(self::nix::errno::Errno::EAGAIN) => {
    |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `nix::errno::consts::Errno`, found enum `backend::alsa::nix::errno::Errno`
    |
    = note: perhaps two different versions of crate `nix` are being used?

error: aborting due to 2 previous errors

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

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

Since midir (and all other git-dependencies for that matter) are included without a commit and aa_wasmtime is referenced by relative path instead of a repository, these dependencies may have gotten out of sync. As a solution, I would suggest adding a specific revision like so:

[dependencies]
rand = { git = "https://github.com/rust-lang-nursery/rand.git", rev = "9f35b8e" }

As you probably have a combination that works, it would be great if you could tag the specific revisions that work for you, thanks!

@bgaster
Copy link
Owner

bgaster commented Sep 27, 2020

thanks!

i've updated the Cargo.toml to point at the aa_wasmtime on git, so hopefully it should address that issue. sorry about that.

I've not tried to build on WSL. Generally, I work on Mac OS, but will dust of bootcamp/WSL tomorrow and take a look at finding a revision that works.

@bgaster
Copy link
Owner

bgaster commented Sep 28, 2020

I found that nix 0.15 is needed due to a different crate needing that. This all worked fine and once I'd got XServer and so on installed the standalone app ran, however, sadly there is another issue.

The problem is that currently portaudio requires an ALSA driver, but it seems that WSL only uses PulseAudio! Do you have this working?

@l0calh05t
Copy link
Contributor Author

TBH, I was in the "try to get it to build, worry about running it later" stage. WSL is usually fine for building stuff, but running with actual hardware works better in a "real" VM. It seems ALSA is still not supported on WSL 2 (microsoft/WSL#5816) and the only efforts I found to get pulseaudio into portaudio are very dead (https://github.com/bkgood/portaudio-pulseaudio, https://github.com/illuusio/portaudio-pulseaudio).

@bgaster
Copy link
Owner

bgaster commented Sep 28, 2020

I think WSL is going to be a pain, for now at least, but would native Windows be OK? I'm resolving an issue with it working fully on WIndows 10, but it seems mostly to be there and so hopefully have a working build in the next day or so.

@l0calh05t
Copy link
Contributor Author

l0calh05t commented Sep 29, 2020

W.r.t. running definitely, but building should be identical to other Linux systems. Windows 10 build worked for me, but didn't run either (crash), but not sure yet if it was a user error or not

@bgaster
Copy link
Owner

bgaster commented Sep 29, 2020

One of the issues on Windows 10 is that Portaudio wrapper panics when it fails, which is really a pain, and I hit it when I did not have an ASIO driver for my default Mac sound card. Once I'd worked around that issue, then it runs without crashing, but some of the interfaces require Edge for handing the JS and so it fails with that. The webview crate can be compiled to use Edge and that is where I got to last night. There is still an issue with some of the interfaces and I'll get to that in the next day. (Sorry, I know that Windows is a bit of 2nd class case for me, as I don't generally use it.)

As for Linux/WSL, the build should now be fine and assuing Portaudio works no the partucular Linux platform it should work fine, of course, that does not address the WSL 2 lack of audio support beyond Pulseaudio, which is a real pain.

@l0calh05t
Copy link
Contributor Author

l0calh05t commented Sep 29, 2020

Tried a pull & build and I am still getting the same error. Did you fix it on a branch or forget to push?

W.r.t. Audio, I hope Microsoft will fix this at some point (they are working on full GUI support, and GPU support with NVIDIA, so it may just be a matter of time)

@bgaster
Copy link
Owner

bgaster commented Sep 29, 2020

Hmm that is strange, looking at https://github.com/bgaster/midir/blob/master/Cargo.toml, it references nix = 0.15, which was required for it to build.

@bgaster
Copy link
Owner

bgaster commented Sep 29, 2020

I have the audio side of things all working on windows now, but still issues with Edge and rendering certain canvas objects with web-view.

@l0calh05t
Copy link
Contributor Author

l0calh05t commented Sep 29, 2020

Hmm that is strange, looking at https://github.com/bgaster/midir/blob/master/Cargo.toml, it references nix = 0.15, which was required for it to build.

aa_standalone's Cargo.lock still references source = "git+https://github.com/bgaster/midir#0bc86b9a82e422b0995243731bd4f1f5ead243e6", so you probably need to either a) remove it / update it or b) add an explicit rev to your git dependencies as originally suggested. (I'll prepare a quick PR)

I tried deleting my local Cargo.lock but that just lead to build errors elsewhere 😕

@bgaster
Copy link
Owner

bgaster commented Sep 29, 2020

ahh... try now.

@l0calh05t
Copy link
Contributor Author

While this (currently) works (my errors were just a massive number of missing dependencies) binaries really should have their Cargo.lock in version control: https://doc.rust-lang.org/cargo/faq.html#why-do-binaries-have-cargolock-in-version-control-but-not-libraries

@bgaster
Copy link
Owner

bgaster commented Sep 29, 2020

Yes, this is a very good point. I've really only just started to get this whole thing working and so I've been a bit behind on that. Once managed to sort out this Edge issue, and happy(ish) that it works on Windows, then I'll add a Cargo.lock and go from there.

@l0calh05t
Copy link
Contributor Author

With the merge I'll consider this closed for now. Windows is a separate issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants