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

chore: update iroh from 0.33.0 to 0.34.0 #6687

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

link2xt
Copy link
Collaborator

@link2xt link2xt commented Mar 20, 2025

No description provided.

@link2xt
Copy link
Collaborator Author

link2xt commented Mar 20, 2025

@dignifiedquire @flub What is the transition plan for raw keys? I enable tls_x509 for now, does it mean that it is not compatible with iroh clients that is not using tls_x509 and we have to keep this indefinitely, or can we drop it after a few releases and have a smooth transition?

EDIT: the answer is that tls_x509 is not compatible to tls_raw_public_keys, we just keep using tls_x509 and at some point (e.g. iroh 1.0 breaking compatibility anyway) we can switch to tls_raw_public_keys. DCBACKUP3 scheme will use raw keys.

@link2xt link2xt requested review from Hocuri and Septias March 24, 2025 18:00
@Hocuri
Copy link
Collaborator

Hocuri commented Mar 25, 2025

When I try to build this for Android, I get the following error:

$ ./ndk-make.sh
warning: Git tree '/home/user/Development/deltachat-android' is dirty
starting time: Tue Mar 25 12:24:31 CET 2025
Setting CARGO_TARGET environment variables.
Quick debug build that will produce a slower app. DO NOT UPLOAD THE APK ANYWHERE.
/home/user/Development/deltachat-android/jni
/home/user/Development/deltachat-android/jni/deltachat-core-rust
-- cross compiling to aarch64-linux-android (arm64) --
    Finished `dev` profile [optimized] target(s) in 0.32s
-- ndk-build --
[arm64-v8a] SharedLibrary  : libnative-utils.so
ld.lld: error: undefined symbol: preadv
>>> referenced by weak.rs:168 (std/src/sys/pal/unix/weak.rs:168)
>>>               std-993242cf06a7b510.std.5a80935b0be77383-cgu.0.rcgu.o:(_$LT$std..fs..File$u20$as$u20$std..os..unix..fs..FileExt$GT$::read_vectored_at::hab075818bf071fad) in archive jni/arm64-v8a/libdeltachat.a
>>> referenced by weak.rs:168 (std/src/sys/pal/unix/weak.rs:168)
>>>               std-993242cf06a7b510.std.5a80935b0be77383-cgu.0.rcgu.o:(_$LT$std..fs..File$u20$as$u20$std..os..unix..fs..FileExt$GT$::read_vectored_at::hab075818bf071fad) in archive jni/arm64-v8a/libdeltachat.a
>>> referenced by weak.rs:169 (std/src/sys/pal/unix/weak.rs:169)
>>>               std-993242cf06a7b510.std.5a80935b0be77383-cgu.0.rcgu.o:(_$LT$std..fs..File$u20$as$u20$std..os..unix..fs..FileExt$GT$::read_vectored_at::hab075818bf071fad) in archive jni/arm64-v8a/libdeltachat.a
>>> referenced 4 more times
>>> did you mean: readv
>>> defined in: /nix/store/r7v7as0l7a2asrh6m15avrmjsnf72spa-ndk-27-2-12479018-27.2.12479018/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/lib/aarch64-linux-android/21/libc.so

ld.lld: error: undefined symbol: pwritev
>>> referenced by weak.rs:168 (std/src/sys/pal/unix/weak.rs:168)
>>>               std-993242cf06a7b510.std.5a80935b0be77383-cgu.0.rcgu.o:(_$LT$std..fs..File$u20$as$u20$std..os..unix..fs..FileExt$GT$::write_vectored_at::h8f497cf1b2446893) in archive jni/arm64-v8a/libdeltachat.a
>>> referenced by weak.rs:168 (std/src/sys/pal/unix/weak.rs:168)
>>>               std-993242cf06a7b510.std.5a80935b0be77383-cgu.0.rcgu.o:(_$LT$std..fs..File$u20$as$u20$std..os..unix..fs..FileExt$GT$::write_vectored_at::h8f497cf1b2446893) in archive jni/arm64-v8a/libdeltachat.a
>>> referenced by weak.rs:169 (std/src/sys/pal/unix/weak.rs:169)
>>>               std-993242cf06a7b510.std.5a80935b0be77383-cgu.0.rcgu.o:(_$LT$std..fs..File$u20$as$u20$std..os..unix..fs..FileExt$GT$::write_vectored_at::h8f497cf1b2446893) in archive jni/arm64-v8a/libdeltachat.a
>>> referenced 4 more times

ld.lld: error: undefined symbol: process_vm_writev
>>> referenced by nix.2ab134c738ef5a9-cgu.3
>>>               nix-ff443a8fa36385d6.nix.2ab134c738ef5a9-cgu.3.rcgu.o:(nix::sys::uio::process_vm_writev::h212ec9fb4e353a69) in archive jni/arm64-v8a/libdeltachat.a

ld.lld: error: undefined symbol: process_vm_readv
>>> referenced by nix.2ab134c738ef5a9-cgu.3
>>>               nix-ff443a8fa36385d6.nix.2ab134c738ef5a9-cgu.3.rcgu.o:(nix::sys::uio::process_vm_readv::h2396be9a216dccc4) in archive jni/arm64-v8a/libdeltachat.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/nix/store/r7v7as0l7a2asrh6m15avrmjsnf72spa-ndk-27-2-12479018-27.2.12479018/build/core/build-binary.mk:661: obj/local/arm64-v8a/libnative-utils.so] Error 1

@link2xt
Copy link
Collaborator Author

link2xt commented Mar 25, 2025

For me it compiles successfully. I am using NDK that is pinned in the nix flake.

EDIT: scripts/ndk-make.sh --debug arm64-v8a (with debug) fails after this update and succeeds before.

process_vm_readv and process_vm_writev were added in rust-lang/libc#1878 and nix-rust/nix#1557, quite some time ago. They are not available on Android 5, but this has not been causing us problems so far.

The changes in dependencies are replacing backoff with backon and addition of gloo-timers.

nix-ff443a8fa36385d6 is the version nix 0.26.4 according to ./aarch64-linux-android/debug/deps/nix-ff443a8fa36385d6.d
It is used by rtnetlink 0.13.1, all other dependencies use different versions of nix in our Cargo.lock.

So iroh probably started using something from rtnetlink 0.13.1 that was not used before.

netwatch 0.4.0 depends on both rtnetlink 0.13.1 and rtnetlink 0.14.1. It was already the case with previous netwatch and it did not compile, so it is some user of netwatch that results in addition of more code to the binary.

netwatch depends on rtnetlink 0.13.1 on Android because of rust-netlink/rtnetlink#83:
https://github.com/n0-computer/net-tools/blob/5bc90c98121e6462d8b0f98cd65a2140d1fcf332/netwatch/Cargo.toml#L58-L62

Inside of nix 0.26.4 process_vm_readv is not called at all, it is a public API that is not used internally: https://docs.rs/nix/0.26.4/nix/sys/uio/fn.process_vm_readv.html

rtnetlink 0.13.1 also does not call process_vm_readv, so it got compiled in for no good reason.

Maybe the problem is portmapper 0.4.0 that pulled in code from rtnetlink with this change that happened between 0.3.1 and 0.4.0:
n0-computer/net-tools@c82d4e4


I bisected iroh to the commit that broke the build: n0-computer/iroh@7acfe39

This commit updated netwatch from 0.3 to 0.4 and portmapper from 0.3 to 0.4.

@link2xt
Copy link
Collaborator Author

link2xt commented Mar 26, 2025

In the end I did this.

Cloned iroh-gossip, checked out tag v0.34.0 (96173fd30934a49021a015a97b90fe43d5c88969), patched:

diff --git a/Cargo.toml b/Cargo.toml
index d75a009..10975bf 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -52,7 +52,7 @@ anyhow = { version = "1", optional = true }
 futures-lite = { version = "2.3", optional = true }
 futures-concurrency = { version = "7.6.1", optional = true }
 futures-util = { version = "0.3.30", optional = true }
-iroh = { version = "0.34", default-features = false, optional = true }
+iroh = { path = "../iroh/iroh", default-features = false, optional = true }
 tokio = { version = "1", optional = true, features = ["io-util", "sync"] }
 tokio-util = { version = "0.7.12", optional = true, features = ["codec"] }
 tracing = "0.1"
@@ -69,7 +69,7 @@ clap = { version = "4", features = ["derive"], optional = true }
 [dev-dependencies]
 tokio = { version = "1", features = ["io-util", "sync", "rt", "macros", "net", "fs"] }
 clap = { version = "4", features = ["derive"] }
-iroh = { version = "0.34", default-features = false, features = ["metrics", "test-utils"] }
+iroh = { path = "../iroh/iroh", default-features = false, features = ["metrics", "test-utils"] }
 rand_chacha = "0.3.1"
 testresult = "0.4.1"
 tracing-subscriber = { version = "0.3", features = ["env-filter"] }

Cloned iroh, checkout out v0.34.0, patched:

diff --git a/iroh-net-report/Cargo.toml b/iroh-net-report/Cargo.toml
index 3d690a866..4a310f5d4 100644
--- a/iroh-net-report/Cargo.toml
+++ b/iroh-net-report/Cargo.toml
@@ -41,8 +41,8 @@ url = { version = "2.4" }
 # non-wasm-in-browser dependencies
 [target.'cfg(not(all(target_family = "wasm", target_os = "unknown")))'.dependencies]
 hickory-resolver = "=0.25.0-alpha.5"
-netwatch = { version = "0.4" }
-portmapper = { version = "0.4", default-features = false }
+netwatch = { path = "../../net-tools/netwatch" }
+portmapper = { path = "../../net-tools/portmapper", default-features = false }
 surge-ping = "0.8.0"

 [dev-dependencies]
diff --git a/iroh/Cargo.toml b/iroh/Cargo.toml
index 2564b21fe..ba33728e3 100644
--- a/iroh/Cargo.toml
+++ b/iroh/Cargo.toml
@@ -43,7 +43,7 @@ http = "1"
 iroh-base = { version = "0.34.0", default-features = false, features = ["key", "relay"], path = "../iroh-base" }
 iroh-relay = { version = "0.34", path = "../iroh-relay", default-features = false }
 n0-future = "0.1.2"
-netwatch = { version = "0.4" }
+netwatch = { path = "../../net-tools/netwatch" }
 pin-project = "1"
 pkarr = { version = "2", default-features = false, features = [
     "async",
@@ -103,7 +103,7 @@ parse-size = { version = "=1.0.0", optional = true } # pinned version to avoid b
 hickory-resolver = { version = "=0.25.0-alpha.5" }
 igd-next = { version = "0.15.1", features = ["aio_tokio"] }
 netdev = { version = "0.31.0" }
-portmapper = { version = "0.4", default-features = false }
+portmapper = { path = "../../net-tools/portmapper", default-features = false }
 quinn = { package = "iroh-quinn", version = "0.13.0", default-features = false, features = ["platform-verifier", "runtime-tokio", "rustls-ring"] }
 tokio = { version = "1", features = [
     "io-util",

Cloned net-tools, checked out 5bc90c98121e6462d8b0f98cd65a2140d1fcf332 (tag portmapper-v0.4.1), patched:

diff --git a/netwatch/src/interfaces/linux.rs b/netwatch/src/interfaces/linux.rs
index 4d5c117..65c6d82 100644
--- a/netwatch/src/interfaces/linux.rs
+++ b/netwatch/src/interfaces/linux.rs
@@ -25,8 +25,6 @@ pub enum Error {
     MissingDestinationField,
     #[error("mask field is missing")]
     MissingMaskField,
-    #[error("netlink")]
-    Netlink(#[from] rtnetlink::Error),
 }

 pub async fn default_route() -> Option<DefaultRouteDetails> {

And now it compiles on Android with --debug.
So the problem was indeed
n0-computer/net-tools@c82d4e4

link2xt added a commit to link2xt/net-tools that referenced this pull request Mar 26, 2025
This fixes compilation of Delta Chat
in debug mode
for Android 5 (API level 21) using NDK 27.
Without this change symbols like
`process_vm_writev` which are not
actually used are pulled in
and break linking step.
They are only optimized out
in release mode.

See <chatmail/core#6687>
for details.
@link2xt
Copy link
Collaborator Author

link2xt commented Mar 26, 2025

Made a PR with a fix: n0-computer/net-tools#17

link2xt added a commit to link2xt/net-tools that referenced this pull request Mar 26, 2025
This fixes compilation of Delta Chat
in debug mode
for Android 5 (API level 21) using NDK 27.
Without this change symbols like
`process_vm_writev` which are not
actually used are pulled in
and break linking step.
They are only optimized out
in release mode.

See <chatmail/core#6687>
for details.
Copy link
Collaborator

@Hocuri Hocuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm now that this a) compiles and b) a backup transfer between this and DC Desktop 1.56.0 (core v1.157.3) works fine in both direction.

What does not work is transferring the backup if the laptop is in the phone's Wi-Fi hotspot. This also doesn't work with the the latest Android release (1.56.0, core v1.157.3) & the latest Desktop release, so it's not introduced by the PR here. But this used to work in the past and we recommend it in the FAQ, so we need to investigate why it doesn't work anymore.

Not sure if we should merge this already rather than wait for the fix to be released, you are free to decide.

dignifiedquire pushed a commit to n0-computer/net-tools that referenced this pull request Mar 31, 2025
This fixes compilation of Delta Chat
in debug mode
for Android 5 (API level 21) using NDK 27.
Without this change symbols like
`process_vm_writev` which are not
actually used are pulled in
and break linking step.
They are only optimized out
in release mode.

See <chatmail/core#6687>
for details.
@link2xt link2xt force-pushed the link2xt/iroh-34 branch 2 times, most recently from 17d5324 to 63ece62 Compare April 6, 2025 08:01
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

Successfully merging this pull request may close these issues.

3 participants