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

Phoenix.Channels: WatchOS and tvOS support #37

Closed
KronicDeth opened this issue Jul 21, 2023 · 2 comments · Fixed by #84
Closed

Phoenix.Channels: WatchOS and tvOS support #37

KronicDeth opened this issue Jul 21, 2023 · 2 comments · Fixed by #84
Assignees
Labels
LIVEVIEWNATIVE CLIENTS LiveViewNative Clients Core issues label

Comments

@KronicDeth
Copy link
Contributor

socket2 does not have support for watchos, so the cargo make xcframework in liveview-native-core fails because it can't buld

[cargo-make] INFO - Execute Command: "rustup" "run" "nightly" "cargo" "build" "-Z" "build-std" "--target" "arm64_32-apple-watchos" "--target" "armv7k-apple-watchos" "--target" "aarch64-apple-watchos-sim" "--target" "x86_64-apple-watchos-sim" "-p" "liveview-native-core"
   Compiling thiserror v1.0.43
   Compiling serde v1.0.171
   Compiling httparse v1.8.0
   Compiling num_cpus v1.16.0
   Compiling socket2 v0.4.9
   Compiling mio v0.8.8
   Compiling signal-hook-registry v1.4.1
   Compiling log v0.4.19
   Compiling utf-8 v0.7.6
   Compiling base64 v0.13.1
error[E0063]: missing field `sin_len` in initializer of `sockaddr_in`
   --> /Users/kronic.deth/.cargo/registry/src/index.crates.io-6f17d22bba15001f/socket2-0.4.9/src/sockaddr.rs:225:27
    |
225 |         let sockaddr_in = sockaddr_in {
    |                           ^^^^^^^^^^^ missing `sin_len`

error[E0063]: missing field `sin6_len` in initializer of `sockaddr_in6`
   --> /Users/kronic.deth/.cargo/registry/src/index.crates.io-6f17d22bba15001f/socket2-0.4.9/src/sockaddr.rs:260:28
    |
260 |         let sockaddr_in6 = sockaddr_in6 {
    |                            ^^^^^^^^^^^^ missing `sin6_len`

For more information about this error, try `rustc --explain E0063`.
error: could not compile `socket2` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: could not compile `socket2` (lib) due to 2 previous errors
error: could not compile `socket2` (lib) due to 2 previous errors
error: could not compile `socket2` (lib) due to 2 previous errors
[cargo-make] ERROR - Error while executing command, exit code: 101
[cargo-make] WARN - Build Failed.

The code in question has cfg for macos and ios , but no watchos

impl From<SocketAddrV4> for SockAddr {
    fn from(addr: SocketAddrV4) -> SockAddr {
        let sockaddr_in = sockaddr_in {
            sin_family: AF_INET as sa_family_t,
            sin_port: addr.port().to_be(),
            sin_addr: crate::sys::to_in_addr(addr.ip()),
            sin_zero: Default::default(),
            #[cfg(any(
                target_os = "dragonfly",
                target_os = "freebsd",
                target_os = "haiku",
                target_os = "ios",
                target_os = "macos",
                target_os = "netbsd",
                target_os = "openbsd"
            ))]
            sin_len: 0,
        };
        let mut storage = MaybeUninit::<sockaddr_storage>::zeroed();
        // Safety: A `sockaddr_in` is memory compatible with a `sockaddr_storage`
        unsafe { (storage.as_mut_ptr() as *mut sockaddr_in).write(sockaddr_in) };
        SockAddr {
            storage: unsafe { storage.assume_init() },
            len: mem::size_of::<sockaddr_in>() as socklen_t,
        }
    }

It looks like we'll need to fork socket2 to get watchos support

@KronicDeth KronicDeth self-assigned this Jul 21, 2023
KronicDeth added a commit that referenced this issue Jul 24, 2023
KronicDeth added a commit that referenced this issue Jul 24, 2023
KronicDeth added a commit that referenced this issue Jul 24, 2023
KronicDeth added a commit that referenced this issue Jul 24, 2023
KronicDeth added a commit that referenced this issue Jul 24, 2023
KronicDeth added a commit that referenced this issue Jul 24, 2023
KronicDeth added a commit that referenced this issue Jul 24, 2023
KronicDeth added a commit that referenced this issue Jul 24, 2023
@AZholtkevych AZholtkevych changed the title WatchOS support LiveView Native SwiftUI: WatchOS support Aug 10, 2023
@AZholtkevych AZholtkevych changed the title LiveView Native SwiftUI: WatchOS support LiveView Native Clients: WatchOS support Sep 12, 2023
@AZholtkevych AZholtkevych added the LIVEVIEWNATIVE CLIENTS LiveViewNative Clients Core issues label label Sep 13, 2023
@AZholtkevych
Copy link

Blocked at this very moment

@AZholtkevych AZholtkevych changed the title LiveView Native Clients: WatchOS support Phoenix.Channels: WatchOS support Nov 1, 2023
KronicDeth added a commit that referenced this issue Dec 5, 2023
KronicDeth added a commit that referenced this issue Dec 5, 2023
KronicDeth added a commit that referenced this issue Dec 5, 2023
KronicDeth added a commit that referenced this issue Dec 5, 2023
KronicDeth added a commit that referenced this issue Dec 5, 2023
KronicDeth added a commit that referenced this issue Dec 5, 2023
KronicDeth added a commit that referenced this issue Dec 5, 2023
KronicDeth added a commit that referenced this issue Dec 5, 2023
KronicDeth added a commit that referenced this issue Dec 5, 2023
KronicDeth added a commit that referenced this issue Dec 5, 2023
KronicDeth added a commit that referenced this issue Dec 5, 2023
KronicDeth added a commit that referenced this issue Dec 6, 2023
KronicDeth added a commit that referenced this issue Dec 6, 2023
KronicDeth added a commit that referenced this issue Dec 6, 2023
@KronicDeth
Copy link
Contributor Author

This work is currently paused with the watchOS test runs just stopping output for unknown reasons without a crash message occurring on the simulator.

╭─kronic.deth@Macintosh ~/github/liveviewnative/phoenix-channels-client ‹37)› 
╰─$ xcrun simctl launch --console booted com.rust.tests
com.rust.tests: 57014

running 26 tests
test channel_key_rotation_test ... ok
test channel_status ... ok
test channel_statuses ... ok
test phoenix_channels_binary_broadcast_test ... ok
test phoenix_channels_call_reply_ok_with_binary_payload_test ... ok
test phoenix_channels_call_reply_ok_with_json_payload_test ... ok
test phoenix_channels_call_with_binary_payload_raise_test ... ok
test phoenix_channels_call_with_binary_payload_reply_error_with_binary_payload_test ... ok
test phoenix_channels_call_with_binary_payload_reply_error_without_payload_test ... ok
test phoenix_channels_call_with_binary_payload_reply_ok_without_payload_test ... ok
test phoenix_channels_call_with_json_payload_raise_test ... %                                                                                                                                                   ╭─kronic.deth@Macintosh ~/github/liveviewnative/phoenix-channels-client ‹37)› 

@AZholtkevych AZholtkevych changed the title Phoenix.Channels: WatchOS support Phoenix.Channels: WatchOS and tvOS support Jan 3, 2024
@AZholtkevych AZholtkevych assigned simlay and unassigned KronicDeth Jan 8, 2024
@simlay simlay linked a pull request Jan 24, 2024 that will close this issue
@simlay simlay closed this as completed Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LIVEVIEWNATIVE CLIENTS LiveViewNative Clients Core issues label
Projects
Status: Done
3 participants