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

iOS target build complains undefined function bind_device in TCP protocol #178

Open
tiberiumboy opened this issue Jul 27, 2024 · 1 comment

Comments

@tiberiumboy
Copy link

tiberiumboy commented Jul 27, 2024

When compiling for specific target, e.g. aarch64-apple-ios or x86_64-apple-ios, I would get an error message stating that the function call bind_device inside tcp.rs:287:20 doesn't exist, and suggested to use similar name matching bind_device_by_index() instead.

What I'm trying to do is build a library communication between iOS and MacOS using message-io. This is stopping me from building a library build for iOS platform.

However, this doesn't stop me from making a build for MacOS natively. Would love to know if there's a workaround solution to this problem? Thanks in advance,

Error message below:

error[E0599]: no method named 'bind_device' found for struct 'Socket' in the current scope
   --> /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/message-io-0.18.2/src/adapters/tcp.rs:287:20
    |
287 |             socket.bind_device(Some(device.as_bytes()))?;
    |                    ^^^^^^^^^^^
    |
help: there is a method 'bind_device_by_index' with a similar name
    |
287 |             socket.bind_device_by_index(Some(device.as_bytes()))?;
    |                    ~~~~~~~~~~~~~~~~~~~~

For more information about this error, try 'rustc --explain E0599'.
error: could not compile 'message-io' (lib) due to 2 previous errors

MacBook Air M2 | 8 GB | Sonoma 14.5

@lemunozm
Copy link
Owner

Hi! To be honest, I've never tried this on IOS.

The part of the code you refer to is handled by the macos target: https://github.com/lemunozm/message-io/blob/master/src/adapters/tcp.rs#L135

There is a custom behavior for macos, but not for "ios", probably is just that. I think that should be fixed adding something like:

#[cfg(and(target_os = "macos", target_os = "ios"))]

Nevertheless I'm not pretty sure how to specify the ios target. (thread about this: https://users.rust-lang.org/t/target-cfg-target-os-android-or-ios-doesnt-work/41983/5)

I can not test this in an IOS, but I think the solution goes in that direction. If you finally get this working, I'll love to merge a PR with this solution.

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