There were two separate issues causing the cross build to fail because
of libopus. One was in cc[1], and the other in
opus-sys/opusic-sys[2].
I've sent PRs for both of those issues. This patch adds Cargo
overrides to have those crates be built from my PR branches instead of
from crates.io.
[1]: https://github.com/alexcrichton/cc-rs/pull/507
[2]: https://github.com/DoumanAsh/opusic-sys/pull/1
---
Cargo.lock | 9 +++++----Cargo.toml | 4 ++++
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
index d7a58617..f7137dff 100644
--- a/Cargo.lock+++ b/Cargo.lock
@@ -362,8 +362,7 @@ checksum = "b9fc62803d62905cdc62628699ef104177bab00250e24e37f70051b440f1d46e"
[[package]]
name = "cc"
version = "1.0.54"
-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311"+source = "git+https://github.com/alyssais/cc-rs?branch=clang_path#9408c761b2a6d314233e2e4782546d8ab4a2cb2a"[[package]]
name = "cesu8"
@@ -1627,8 +1626,10 @@ checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
[[package]]
name = "opusic-sys"
version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "23eea772b9bf5c4ca3e136764299b775f3f21d00997e7543f92cca82bcb49ff1"+source = "git+https://github.com/alyssais/opusic-sys?branch=cross#50cacf1e06b815cb251940b848602ee6a044b755"+dependencies = [+ "cc",+][[package]]
name = "parking_lot"
diff --git a/Cargo.toml b/Cargo.toml
index 98e7f448..4bbfb2b1 100644
--- a/Cargo.toml+++ b/Cargo.toml
@@ -49,3 +49,7 @@ members = [
"clients/linux-cli",
"clients/hubd",
]
++[patch.crates-io]+opusic-sys = { git = "https://github.com/alyssais/opusic-sys", branch = "cross" }+cc = { git = "https://github.com/alyssais/cc-rs", branch = "clang_path" }
\ No newline at end of file
--
2.26.2
There were two separate issues causing the cross build to fail because
of libopus. One was in cc[1], and the other in
opus-sys/opusic-sys[2]. cc doesn't have a new release yet.
opusic-sys does, but it's broken[1]. So use git for now.
[1]: https://github.com/alexcrichton/cc-rs/pull/507
[2]: https://github.com/DoumanAsh/opusic-sys/pull/1
---
v2 uses upstream HEAD rather than my forks, because my PRs were merged.
Cargo.lock | 11 ++++++-----Cargo.toml | 4 ++++
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
index d7a58617..42e762d6 100644
--- a/Cargo.lock+++ b/Cargo.lock
@@ -362,8 +362,7 @@ checksum = "b9fc62803d62905cdc62628699ef104177bab00250e24e37f70051b440f1d46e"
[[package]]
name = "cc"
version = "1.0.54"
-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311"+source = "git+https://github.com/alexcrichton/cc-rs#8f814b3b154807bb4e03407d22fafd1820273a3b"[[package]]
name = "cesu8"
@@ -1626,9 +1625,11 @@ checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
[[package]]
name = "opusic-sys"
-version = "0.2.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "23eea772b9bf5c4ca3e136764299b775f3f21d00997e7543f92cca82bcb49ff1"+version = "0.2.3"+source = "git+https://github.com/DoumanAsh/opusic-sys#4986ecb82dd56cbc01b1bde1268e48e0fcc869af"+dependencies = [+ "cc",+][[package]]
name = "parking_lot"
diff --git a/Cargo.toml b/Cargo.toml
index 98e7f448..6bbe3199 100644
--- a/Cargo.toml+++ b/Cargo.toml
@@ -49,3 +49,7 @@ members = [
"clients/linux-cli",
"clients/hubd",
]
++[patch.crates-io]+opusic-sys = { git = "https://github.com/DoumanAsh/opusic-sys" }+cc = { git = "https://github.com/alexcrichton/cc-rs" }
--
2.26.2
[PATCH v2 3/3] clients/android: install autotools in container
The opus and opus-sys crates are both abandoned. They have recently
been forked into crates called magnum-opus and opusic-sys
respectively.
I've sent some fixes for cross-compiling to the forks, and they've
been accepted and released. It's too early to say whether these forks
will stick around, but it's better than crates that have been
abandoned for years.
---
Since the last version of this patch, a new version of magnum-opus
has been released, which in turn supports a new version of
opusic-sys, which has my cross-compilation fixes in it.
In v2, these fixes were included in patch 2 using a Cargo.toml
[patch], but with this new release that's no longer necessary.
Cargo.lock | 40 +++++++++++++++++------------libqaul/service/voice/Cargo.toml | 2 +-libqaul/service/voice/src/lib.rs | 2 +-libqaul/service/voice/src/types.rs | 2 +-libqaul/service/voice/src/worker.rs | 2 +-
5 files changed, 28 insertions(+), 20 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
index 13365d4c..943a5142 100644
--- a/Cargo.lock+++ b/Cargo.lock
@@ -430,6 +430,15 @@ dependencies = [
"bitflags",
]
+[[package]]+name = "cmake"+version = "0.1.44"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0e56268c17a6248366d66d4a47a3381369d068cce8409bb1716ed77ea32163bb"+dependencies = [+ "cc",+]+[[package]]
name = "combine"
version = "3.8.1"
@@ -1376,6 +1385,16 @@ dependencies = [
"cfg-if",
]
+[[package]]+name = "magnum-opus"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ff49ad2a7313ae476b292c1e1b6bf17ad0542fc1d24880d85d455d8547a3ecc2"+dependencies = [+ "libc",+ "opusic-sys",+]+[[package]]
name = "matchers"
version = "0.0.1"
@@ -1614,23 +1633,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
[[package]]
-name = "opus"-version = "0.2.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5e9059a7daf1e6665eb88c4a95ca9ff393a6d276fd66e9d85191280d7e5ec18b"-dependencies = [- "libc",- "opus-sys",-]--[[package]]-name = "opus-sys"-version = "0.2.1"+name = "opusic-sys"+version = "0.3.0"source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fad8b294f482f7972fa466b1c64d5a564e4ee6975599d80483ee4fa83f25b6ec"+checksum = "a2f96f3537123e0c29418ddfb980d1d73f42fb33151f3544a6215b7e423ee9bf"dependencies = [
- "libc",- "pkg-config",+ "cmake",]
[[package]]
@@ -1856,7 +1864,7 @@ dependencies = [
"failure",
"futures 0.3.5",
"libqaul",
- "opus",+ "magnum-opus", "ratman-harness",
"rubato",
"serde",
diff --git a/libqaul/service/voice/Cargo.toml b/libqaul/service/voice/Cargo.toml
index ee5fdbb0..82577d48 100644
--- a/libqaul/service/voice/Cargo.toml+++ b/libqaul/service/voice/Cargo.toml
@@ -14,7 +14,7 @@ async-std = "1.5"
bincode = "1.0"
failure = "0.1"
futures = "0.3"
-opus = "0.2"+magnum-opus = "0.3.2"rubato = "0.2"
serde = { version = "1.0", features = ["derive"] }
tracing = "0.1"
diff --git a/libqaul/service/voice/src/lib.rs b/libqaul/service/voice/src/lib.rs
index 7c5223d2..260e5cbf 100644
--- a/libqaul/service/voice/src/lib.rs+++ b/libqaul/service/voice/src/lib.rs
@@ -28,7 +28,7 @@ use {
future::{abortable, AbortHandle},
},
libqaul::{error::Error as QaulError, services::ServiceEvent, users::UserAuth, Identity, Qaul},
- opus::{Application, Channels, Encoder},+ magnum_opus::{Application, Channels, Encoder}, rubato::{InterpolationParameters, InterpolationType, SincFixedOut, WindowFunction},
std::{
collections::{BTreeMap, BTreeSet, VecDeque},
diff --git a/libqaul/service/voice/src/types.rs b/libqaul/service/voice/src/types.rs
index 4c376d38..2da671f5 100644
--- a/libqaul/service/voice/src/types.rs+++ b/libqaul/service/voice/src/types.rs
@@ -7,7 +7,7 @@ use {
users::UserAuth,
Identity, Qaul,
},
- opus::{Decoder, Encoder},+ magnum_opus::{Decoder, Encoder}, rubato::SincFixedOut,
serde::{Deserialize, Serialize},
std::{
diff --git a/libqaul/service/voice/src/worker.rs b/libqaul/service/voice/src/worker.rs
index 6447a4bc..ad0fd218 100644
--- a/libqaul/service/voice/src/worker.rs+++ b/libqaul/service/voice/src/worker.rs
@@ -5,7 +5,7 @@ use crate::{
use async_std::{stream::interval, sync::Mutex};
use futures::{sink::SinkExt, stream::StreamExt};
use libqaul::{helpers::TagSet, messages::ID_LEN, Identity};
-use opus::{Channels, Decoder};+use magnum_opus::{Channels, Decoder};use rubato::Resampler;
use std::{
collections::BTreeMap,
--
2.26.2
[PATCH v3 3/3] clients/android: install cmake in container
This is required to build opusic-sys.
---
The previous version of this patch installed automake and libtool
instead, but the newly released version of opusic-sys has switched to
building opus with CMake.
clients/android/Dockerfile | 1 +
1 file changed, 1 insertion(+)
diff --git a/clients/android/Dockerfile b/clients/android/Dockerfile
index e1951d95..0178a92f 100644
--- a/clients/android/Dockerfile+++ b/clients/android/Dockerfile
@@ -43,6 +43,7 @@ RUN apt-get update -qq > /dev/null && \
apt-get install -qq --no-install-recommends \
build-essential \
autoconf \
+ cmake \ curl \
git \
file \
--
2.26.2
cc wasn't detecting the Android toolchain properly, causing a build
failure. I sent a PR with the fix[1], which has been merged, but not
yet been released.
[1]: https://github.com/alexcrichton/cc-rs/pull/507
---
v2 of this patch also patched opusic-sys, but that's no longer
necessary since the latest version of magnum-opus supports a fixed
version of opusic-sys. So now we only need the cc from git.
Cargo.lock | 3 +--Cargo.toml | 3 +++
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
index 943a5142..820732cf 100644
--- a/Cargo.lock+++ b/Cargo.lock
@@ -362,8 +362,7 @@ checksum = "b9fc62803d62905cdc62628699ef104177bab00250e24e37f70051b440f1d46e"
[[package]]
name = "cc"
version = "1.0.54"
-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311"+source = "git+https://github.com/alexcrichton/cc-rs#78596975e2366665e7d44afe81ce4e3d2fc11147"[[package]]
name = "cesu8"
diff --git a/Cargo.toml b/Cargo.toml
index 98e7f448..ab30cd11 100644
--- a/Cargo.toml+++ b/Cargo.toml
@@ -49,3 +49,6 @@ members = [
"clients/linux-cli",
"clients/hubd",
]
++[patch.crates-io]+cc = { git = "https://github.com/alexcrichton/cc-rs" }
--
2.26.2