Skip to content

fix: remove Netlink error variant for Android #17

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

Merged
merged 1 commit into from
Mar 31, 2025

Conversation

link2xt
Copy link
Contributor

@link2xt link2xt commented 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.

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/no-netlink-error branch from 41d6d8b to 315726a Compare March 26, 2025 01:03
@link2xt link2xt changed the title fix: remove Netlink error variant fix: remove Netlink error variant for Android Mar 26, 2025
@n0bot n0bot bot added this to iroh Mar 26, 2025
@github-project-automation github-project-automation bot moved this to 🏗 In progress in iroh Mar 26, 2025
@link2xt
Copy link
Contributor Author

link2xt commented Mar 26, 2025

CI is testing the build for Android, but not the linking of any binary, maybe that is why it was not detected.

@flub
Copy link
Contributor

flub commented Mar 26, 2025

I thought our CI was compiling for android? We need to figure out why that wasn't working.

@dignifiedquire
Copy link
Contributor

hmm, not sure this is the right fix, rtnetlink is used on android, and the regression was in that crate, which is why we pinned to an older version, as the newer versions do not compile on android asfaict.

@link2xt
Copy link
Contributor Author

link2xt commented Mar 26, 2025

The problem is not that it does not compile, but that exporting an error variant from a crate results in the compiler including unused unrelated functions from nix package and stdlib that use C symbols not available on Android. These functions are optimized out in release mode. This is not related to previous problems with new rtnetlink not compiling.

@link2xt
Copy link
Contributor Author

link2xt commented Mar 26, 2025

I thought our CI was compiling for android? We need to figure out why that wasn't working.

CI runs cargo build which is not enough - in the end you also need to link against bionic libc from the NDK and this is where it fails because some libc functions are not available.

@link2xt
Copy link
Contributor Author

link2xt commented Mar 26, 2025

hmm, not sure this is the right fix

I don't think there is a proper fix - sufficiently dumb compiler can throw the whole libc in without removing any unused symbols and then it will not link. But at least this change fixes our setup for now.

@dignifiedquire dignifiedquire merged commit b8eb4ea into n0-computer:main Mar 31, 2025
25 of 26 checks passed
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in iroh Mar 31, 2025
@dignifiedquire
Copy link
Contributor

the state of (handling) android is horrible, so if this works, lets just use it for now

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

Successfully merging this pull request may close these issues.

3 participants