#compile on macos but not on ios target

13 messages · Page 1 of 1 (latest)

dense hearth
#

I have a code which look like that : (not sure if all the code is required)

#

does anyhone already add issue with cross compile and anyhow ?

#

I got another error with just a Ok(()) in the inner fn, this time about linking and libusb, so look like it come from the code into the inner function

odd schooner
#

anyhow should work fine on ios so it's probably something inside that inner fn

dense hearth
#

look like it's a weird issue with libusb wrapper which is not available on ios

#

by weird I mean error doesn't really match the case (pretty rare for rustc to don't guess the issue by itself)

dense hearth
#

hmmm

#
        let writer = match body.config.clone() {
            Config::IP {
                base_config: _,
                host,
                port,
            } => WriterEnum::Network(device::Network::new(&host, port)?),
            Config::USB {
                base_config: _,
                vendor_id,
                product_id,
                interface_number,
                endpoint_in_address,
                endpoint_out_address,
            } => {
                let writer = if cfg!(target_os = "ios") {
                    unimplemented!("USB printing is not supported on iOS");
                } else {
                    WriterEnum::USB(device::Usb::new(
                        vendor_id,
                        product_id,
                        interface_number,
                        endpoint_in_address,
                        endpoint_out_address,
                        Duration::from_secs(1),
                    )?)
                };
                writer
            }
        };
``` this part doesn't work well
#

it complain about the ?

#

should I map_err defore and return a string or should I continue on the road of conditional compilation ?

mint zephyr
#

conditional compilation would be my advice

dense hearth
#

I tried with both cfg macro and #[] syntax without success