sonos / dinghy

Easier cross-compilation for phones and single boards computers
Other
365 stars 44 forks source link

xcrun: error: unable to find utility "devicectl", not a developer tool or in PATH #225

Closed ZhaoXiangXML closed 7 months ago

ZhaoXiangXML commented 7 months ago

I'm trying run Android tests on mac and I got the following error:

xcrun: error: sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find devicectl 2> /dev/null' failed with exit code 17664: (null) (errno=Invalid argument)
xcrun: error: unable to find utility "devicectl", not a developer tool or in PATH
[2024-04-10T04:11:36Z ERROR cargo_dinghy] Could not initialize iOS manager

    Caused by:
        0: Could not list iOS devices
        1: xcrun command failed. Please check that "xcrun devicectl list devices" works.
           Output { status: ExitStatus(unix_wait_status(18432)), stdout: "", stderr: "" }

    Stack backtrace:
       0: std::backtrace_rs::backtrace::libunwind::trace
                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
       1: std::backtrace_rs::backtrace::trace_unsynchronized
                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
       2: std::backtrace::Backtrace::create
                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/backtrace.rs:331:13
       3: anyhow::error::<impl anyhow::Error>::msg
       4: anyhow::__private::format_err
       5: dinghy_lib::apple::IosManager::new
       6: dinghy_lib::Dinghy::probe
       7: cargo_dinghy::run_command
       8: cargo_dinghy::main
       9: std::sys_common::backtrace::__rust_begin_short_backtrace
      10: std::rt::lang_start::{{closure}}
      11: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:284:13
      12: std::panicking::try::do_call
                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
      13: std::panicking::try
                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
      14: std::panic::catch_unwind
                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
      15: std::rt::lang_start_internal::{{closure}}
                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/rt.rs:148:48
      16: std::panicking::try::do_call
                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
      17: std::panicking::try
                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
      18: std::panic::catch_unwind
                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
      19: std::rt::lang_start_internal
                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/rt.rs:148:20
      20: _main

I don't have the latest XCode installed, and I think it's introduced by https://github.com/sonos/dinghy/pull/215.

I'm not developing for iOS/mac right now so an old version of XCode is fine for me.

Would you please kindly fix this?

kali commented 7 months ago

Hey @ZhaoXiangXML, can you please confirm that this fixes it, or is there any other places where we need to check first ?

ZhaoXiangXML commented 7 months ago

No it's not working. I got the same error message.

Please note I have xcrun, what's missing is devicectl.

kali commented 7 months ago

All right. Sorry for the confusion. Can you try again ?

ZhaoXiangXML commented 7 months ago

Looks like it's working for Android, how ever I can't see my iOS device with cargo dinghy all-devices.

I've Xcode 13.4.1 and an iOS 14.3 device plugged in. It can be seen with 0.6.8.

The expected behavior is I should be able to use iOS 16 or earlier, with an old version of Xcode.

kali commented 7 months ago

OK, this is getting really cumbersome. I guess it means we need to re-instatiate the ios-deploy way to discover devices. I don't have old xcode configurations around, and this specific case is not of great interest for us.

If you want to get this to work, I'm happy to look at a PR. It will be faster than going back and forth.

ZhaoXiangXML commented 7 months ago

Well that should be good enough for now, sorry for the trouble.

I will have to upgrade XCode someday anyway.

Thank you for the quick response.