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

Fix ios and android builds #90

Merged
merged 7 commits into from
Jul 23, 2024

Conversation

kp-mariappan-ramasamy
Copy link

When adding support for async send/recv apis in #87 , ios and android builds got broken with following error

error[E0433]: failed to resolve: use of undeclared crate or module `io`

Root cause:

Both ios and android platform code did not import std::io::self which caused it to fail.

This PR attempts to fix those issues.

Also I have added CI jobs to build Android and iOS targets, to find these issues earlier

Example of test fail without the fix:
https://github.com/kp-mariappan-ramasamy/rust-tun/actions/runs/10058442720/job/27801536723#step:4:95
https://github.com/kp-mariappan-ramasamy/rust-tun/actions/runs/10058442720/job/27801536214#step:4:110

@ssrlive
Copy link
Member

ssrlive commented Jul 23, 2024

Seams good. but please remove the warnings.

 warning: unused imports: `ipaddr_to_sockaddr`, `sockaddr_union`
  --> src/platform/posix/mod.rs:18:27
   |
18 | pub(crate) use sockaddr::{ipaddr_to_sockaddr, sockaddr_union};
   |                           ^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

warning: function `ipaddr_to_sockaddr` is never used
  --> src/platform/posix/sockaddr.rs:63:15
   |
63 | pub unsafe fn ipaddr_to_sockaddr<T>(
   |               ^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

@kp-mariappan-ramasamy kp-mariappan-ramasamy force-pushed the fix-ios-android branch 3 times, most recently from 4a610a0 to f8d7cc1 Compare July 23, 2024 13:46
@kp-mariappan-ramasamy
Copy link
Author

Thanks @ssrlive I have fixed the warnings with android and ios builds. PTAL

Also fixed android and iOS CI job to run clippy properly
I think, this commit 4c7b5c0 may not be needed. But it does not hurt to include those too.

Also please let me know if you want me to rebase commits.

@ssrlive
Copy link
Member

ssrlive commented Jul 23, 2024

OK. Please rebase it.

kp-mariappan-ramasamy and others added 4 commits July 23, 2024 22:02
When adding support for async send/recv apis in tun2proxy#87, ios and android builds got broken with following error

    error[E0433]: failed to resolve: use of undeclared crate or module `io`

Root cause:
Both ios and android platform code did not import std::io::self which caused it to fail.

Updated it to use full path to fix it
Used cargo ndk which makes compiling for android code smoother.
https://github.com/bbqsrc/cargo-ndk
Used cargo-lipo, which helps in compiling for iOS target.
https://github.com/TimNN/cargo-lipo
ssrlive and others added 2 commits July 23, 2024 22:10
Errors:

 warning: unused imports: `ipaddr_to_sockaddr`, `sockaddr_union`
  --> src/platform/posix/mod.rs:18:27
   |
18 | pub(crate) use sockaddr::{ipaddr_to_sockaddr, sockaddr_union};
   |                           ^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

warning: function `ipaddr_to_sockaddr` is never used
  --> src/platform/posix/sockaddr.rs:63:15
   |
63 | pub unsafe fn ipaddr_to_sockaddr<T>(
   |               ^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

error: this expression creates a reference which is immediately dereferenced by the compiler
  --> src/platform/android/mod.rs:29:17
   |
29 |     Device::new(&configuration)
   |                 ^^^^^^^^^^^^^^ help: change this to: `configuration`

error: this expression creates a reference which is immediately dereferenced by the compiler
  --> src/platform/ios/mod.rs:58:17
   |
58 |     Device::new(&configuration)
   |                 ^^^^^^^^^^^^^^ help: change this to: `configuration`
@kp-mariappan-ramasamy
Copy link
Author

@ssrlive Rebased commits for clean history. PTAL

@ssrlive ssrlive merged commit ed0a23a into tun2proxy:v2 Jul 23, 2024
8 checks passed
@ssrlive
Copy link
Member

ssrlive commented Jul 23, 2024

Thanks

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.

2 participants