darling
darling copied to clipboard
Rust programming toolchain doesn't install successfully in darling's shell, errors continue after shell exits
Expected Result
I expected the Rust compiler (installed through rustup) to install successfully in Darling, so I could use it to compile iOS applications written in Rust using Apples' toolchain.
Actual Result
This error showed up a few times (possibly due to rustup retrying the network request after failure, but maybe not since this continued after rustup exited) and then it gave up and exited:
Terminating app due to uncaught exception 'NSException', reason: '-[__NSCFDictionary writeToURL:error:]: unrecognized selector sent to instance 0x7f07a8b7f9f0'
libc++abi: terminating with uncaught exception of type NSException
Then it printed this error once it gave up:
error: could not download file from 'https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256' to '/Users/testuser/.rustup/tmp/uklvdykkaz934ptz_file': failed to make network request: error sending request for url (https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256): operation timed out: operation timed out
Interestingly, the error continued appearing in my terminal even after I exited the darling shell. I went away from my keyboard for a few minutes to do something and came back to this:
libc++abi: terminating with uncaught exception of type NSException
2023-10-20 13:02:13.697 trustd[229:3e8] Terminating app due to uncaught exception 'NSException', reason: '-[__NSCFDictionary writeToURL:error:]: unrecognized selector sent to instance 0x7f1e8da7f9f0'
libc++abi: terminating with uncaught exception of type NSException
2023-10-20 13:02:23.825 trustd[231:3e8] Terminating app due to uncaught exception 'NSException', reason: '-[__NSCFDictionary writeToURL:error:]: unrecognized selector sent to instance 0x7f32f037f9f0'
libc++abi: terminating with uncaught exception of type NSException
2023-10-20 13:02:33.940 trustd[232:3e8] Terminating app due to uncaught exception 'NSException', reason: '-[__NSCFDictionary writeToURL:error:]: unrecognized selector sent to instance 0x7f324167f9f0'
libc++abi: terminating with uncaught exception of type NSException
2023-10-20 13:02:44.053 trustd[233:3e8] Terminating app due to uncaught exception 'NSException', reason: '-[__NSCFDictionary writeToURL:error:]: unrecognized selector sent to instance 0x7f0093f7f9f0'
libc++abi: terminating with uncaught exception of type NSException
2023-10-20 13:02:54.166 trustd[234:3e8] Terminating app due to uncaught exception 'NSException', reason: '-[__NSCFDictionary writeToURL:error:]: unrecognized selector sent to instance 0x7f6ce6a7f9f0'
libc++abi: terminating with uncaught exception of type NSException
2023-10-20 13:03:04.291 trustd[235:3e8] Terminating app due to uncaught exception 'NSException', reason: '-[__NSCFDictionary writeToURL:error:]: unrecognized selector sent to instance 0x7fcfd0d7f9f0'
libc++abi: terminating with uncaught exception of type NSException
2023-10-20 13:03:14.436 trustd[236:3e8] Terminating app due to uncaught exception 'NSException', reason: '-[__NSCFDictionary writeToURL:error:]: unrecognized selector sent to instance 0x7fe9a2f05cb0'
libc++abi: terminating with uncaught exception of type NSException
2023-10-20 13:03:24.580 trustd[237:3e8] Terminating app due to uncaught exception 'NSException', reason: '-[__NSCFDictionary writeToURL:error:]: unrecognized selector sent to instance 0x7f69f9005cb0'
libc++abi: terminating with uncaught exception of type NSException
2023-10-20 13:03:34.713 trustd[238:3e8] Terminating app due to uncaught exception 'NSException', reason: '-[__NSCFDictionary writeToURL:error:]: unrecognized selector sent to instance 0x7f5b42105cb0'
libc++abi: terminating with uncaught exception of type NSException
2023-10-20 13:03:44.891 trustd[239:3e8] Terminating app due to uncaught exception 'NSException', reason: '-[__NSCFDictionary writeToURL:error:]: unrecognized selector sent to instance 0x7fbdb2405cb0'
libc++abi: terminating with uncaught exception of type NSException
Steps To Reproduce
- Install rustup on Darling by following the instructions at rustup
System Information What system are you using?
Output of neofetch:
-` user@arch
.o+` ---------
`ooo/ OS: Arch Linux x86_64
`+oooo: Host: Gazelle gaze18
`+oooooo: Kernel: 6.5.7-arch1-1
-+oooooo+: Uptime: 3 hours, 27 mins
`/:-:++oooo+: Packages: 923 (pacman)
`/++++/+++++++: Shell: bash 5.1.16
`/++++++++++++++: Resolution: 1920x1080
`/+++ooooooooooooo/` WM: i3
./ooosssso++osssssso+` Theme: Adwaita [GTK3]
.oossssso-````/ossssss+` Icons: Adwaita [GTK3]
-osssssso. :ssssssso. Terminal: alacritty
:osssssss/ osssso+++. CPU: 13th Gen Intel i9-13900H (20) @ 5.200GHz
/ossssssss/ +ssssooo/- GPU: NVIDIA GeForce RTX 3050 Mobile
`/ossssso+/:- -:/+osssso+- GPU: Intel Raptor Lake-P [Iris Xe Graphics]
`+sso+:-` `.-/+oso: Memory: 2552MiB / 15837MiB
`++:. `-/+/
.` `/
Output of darling --version:
[liam@arch ~]$ darling --version
darling master @ fbcd182df
Copyright (C) 2012-2023 Lubos Dolezel
This appears to be at least partly related to #1220. I'd recommend you begin by following the steps there.
Additionally our current implementation of NSDictionary currently only supports a a deprecated writeToURL:atomically: method, not the current writeToURL:error:. I'll add that to the To-Do list for Foundation and AppKit.
Do note that in it's current state, and as noted in the documentation, Darling only supports building simple XIB based MacOS applications.
Actually, this appears to be just an issue with trustd. The operation timed out: operation timed out message seems to be because it timed out trying to validate the HTTPS certificate (which is what trustd is supposed to do). This should be a simple fix: we simply need to implement -[NSDictionary writeToURL:atomically:].
For reference, this is the stack trace:
Stack trace
* thread #1
* frame #0: 0x000061b6e8dbf1b0 libsystem_kernel.dylib`linux_syscall at linux-syscall.S:12
frame #1: 0x000061b6e8da8124 libsystem_kernel.dylib`sys_sigprocmask(how=3, set=0x00007fffffdfddec, oldset=0x0000000000000000) at sigprocmask.c:20:8
frame #2: 0x000061b6e8dbf99e libsystem_kernel.dylib`dserver_rpc_hooks_atomic_end(atomic_save=0x00007fffffdfddec) at dserver-rpc-defs.h:290:2
frame #3: 0x000061b6e8dcb708 libsystem_kernel.dylib`dserver_rpc_explicit_pthread_kill(server_socket=1023, thread_port=775, signal=6) at rpc.c:3665:2
frame #4: 0x000061b6e8dcb78a libsystem_kernel.dylib`dserver_rpc_pthread_kill(thread_port=775, signal=6) at rpc.c:3676:9
frame #5: 0x000061b6e8dbd076 libsystem_kernel.dylib`sys_pthread_kill(thread_port=775, sig=6) at pthread_kill.c:13:12
frame #6: 0x000061b6e8dbf188 libsystem_kernel.dylib`_darling_bsd_syscall at syscalls-table.S:19
frame #7: 0x000061b6e8d9b32e libsystem_kernel.dylib`__pthread_kill at ___pthread_kill.S:14
frame #8: 0x000061b6e89bbcde libsystem_pthread.dylib`pthread_kill(th=0x000061b6eaa5ee80, sig=6) at pthread.c:1573:12
frame #9: 0x000061b6e8f7c595 libsystem_c.dylib`abort at abort.c:121:8
frame #10: 0x000061b6e85d8fb4 libc++abi.dylib`abort_message(format="terminating with %s exception of type %s") at abort_message.cpp:78:5
frame #11: 0x000061b6e85d92d5 libc++abi.dylib`demangling_terminate_handler() at cxa_default_handlers.cpp:71:21
frame #12: 0x000061b6e97dec63 libobjc.A.dylib`_objc_terminate() at objc-exception.mm:701:13
frame #13: 0x000061b6e8605f22 libc++abi.dylib`std::__terminate(func=(libobjc.A.dylib`_objc_terminate() at objc-exception.mm:685)) at cxa_handlers.cpp:59:9
frame #14: 0x000061b6e86047e6 libc++abi.dylib`__cxxabiv1::failed_throw(exception_header=0x000061b6e777f980) at cxa_exception.cpp:152:5
frame #15: 0x000061b6e860473c libc++abi.dylib`__cxa_throw(thrown_object=0x000061b6e777fa00, tinfo=0x000061b6e777fa08, dest=(libobjc.A.dylib`_objc_exception_destructor(void*) at objc-exception.mm:545)) at cxa_exception.cpp:283:5
frame #16: 0x000061b6e97ddcb8 libobjc.A.dylib`objc_exception_throw(obj=<unavailable>) at objc-exception.mm:591:5
frame #17: 0x000061b6e95c4399 CoreFoundation`-[NSException raise](self=0x000061b6e777f910, _cmd="raise") at NSException.m:94:5
frame #18: 0x000061b6e95c4488 CoreFoundation`+[NSException raise:format:](self=0x000061b6e9624a90, _cmd="raise:format:", name=0x000061b6e9614070, format=0x000061b6e9614590) at NSException.m:107:5
frame #19: 0x000061b6e95ccde0 CoreFoundation`-[NSObject(self=0x000061b6e777ec30, _cmd="doesNotRecognizeSelector:", sel="") doesNotRecognizeSelector:] at NSObject.m:109:9
frame #20: 0x000061b6e95c4f9e CoreFoundation`___forwarding___(args=0x00007fffffdff950, returnStorage=0x00007fffffdffa10) at NSForwarding.m:103:9
frame #21: 0x000061b6e95e7b89 CoreFoundation`_CF_forwarding_prep_0 at CFForwardingPrep.S:239
frame #22: 0x00000001000642f9 trustd`-[NSDictionary(self=0x000061b6e777ec30, _cmd="", url=0x000061b6e777f6d0, permissions=384, error=0x00007fffffdffbc0) writeToClassDURL:permissions:error:] at trustdFileLocations.m:316:9
frame #23: 0x00000001000591bb trustd`WriteExceptionsCounterToUrl(exceptionResetCount=0, url=0x000061b6e777f6d0, error=0x00007fffffdffcd0) at SecTrustExceptionResetCount.m:75:18
frame #24: 0x0000000100059481 trustd`SecTrustServerMigrateExceptionsResetCount at SecTrustExceptionResetCount.m:133:10
frame #25: 0x000000010006314f trustd`trustd_init_server at trustd_spi.c:91:5
frame #26: 0x0000000100002c6d trustd`main(argc=2, argv=0x00007fffffdffda8) at trustd.c:861:5
frame #27: 0x000061b6e8a06971 libdyld.dylib`start at start_glue.S:47
frame #28: 0x000061b6e8a06971 libdyld.dylib`start at start_glue.S:47
This is the URL it's trying to write to: file:///private/var/protected//trustd/private/com.apple.security.exception_reset_counter.plist.