Open ahyattdev opened 5 years ago
@bugaevc very nice, gets us past there.
Now it needs:
** INTERNAL ERROR: Uncaught exception **
Uncaught Exception: -[__NSStackBlock__ copyWithZone:]: unrecognized selector sent to instance 0x7fffffdfdbf0
Stack:
2019-03-18 13:08:16.684 xcodebuild[41:3e8] [MT] DVTDeveloperPaths: WARNING: No version.plist file found next to presumed developer directory '/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Developer'; developer tools may need to be reinstalled.
** INTERNAL ERROR: Uncaught exception **
Uncaught Exception: -[NSNotificationCenter addObserver:selector:name:object:suspensionBehavior:]: unrecognized selector sent to instance 0x7fcfdc430b30
Stack:
Abort trap: 6 (core dumped)
We get this now. I think the no version.plist is caused by something on our end because I installed Xcode.app and the command line tools to a fresh prefix and it still happened.
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -find lldb
2019-04-05 12:03:12.443 xcodebuild[64:3e8] Test observer <XCTestLog: 0x7fa5a7c00c90> implements -startObserving. This is a deprecated API - please implement -testBundleWillStart: instead.
2019-04-05 12:03:12.443 xcodebuild[64:3e8] Test observer <XCTestLog: 0x7fa5a7c00c90> implements -stopObserving. This is a deprecated API - please implement -testBundleDidFinish: instead.
STUB FSEventStreamRef FSEventStreamCreate(CFAllocatorRef, FSEventStreamCallback, FSEventStreamContext *, CFArrayRef, FSEventStreamEventId, CFTimeInterval, FSEventStreamCreateFlags)
STUB CFArrayRef FSEventStreamCopyPathsBeingWatched(ConstFSEventStreamRef)
Segmentation fault: 11 (core dumped)
This is happening to me using the latest XCode 11.4 and commit 14efc1808fa803559104b05d1b2fbe15eb33668d from 2020-04-06. My host is Ubuntu 18.04 with kernel 5.3.0-45-generic:
[61] getuid() -> 1000
[61] mach_msg_trap(0x7fffffdf9a78, MACH_SEND_MSG|MACH_RCV_MSG, 188, 108, port 1543, 0, port 0)
[61] {remote = copy send 1799, local = make send-once 1543, id = 404}, 164 bytes of inline data
[61] job::look_up2(copy send 1799, "com.apple.system.notification_center", 0, [116, 7, 8, 255, 158, 255, 255, 0, 0, 0, 0, 0, 255, 255, 255, 0], 8)
[61] mach_msg_trap() -> KERN_SUCCESS
[61] {local = move send-once 1543, complex, id = 504}, move send 2819, 0 bytes of inline data
[61] job::look_up2() -> move send 2819, {0, 0, 32767, 32767, 32767, 0, 0, 0}
[61] mach_msg_trap(0x7fffffdf9d70, MACH_SEND_MSG|MACH_RCV_MSG, 56, 52, port 1543, 0, port 0)
[61] {remote = copy send 2819, local = make send-once 1543, complex, id = 78945669}, ool [0x7ffff7a85c9f; 35], 12 bytes of inline data
[61] notify_ipc::_notify_server_register_plain(copy send 2819, mem [0x7ffff7a85c9f; 35], 35)
[61] mach_msg_trap() -> KERN_SUCCESS
[61] {local = move send-once 1543, id = 78945769}, 20 bytes of inline data
[61] notify_ipc::_notify_server_register_plain() -> 14, 0
[61] mach_msg_trap(0x7fffffdf9d90, MACH_SEND_MSG|MACH_RCV_MSG, 36, 56, port 1543, 0, port 0)
[61] {remote = copy send 2819, local = make send-once 1543, id = 78945681}, 12 bytes of inline data
[61] notify_ipc::_notify_server_get_state(copy send 2819, 14)
[61] mach_msg_trap() -> KERN_SUCCESS
[61] {local = move send-once 1543, id = 78945781}, 24 bytes of inline data
[61] notify_ipc::_notify_server_get_state() -> 98784247810, 0
[61] mach_msg_trap(0x7fffffdf9d88, MACH_SEND_MSG|MACH_RCV_MSG, 36, 48, port 1543, 0, port 0)
[61] {remote = copy send 2819, local = make send-once 1543, id = 78945679}, 12 bytes of inline data
[61] notify_ipc::_notify_server_cancel(copy send 2819, 14)
[61] mach_msg_trap() -> KERN_SUCCESS
[61] {local = move send-once 1543, id = 78945779}, 16 bytes of inline data
[61] notify_ipc::_notify_server_cancel() -> 0
[61] mach_msg_trap(0x7fffffdf9e88, MACH_SEND_MSG|MACH_RCV_MSG, 60, 64, port 1543, 0, port 0)
[61] {remote = copy send 2819, local = make send-once 1543, complex, id = 78945695}, ool [0x7ffff7ac33ca; 49], 16 bytes of inline data
[61] notify_ipc::_notify_server_register_check_2(copy send 2819, mem [0x7ffff7ac33ca; 49], 49, 1)
[61] mach_msg_trap() -> KERN_SUCCESS
[61] {local = move send-once 1543, id = 78945795}, 32 bytes of inline data
[61] notify_ipc::_notify_server_register_check_2() -> 4096, 3, 10, 0
[61] shm_open("apple.shm.notification_center", 0, 0)[61] _kernelrpc_mach_vm_allocate_trap(...)[61] task_self_trap() -> port right 259
[61] task_self_trap() -> port right 259
[61] mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0) -> 0x7ffff696c000
-> 0x
[61] mmap(0x7ffff696c000, 8192, PROT_READ|PROT_EXEC, MAP_FIXED|MAP_PRIVATE, 3, 4096) -> 0x7ffff696c000
[61] mmap(0x7ffff696e000, 4096, PROT_READ|PROT_WRITE, MAP_FIXED|MAP_PRIVATE, 3, 12288) -> 0x7ffff696e000
[61] mmap(0x7ffff696f000, 1680, PROT_READ, MAP_FIXED|MAP_PRIVATE, 3, 16384) -> 0x7ffff696f000
[61] open("/usr/libexec/elfloader_dummy64", O_RDONLY, 0) -> 3
[61] read(3, 0x7fffffdf8aa8, 64) -> 64
[61] pread(3, 0x7f8516c03ae0, 560, 64) -> 560
[61] mmap(NULL, 2105584, PROT_NONE, MAP_ANON|MAP_PRIVATE, -1, 0) -> 0x7ffff6769000
[61] pread(3, 0x7f8516c00530, 28, 624) -> 28
[61] access("/lib64/ld-linux-x86-64.so.2", 0) -> ENOENT
[61] access("/Volumes/SystemRoot/lib64/ld-linux-x86-64.so.2", 0) -> 0
[61] open("/Volumes/SystemRoot/lib64/ld-linux-x86-64.so.2", O_RDONLY, 0) -> 4
[61] read(4, 0x7fffffdf8948, 64) -> 64
[61] pread(4, 0x7f8516c03d10, 392, 64) -> 392
[61] mmap(NULL, 2265456, PROT_NONE, MAP_ANON|MAP_PRIVATE, -1, 0) -> 0x7ffff653f000
[61] mprotect(0x7ffff653f000, 158756, PROT_READ|PROT_WRITE|PROT_EXEC) -> 0
[61] mmap(0x7ffff653f000, 158756, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_FIXED|MAP_PRIVATE, 4, 0) -> 0x7ffff653f000
[61] mprotect(0x7ffff653f000, 158756, PROT_READ|PROT_EXEC) -> 0
[61] mprotect(0x7ffff6766000, 8560, PROT_READ|PROT_WRITE) -> 0
[61] mmap(0x7ffff6766000, 8152, PROT_READ|PROT_WRITE, MAP_FIXED|MAP_PRIVATE, 4, 159744) -> 0x7ffff6766000
[61] close(4) -> 0
[61] mprotect(0x7ffff6769000, 7184, PROT_READ|PROT_WRITE|PROT_EXEC) -> 0
[61] mmap(0x7ffff6769000, 7184, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_FIXED|MAP_PRIVATE, 3, 0) -> 0x7ffff6769000
[61] mprotect(0x7ffff6769000, 7184, PROT_READ|PROT_EXEC) -> 0
[61] mprotect(0x7ffff696a000, 4336, PROT_READ|PROT_WRITE) -> 0
[61] mmap(0x7ffff696a000, 4328, PROT_READ|PROT_WRITE, MAP_FIXED|MAP_PRIVATE, 3, 4096) -> 0x7ffff696a000
[61] close(3) -> 0
[61] mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0) -> 0x7ffff653b000
[61] readlink("/Users/pablo/LinuxHome", 0x7f8516c03ae0, 511) -> 30
[61] getentropy(0x7fffffdf8bc0, 16) -> 16
[61] sigprocmask(1, NULL, 0x7fffffdf8ae0) -> 0
[61] sigaltstack(NULL, 0x7fffffdf8ad0) -> 0
[61] sigprocmask(3, 0x7ffff653eb80, NULL) -> 0
[61] sigreturn(NULL, -2147483648) -> 0
-> 0x
[61] mmap(NULL, 4096, PROT_READ, MAP_SHARED, 3, 0) -> 0x7ffff653a000
[61] close(3) -> 0
[61] mach_msg_trap(0x7fffffdf9e88, MACH_SEND_MSG|MACH_RCV_MSG, 60, 64, port 1543, 0, port 0)
[61] {remote = copy send 2819, local = make send-once 1543, complex, id = 78945695}, ool [0x7ffff7ac33fc; 54], 16 bytes of inline data
[61] notify_ipc::_notify_server_register_check_2(copy send 2819, mem [0x7ffff7ac33fc; 54], 54, 2)
[61] mach_msg_trap() -> KERN_SUCCESS
[61] {local = move send-once 1543, id = 78945795}, 32 bytes of inline data
[61] notify_ipc::_notify_server_register_check_2() -> 4096, 4, 11, 0
[61] mach_msg_trap(0x7fffffdf9e88, MACH_SEND_MSG|MACH_RCV_MSG, 60, 64, port 1543, 0, port 0)
[61] {remote = copy send 2819, local = make send-once 1543, complex, id = 78945695}, ool [0x7ffff7ac3433; 55], 16 bytes of inline data
[61] notify_ipc::_notify_server_register_check_2(copy send 2819, mem [0x7ffff7ac3433; 55], 55, 3)
[61] mach_msg_trap() -> KERN_SUCCESS
[61] {local = move send-once 1543, id = 78945795}, 32 bytes of inline data
[61] notify_ipc::_notify_server_register_check_2() -> 4096, 5, 12, 0
[61] mach_msg_trap(0x7fffffdf9e88, MACH_SEND_MSG|MACH_RCV_MSG, 60, 64, port 1543, 0, port 0)
[61] {remote = copy send 2819, local = make send-once 1543, complex, id = 78945695}, ool [0x7ffff7ac346b; 57], 16 bytes of inline data
[61] notify_ipc::_notify_server_register_check_2(copy send 2819, mem [0x7ffff7ac346b; 57], 57, 4)
[61] mach_msg_trap() -> KERN_SUCCESS
[61] {local = move send-once 1543, id = 78945795}, 32 bytes of inline data
[61] notify_ipc::_notify_server_register_check_2() -> 4096, 6, 13, 0
[61] issetugid() -> 0
[61] issetugid() -> 0
[61] geteuid() -> 1000
[61] getrlimit(4104, 0x7fffffdf9fd8) -> 0
[61] open_nocancel("/etc/passwd", O_RDONLY, 438) -> 3
[61] fstat64(3, 0x7fffffdfa280) -> 0
[61] fstat64(3, 0x7fffffdf9150) -> 0
[61] read_nocancel(3, 0x7f8507001800, 4096) -> 2695
[61] close_nocancel(3) -> 0
[61] issetugid() -> 0
[61] open("/dev/autofs_nowait", O_RDONLY, -135720657) -> 3
[61] open("/home/pablo/.CFUserTextEncoding", O_RDONLY, 0) -> ENOENT
[61] close(3) -> 0
[61] mach_timebase_info_trap() -> numer = 1, denom = 1
[61] issetugid() -> 0
[61] readlink("/var/db/xcode_select_link", 0x7ffff7fde140, 1023) -> ENOENT
[61] readlink("/usr/share/xcode-select/xcode_dir_link", 0x7ffff7fde140, 1023) -> ENOENT
[61] open("/usr/share/xcode-select/xcode_dir_path", O_RDONLY, -1) -> ENOENT
[61] stat64("/Applications/Xcode.app", 0x7fffffdfd680) -> 0
[61] _kernelrpc_mach_vm_allocate_trap(...)[61] task_self_trap() -> port right 259
[61] task_self_trap() -> port right 259
[61] mmap(NULL, 61440, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0) -> 0x7ffff652b000
-> 0x
[61] mmap(0x7ffff652b000, 28672, PROT_READ|PROT_EXEC, MAP_FIXED|MAP_PRIVATE, 3, 0) -> 0x7ffff652b000
[61] mmap(0x7ffff6532000, 4096, PROT_READ|PROT_WRITE, MAP_FIXED|MAP_PRIVATE, 3, 28672) -> 0x7ffff6532000
[61] mmap(0x7ffff6533000, 25408, PROT_READ, MAP_FIXED|MAP_PRIVATE, 3, 32768) -> 0x7ffff6533000
[61] access("/Applications/Xcode.app/Contents/Developer", 4) -> 0
[61] open("/tmp/xcrun_db", O_RDONLY, -2111009) -> 3
[61] fstat64(3, 0x7fffffdfc8f8) -> 0
[61] mmap(NULL, 16, PROT_READ, MAP_PRIVATE, 3, 0) -> 0x7ffff652a000
[61] close(3) -> 0
[61] write_nocancel(2, 0x7fffffdfc080, 21)xcodebuild: warning: -> 21
[61] write_nocancel(2, 0x7fffffdfc240, 63)cache file '/tmp/xcrun_db' has wrong magic number; resetting it -> 63
[61] write_nocancel(2, 0x7ffff77fd567, 1)
-> 1
[61] munmap(0x7ffff7fe2553, 16) -> EINVAL
[61] open_nocancel("/dev/random", O_RDONLY, 0) -> 3
[61] read_nocancel(3, 0x7ffff7802470, 128) -> 128
[61] close_nocancel(3) -> 0
[61] open_nocancel("/dev/random", O_RDONLY, 0) -> 3
[61] read_nocancel(3, 0x7ffff7802470, 128) -> 128
[61] close_nocancel(3) -> 0
[61] stat64("/tmp", 0x7fffffdfc3c8) -> 0
[61] open_nocancel("/tmp/xcrun_db-v5BlcOZc", O_RDWR|O_CREAT|O_EXCL, 384) -> 3
[61] write(3, 0x7fffffdfc988, 16) -> 16
[61] close(3) -> 0
[61] rename("/tmp/xcrun_db-v5BlcOZc", "/tmp/xcrun_db") -> 0
[61] open("/tmp/xcrun_db", O_RDONLY, 775) -> 3
[61] fstat64(3, 0x7fffffdfc8f8) -> 0
[61] mmap(NULL, 16, PROT_READ, MAP_PRIVATE, 3, 0) -> 0x7ffff6529000
[61] close(3) -> 0
Segmentation fault: 11 (core dumped)
I've attempted to collect the core dump as per https://developer.apple.com/library/archive/technotes/tn2124/_index.html#//apple_ref/doc/uid/DTS10003391-CH1-SECCOREDUMPS, but I have not been able to successfully do it. Please let me know how to gather any further information to help figuring out this issue.
My host is Ubuntu 18.04 with kernel 5.3.0-45-generic
I've attempted to collect the core dump as per https://developer.apple.com/library/archive/technotes/tn2124/_index.html#//apple_ref/doc/uid/DTS10003391-CH1-SECCOREDUMPS, but I have not been able to successfully do it.
Depending on your distro — and I'm not sure how Ubuntu sets it up — core dumps may end up in a different place than the current directory. I know they do just work as they used to on Debian, so you go
Darling [/tmp]$ ulimit -c unlimited
Darling [/tmp]$ ./my-crashy-app
Segmentation fault: 11 (core dumped)
Darling [/tmp]$ ls
my-crashy-app core
Darling [/tmp]$ lldb -c core
or, if your distro sets /proc/sys/kernel/core_pattern
to something, you can get it from there. In my case, it's set to |/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h
, so I can get core dumps from coredumpd (coredumpctl dump
).
It might be easier to just run the thing in LLDB and inspect the crash there, without a core file.
Fwiw, coredumps on ubuntu are not collected by systemd, but by whoopsie - https://packages.ubuntu.com/source/bionic-updates/whoopsie - you need to shut it down to get core dumps.
It might be easier to just run the thing in LLDB and inspect the crash there, without a core file.
Yeah, but I can't run anything that depends on xcodebuild
. So, no clang or lldb :(
$ xcode-select -p
/Applications/Xcode.app/Contents/Developer/
$ lldb xcodebuild
lldb: error: unable to locate xcodebuild, please make sure the path to the Xcode folder is set correctly!
lldb: error: You can set the path to the Xcode folder using /usr/bin/xcode-select -switch
I can get crashes of apps running on my host, but I can't see dumps from darling
Can't you run LLDB directly? E.g.
$ $(xcode-select -p)/usr/bin/lldb
Can't you run LLDB directly? E.g.
$ $(xcode-select -p)/usr/bin/lldb
That works! I might be doing something wrong since I'm used to gcc, but I can't get the core dump or any other sort of useful information running lldb:
Darling [/Volumes/SystemRoot/home/pablo]$ $(xcode-select -p)/usr/bin/lldb xcodebuild
(lldb) target create "xcodebuild"
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/B5BCD06C-3F6F-3CCD-AE8F-C6C0CCE852DB.dSYM based on UUID
Debug symbols not found at /usr/bin/xcodebuild
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/3E93A5B6-98F3-351C-9968-4BAD9C0F0F99.dSYM based on UUID
Debug symbols not found at /usr/lib/dyld
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/F9E07477-DC48-345D-9EA4-2BB81F95E9F7.dSYM based on UUID
Debug symbols not found at /usr/lib/libxcselect.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/EFB4840C-5A5E-3F63-8BC0-877BAF15B37B.dSYM based on UUID
Debug symbols not found at /usr/lib/libSystem.B.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/4C1B543F-1C23-3C70-BEF6-9D96DA4F5413.dSYM based on UUID
Debug symbols not found at /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/58FC12CC-5D72-3CCF-9DB7-974A43F733FB.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libsystem_sandbox.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/EFC661D4-038E-3066-AD91-2CDD59429C04.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libquarantine.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/4406FDDD-DCAA-3699-8F68-695C567432C2.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libremovefile.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/CF05A036-98E7-3705-B92B-748E9AFAB217.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libcopyfile.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/2A355C5C-AA2A-3EA6-A4C8-DDEF57BB6615.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libsystem_coreservices.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/51B818FC-FC90-3CD3-8F6C-7B193897E2D8.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libsystem_coretls.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/0F4ACEA3-2802-35FE-A625-F39541A96A03.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libsystem_malloc.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/05FF0CD7-5565-3BAC-B2D2-991E5CABB984.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libsystem_kernel.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/631250DE-1D9E-360C-8912-A6A7CA7B7A4B.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libsystem_trace.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/A8FBE950-EAC2-325B-9F6A-BD94C1990EF6.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libkeymgr.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/D48FC7B9-F1D2-3911-AE23-4BC923BB6B96.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libsystem_m.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/4D5B6409-1D6E-349B-BFD3-F463929B2CC2.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libsystem_info.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/4D71F5BA-6F60-3EC9-9DF4-9199B0FD8537.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libsystem_notify.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/2E19B07B-4803-31EC-8339-D15E97CAB514.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libdispatch.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/C7A098F5-1B17-36F1-A204-6A13CD08D010.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libcompiler_rt.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/F7A21DC3-7A66-3AB5-BCF7-13BDCAB8A270.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libunwind.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/D8247E90-D9DB-3534-98F3-0B8336FD1B2F.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libmacho.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/04911BE6-D1BF-3364-9DF6-AAF1AB3C8E4F.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libsystem_pthread.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/16A2A778-2C7C-3C51-96F9-719D92D81399.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libsystem_platform.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/77379496-E900-3F19-8994-8416F055A7D9.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libsystem_asl.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/CB591894-248C-3701-B7E5-5C78C94228B3.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libsystem_duct.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/FCDAB853-18C4-3504-A727-210C2E60BC59.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libsystem_blocks.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/FBDE95AA-EAC4-325E-A0CB-955275E7B509.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libxpc.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/8BD938AB-9791-3C09-9946-AC30AE7C19FF.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libcorecrypto.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/60606FB2-5D46-34D6-9F73-743E7045613D.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libcommonCrypto.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/9186F017-CC47-3062-84A8-993DE6974FDC.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libsystem_dnssd.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/E0E3FCE3-6879-32B7-AD9A-A0E8159D1FAB.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libsystem_c.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/65F6AB2A-CD2E-3917-BD25-8AF25109FF90.dSYM based on UUID
Debug symbols not found at /usr/lib/system/libdyld.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/48DD3A5A-3DED-394D-BB03-976D20DF8C7F.dSYM based on UUID
Debug symbols not found at /usr/lib/system/liblaunch.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/6B0F0CB6-E262-3147-B38B-1963E48D5646.dSYM based on UUID
Debug symbols not found at /usr/lib/libobjc.A.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/28D48DFD-98B9-3578-9787-E590DE18816B.dSYM based on UUID
Debug symbols not found at /usr/lib/libicucore.A.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/2461345E-A59E-3AA1-8FCB-4C47B35FDC0C.dSYM based on UUID
Debug symbols not found at /usr/lib/libc++.1.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/8A6E19D6-B579-3696-AFE2-109EE359EFA1.dSYM based on UUID
Debug symbols not found at /usr/lib/libresolv.9.dylib
Didn't find debug symbols at /System/Library/Caches/dsym/uuid/DC77D90F-3C9B-3F09-85D6-CCF9CC5C55BD.dSYM based on UUID
Debug symbols not found at /usr/lib/libc++abi.dylib
Current executable set to 'xcodebuild' (x86_64).
(lldb) run
Process 305 exited with status = -1 (0xffffffff) lost connection
error: process resume at entry point failed: Resume timed out.
Since you pointed out that lldb
might not be the one within XCode's I checked out the md5 of xcodebuild
and they are also indeed different. Not sure why, though. Are they simply wrappers that end up calling whatever you have on your xcode-select -p
? The other way around? Interestingly enough, xtrace $(xcode-select -p)/usr/bin/xcodebuild
doesn't output anything, apart of the segfault.
Darling [/Volumes/SystemRoot/home/pablo]$ file $(which xcodebuild) && md5 $(which xcodebuild)
/usr/bin/xcodebuild: Mach-O 64-bit executable x86_64
MD5 (/usr/bin/xcodebuild) = 246c78cba32b6cc48154569e3b3fca33
Darling [/Volumes/SystemRoot/home/pablo]$ file $(xcode-select -p)/usr/bin/xcodebuild && md5 $(xcode-select -p)/usr/bin/xcodebuild
/Applications/Xcode.app/Contents/Developer//usr/bin/xcodebuild: Mach-O 64-bit executable x86_64
MD5 (/Applications/Xcode.app/Contents/Developer//usr/bin/xcodebuild) = 9fa59d441d0109850be71cdffb031c17
Are they simply wrappers that end up calling whatever you have on your
xcode-select -p
?
Yes
error: process resume at entry point failed: Resume timed out.
No idea what's going on there, but you should try debugging $(xcode-select -p)/usr/bin/xcodebuild
, too.
Ok, I took a look at https://docs.darlinghq.org/contributing/debugging.html, I downloaded https://osdn.net/projects/darling/storage/apps/lldb.tar.bz2 and that seems to work most of the time. Some times it does not, but retrying works.
Please notice that the link provided in the wiki is wrongly pointing to https://docs.darlinghq.org/contributing/https///osdn.net/projects/darling/storage/apps/lldb.tar.bz2
, though. The source code for the doc seems fine, though: https://github.com/darlinghq/darling-docs/blob/master/src/contributing/debugging.md
Anyway, here's the output using the custom lldb for darling:
./lldb xcodebuild
...
(lldb) run
Process 407 launched: '/usr/bin/xcodebuild' (x86_64)
Process 407 stopped
* thread #1, name = 'xcodebuild', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
frame #0: 0x0000000000000025
error: memory read failed for 0x0
(lldb) bt all
* thread #1, name = 'xcodebuild', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
* frame #0: 0x0000000000000025
(lldb) register read
General Purpose Registers:
rax = 0x41b002963decc275
rbx = 0x00007ffff802f7b0 dyld`ImageLoader::recursiveLoadLibraries(ImageLoader::LinkContext const&, bool, ImageLoader::RPathChain const&, char const*)
rcx = 0x41b002963decc275
rdx = 0x00007fffffdfa078
rdi = 0x0000000000000000
rsi = 0x0000000000000026
rbp = 0x00007ffff80280b1 dyld`notifyGDB(dyld_image_states, unsigned int, dyld_image_info const*) + 49
rsp = 0x00007fffffdfa1f8
r8 = 0x0000000000000000
r9 = 0x0000000000000000
r10 = 0x0000000000000000
r11 = 0x0000000000000246
r12 = 0x00000000004025c0
r13 = 0x00007ffe429773e0
r14 = 0x0000000000000000
r15 = 0x0000000000000000
rip = 0x0000000000000025
rflags = 0x0000000000010246
cs = 0x0000000000000033
fs = 0x0000000000000000
gs = 0x0000000000000000
And the same for $(xcode-select -p)/xcodebuild
./lldb $(xcode-select -p)/xcodebuild
...
(lldb) run
Process 430 launched: '/Applications/Xcode.app/Contents/Developer//usr/bin/xcodebuild' (x86_64)
Process 430 stopped
* thread #1, name = 'xcodebuild', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
frame #0: 0x00007ffff80f1c7a dyld`_platform_memmove + 698
dyld`_platform_memmove:
-> 0x7ffff80f1c7a <+698>: movq (%rax), %rax
0x7ffff80f1c7d <+701>: movq -0x20(%rbp), %rcx
0x7ffff80f1c81 <+705>: movq %rax, (%rcx)
0x7ffff80f1c84 <+708>: movq -0x30(%rbp), %rax
(lldb) bt all
* thread #1, name = 'xcodebuild', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
* frame #0: 0x00007ffff80f1c7a dyld`_platform_memmove + 698
frame #1: 0x00007ffff80f1d65 dyld`memcpy + 37
frame #2: 0x00007ffff802c64e dyld`realloc + 46
frame #3: 0x00007ffff8054afd dyld`reallocf + 29
frame #4: 0x00007ffff804c5ea dyld`__opendir_common + 490
frame #5: 0x00007ffff804c339 dyld`__opendir2$INODE64 + 73
frame #6: 0x00007ffff804c2ea dyld`opendir$INODE64 + 26
frame #7: 0x00007ffff8022946 dyld`dyld::checkFrameworkOverridesInDir(char const*) + 102
frame #8: 0x00007ffff80180e4 dyld`dyld::checkVersionedPaths() + 132
frame #9: 0x00007ffff80148c0 dyld`dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) + 2720
frame #10: 0x00007ffff802beba dyld`dyldbootstrap::start(macho_header const*, int, char const**, long, macho_header const*, unsigned long*) + 202
frame #11: 0x00007ffff804acba dyld`_dyld_start + 54
(lldb) register read
General Purpose Registers:
rax = 0x0000000000000ff8
rbx = 0x00007fffffdfcab8
rcx = 0x00007ffff8130128 dyld`initialPoolContent + 21304
rdx = 0x0000000000000000
rdi = 0x00007ffff812f128 dyld`initialPoolContent + 17208
rsi = 0x0000000000000000
rbp = 0x00007fffffdfc640
rsp = 0x00007fffffdfc640
r8 = 0x0000000000000000
r9 = 0x0000000000000000
r10 = 0x0000000000000000
r11 = 0x0000000000000246
r12 = 0x00000000004025c0
r13 = 0x00007ffe429773e0
r14 = 0x9289b688e0b539c2
r15 = 0x0000000000000000
rip = 0x00007ffff80f1c7a dyld`_platform_memmove + 698
rflags = 0x0000000000010213
cs = 0x0000000000000033
fs = 0x0000000000000000
gs = 0x0000000000000000
One point dyld reaches before crashing: calling __opendir_common
with parameters (based on register values):
fd
: 3
name
: /Volumes/SystemRoot/home/andrew/Applications/Xcode.app/Contents/MacOS/../SystemFrameworks
flags
: 3
That flag means:
__opendir_common
triggers EXC_BAD_ACCESS when making this call:
https://github.com/darlinghq/darling/blob/master/src/libc/gen/FreeBSD/opendir.c#L169
but it sometimes crashes earlier in opendir here:
(lldb) bt
* thread #1, name = 'Xcode', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
* frame #0: 0x00007ffff80b88cd dyld`__simple_sprintf + 13
frame #1: 0x00007ffff80d25ad dyld`vchroot_fdpath + 77
frame #2: 0x00007ffff80b9318 dyld`fdpath + 56
frame #3: 0x00007ffff80ca191 dyld`sys_fstatfs64 + 209
frame #4: 0x00007ffff80d294b dyld`_darling_bsd_syscall + 50
frame #5: 0x00007ffff80b733a dyld`fstatfs$INODE64 + 10
frame #6: 0x00007ffff804c462 dyld`__opendir_common + 242
frame #7: 0x00007ffff8120e00 dyld`initialPoolContent + 16
Debugging this is difficult because there aren't debug symbols for dyld
File descriptor #3 was /Applications/Xcode.app/Contents/SystemFrameworks
It crashes calling reallocf
in opendir as reallocf(NULL, 1000)
Some how the memory allocator has gotten messed up previously in the execution is my guess. That's supposed to be identical to malloc(1000)
according to the man page.
Note, this is statically linked __opendir
inside of dyld
, so debugging is difficult and you need to look at the registers. We also can't step around in lldb yet really.
It crashes because dyld's realloc doesn't check the source pointer for nullity and tries to memcpy the contents. I guess XNU maps "page zero" also into processes we don't map it into, but the workaround is simple.
Current state:
Darling [/Applications]$ /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild
dyld: Library not loaded: @rpath/libswiftCore.dylib
Referenced from: /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild
Reason: image not found
abort_with_payload: reason: Library not loaded: @rpath/libswiftCore.dylib
Referenced from: /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild
Reason: image not found; code: 1
Abort trap: 6
which happens because current XCode requires /usr/lib/swift/*.dylib
. We need to start building these Swift libraries.
Are those are open source (i.e. part of apple/swift)? libswiftCore
is Swift's standard library, right? Also, I see apple/swift-corelibs-foundation and apple/swift-corelibs-libdispatch are available, so we don't have to reimplement those (if they're compatible with Darling). Unfortunately, many of the other libraries in /usr/lib/swift
are private Apple libraries:
libswiftAccelerate.dylib libswiftCoreMedia.dylib libswiftMetal.dylib libswiftRemoteMirror.dylib
libswiftAppKit.dylib libswiftCoreMIDI.dylib libswiftMetalKit.dylib libswiftRemoteMirrorLegacy.dylib
libswiftAVFoundation.dylib libswiftCoreML.dylib libswiftMetricKit.dylib libswiftSafariServices.dylib
libswiftCallKit.dylib libswiftCreateML.dylib libswiftModelIO.dylib libswiftSceneKit.dylib
libswiftCloudKit.dylib libswiftCryptoTokenKit.dylib libswiftNaturalLanguage.dylib libswiftsimd.dylib
libswiftCompression.dylib libswiftDarwin.dylib libswiftNetwork.dylib libswiftSpeech.dylib
libswiftContacts.dylib libswiftDemangle.dylib libswiftObjectiveC.dylib libswiftSpriteKit.dylib
libswiftCoreAudio.dylib libswiftDispatch.dylib libswiftOpenCL.dylib libswiftSwiftOnoneSupport.dylib
libswiftCoreData.dylib libswiftFoundation.dylib libswiftos.dylib libswiftVision.dylib
libswiftCore.dylib libswiftGameplayKit.dylib libswiftOSLog.dylib libswiftXCTest.dylib
libswiftCoreFoundation.dylib libswiftGLKit.dylib libswiftPencilKit.dylib libswiftXPC.dylib
libswiftCoreGraphics.dylib libswiftIntents.dylib libswiftPhotos.dylib
libswiftCoreImage.dylib libswiftIOKit.dylib libswiftQuartzCore.dylib
libswiftCoreLocation.dylib libswiftMapKit.dylib libswiftRemoteMirror42.dylib
Building may be easy, but Linux distributions don't commonly provide packages of the Swift compiler.
I'm looking into our options (e.g. building swiftc
just like we build ld64
), but the easiest way would be to tell the user to download the pre-built Swift package from swift.org and point CMake to it.
Also, I see apple/swift-corelibs-foundation and apple/swift-corelibs-libdispatch are available
Those are for non-Darwin platforms. On Darwin/macOS, the regular Foundation and libdispatch, which we already have, are used.
Instead of building the swift standard library dylibs from source, we could download them upon prefix creation, much like how Wine installs Mono.
They are available here: https://swift.org/download/#releases
We can download and install the toolchain PKG. The libs are in /Library/Developer/Toolchains/swift-latest.xctoolchain/usr/lib/swift/macosx/
once the package is installed and we can symlink them into /usr/lib
.
Swift libs are now installed with Darling. The next problem:
dyld: Library not loaded: /System/Library/PrivateFrameworks/CoreAnalytics.framework/Versions/A/CoreAnalytics
Referenced from: /Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation
Reason: image not found
xcodebuild
now segfaults due to missing AssetCacheServices.framework
:
Darling [~/git/TextEdit]$ xcodebuild .
dyld: Library not loaded: /System/Library/PrivateFrameworks/AssetCacheServices.framework/Versions/A/AssetCacheServices
Referenced from: /Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation
Reason: image not found
abort_with_payload: reason: Library not loaded: /System/Library/PrivateFrameworks/AssetCacheServices.framework/Versions/A/AssetCacheServices
Referenced from: /Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation
Reason: image not found; code: 1
Abort trap: 6 (core dumped)
Next up:
Darling [~/git/TextEdit]$ xcodebuild .
dyld: Library not loaded: /System/Library/Frameworks/UserNotifications.framework/Versions/A/UserNotifications
Referenced from: /Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation
Reason: image not found
abort_with_payload: reason: Library not loaded: /System/Library/Frameworks/UserNotifications.framework/Versions/A/UserNotifications
Referenced from: /Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation
Reason: image not found; code: 1
Abort trap: 6 (core dumped)
Next up:
Darling [~/git/TextEdit]$ xcodebuild . dyld: Library not loaded: /System/Library/Frameworks/UserNotifications.framework/Versions/A/UserNotifications Referenced from: /Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation Reason: image not found abort_with_payload: reason: Library not loaded: /System/Library/Frameworks/UserNotifications.framework/Versions/A/UserNotifications Referenced from: /Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation Reason: image not found; code: 1 Abort trap: 6 (core dumped)
xcodebuild have same error. have any workaround?
I need use xcresulttool but get this error. How to fix it?
Darling [~]$ /Applications/Xcode.app/Contents/Developer/usr/bin/xcresulttool
dyld: Symbol not found: _NSURLSessionDownloadTaskResumeData
Referenced from: /usr/lib/swift/libswiftFoundation.dylib (which was built for Mac OS X 10.9)
Expected in: /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
in /usr/lib/swift/libswiftFoundation.dylib
abort_with_payload: reason: Symbol not found: _NSURLSessionDownloadTaskResumeData
Referenced from: /usr/lib/swift/libswiftFoundation.dylib (which was built for Mac OS X 10.9)
Expected in: /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
in /usr/lib/swift/libswiftFoundation.dylib; code: 4
Abort trap: 6 (core dumped)
xcodebuild
now segfaults here:
(lldb) bt
* thread #1, stop reason = signal SIGSTOP
* frame #0: 0x00007ffff5b2097f libobjc.A.dylib`_objc_retain [inlined] class_data_bits_t::getBit(this=0x0000696c70704148, bit=4) const at objc-runtime-new.h:1142
frame #1: 0x00007ffff5b2097f libobjc.A.dylib`_objc_retain [inlined] objc_class::hasCustomRR(this=0x0000696c70704128) const at objc-runtime-new.h:1276
frame #2: 0x00007ffff5b2097f libobjc.A.dylib`_objc_retain [inlined] objc_object::retain(this=0x00007f8571401c10) at objc-object.h:459
frame #3: 0x00007ffff5b2097c libobjc.A.dylib`_objc_retain(obj=0x00007f8571401c10) at NSObject.mm:1588
frame #4: 0x00007ffff774ca3b Foundation`pointerFunctionsAssign(PF=0x00007f85914c7208, addr=0x00007f85914c6dd8, value=0x00007f8571401c10) at NSConcreteHashTableInternal.h:129
frame #5: 0x00007ffff7749acc Foundation`pointerFunctionsAcquire(PF=0x00007f85914c7208, dst=0x00007f85914c6dd8, src=0x00007f8571401c10) at NSConcreteHashTableInternal.h:149
frame #6: 0x00007ffff7749414 Foundation`GSIMapAddPair(map=0x00007f85914c71b0, key=GSIMapKey @ 0x00007fffe4d767e8, value=GSIMapVal @ 0x00007fffe4d767e0) at GSIMap.h:1069
frame #7: 0x00007ffff774991e Foundation`NSMapInsert(table=0x00007f85914c71b0, key=0x00007f8571401980, value=0x00007f8571401ae0) at NSConcreteMapTable.m:650
frame #8: 0x00007ffff6e16d79 DVTFoundation`-[DVTFilePathEventWatcher _setupStream] + 1032
frame #9: 0x00007ffff6e1717b DVTFoundation`-[DVTFilePathEventWatcher _resetStream] + 110
frame #10: 0x00007ffff6e16826 DVTFoundation`__41-[DVTFilePathEventWatcher watchFilePath:]_block_invoke + 1135
frame #11: 0x00007ffff70095c4 DVTFoundation`__DVT_CALLING_CLIENT_BLOCK__ + 7
frame #12: 0x00007ffff700b206 DVTFoundation`__DVTDispatchAsync_block_invoke + 1194
frame #13: 0x00007ffff494e59e libdispatch.dylib`_dispatch_call_block_and_release(block=0x00007f85914c75e0) at init.c:1405
frame #14: 0x00007ffff496d76a libdispatch.dylib`_dispatch_client_callout(ctxt=0x00007f85914c75e0, f=(libdispatch.dylib`_dispatch_call_block_and_release at init.c:1403)) at object.m:498
frame #15: 0x00007ffff497bbd3 libdispatch.dylib`_dispatch_lane_serial_drain at inline_internal.h:2497
frame #16: 0x00007ffff497b908 libdispatch.dylib`_dispatch_lane_serial_drain [inlined] _dispatch_continuation_pop_inline(dou=dispatch_object_t @ 0x00007fffe4d770a0, dic=0x00007fffe4d77ab8, flags=DISPATCH_INVOKE_WORKER_DRAIN, dqu=dispatch_queue_class_t @ 0x00007fffe4d77098) at inline_internal.h:2540
frame #17: 0x00007ffff497b822 libdispatch.dylib`_dispatch_lane_serial_drain [inlined] _dispatch_lane_drain(dq=0x00007f85914c7300, dic=0x00007fffe4d77ab8, flags=DISPATCH_INVOKE_WORKER_DRAIN, owned_ptr=0x00007fffe4d77638, serial_drain=true) at queue.c:3729
frame #18: 0x00007ffff497a4f4 libdispatch.dylib`_dispatch_lane_serial_drain(dqu=dispatch_lane_class_t @ 0x00007fffe4d76db0, dic=0x00007fffe4d77ab8, flags=DISPATCH_INVOKE_WORKER_DRAIN, owned=0x00007fffe4d77638) at queue.c:3774
frame #19: 0x00007ffff497e94e libdispatch.dylib`_dispatch_lane_invoke2(dq=0x00007f85914c7300, dic=0x00007fffe4d77ab8, flags=196608, owned=0x00007fffe4d77638) at queue.c:3856
frame #20: 0x00007ffff497e0eb libdispatch.dylib`_dispatch_lane_invoke at inline_internal.h:1851
frame #21: 0x00007ffff497d7bd libdispatch.dylib`_dispatch_lane_invoke(dq=0x00007f85914c7300, dic=0x00007fffe4d77ab8, flags=196608) at queue.c:3866
frame #22: 0x00007ffff4997a4e libdispatch.dylib`_dispatch_root_queue_drain [inlined] _dispatch_continuation_pop_inline(dou=dispatch_object_t @ 0x00007fffe4d77c18, dic=0x00007fffe4d77ab8, flags=196608, dqu=dispatch_queue_class_t @ 0x00007fffe4d77c10) at inline_internal.h:2538
frame #23: 0x00007ffff4997995 libdispatch.dylib`_dispatch_root_queue_drain(dq=0x00007ffff49cf580, pri=2214608896, flags=196608) at queue.c:6579
frame #24: 0x00007ffff4998c21 libdispatch.dylib`_dispatch_worker_thread2(pp=2147485951) at queue.c:6617
frame #25: 0x00007ffff47a7af5 libsystem_pthread.dylib`_pthread_wqthread(self=0x00007fffe4d78000, kport=3331, stacklowaddr=0x00007fffe4cf8000, keventlist=0x0000000000000000, flags=475140, nkevents=0) at pthread.c:2298
frame #26: 0x00007ffff47b80bf libsystem_pthread.dylib`start_wqthread + 15
(lldb)
if we can get this working that will be wild
...and now it wants objc-trampolines.dylib
:
objc[51]: couldn't dlopen libobjc-trampolines.dylib: dlopen(/usr/lib/libobjc-trampolines.dylib, 262): image not found
abort_with_payload: reason: couldn't dlopen libobjc-trampolines.dylib: dlopen(/usr/lib/libobjc-trampolines.dylib, 262): image not found; code: 1
Abort trap: 6
Well, xcodebuild
is finally outputting something of its own:
2021-02-24 05:46:29.047 xcodebuild[53:3e8] [MT] DVTPlugInManager: Error obtaining required capabilities for DebuggerFoundation.ideplugin: Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" UserInfo=0x7fdbfb4e0730 {NSLocalizedDescription=No such file or directory}
2021-02-24 05:46:29.048 xcodebuild[53:3e8] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-16142/IDEFoundation/Initialization/IDEInitialization.m:331
Details: Xcode failed its initial plug-in scan, error = Error Domain=DVTPlugInErrorDomain Code=1 "Scanning for plug-ins failed." UserInfo=0x7fdbfb4e1a20 {NSLocalizedFailureReason=Scanning for plug-ins was aborted due to an unknown error, NSLocalizedRecoverySuggestion=You may not have appropriate permission to read or load installed plug-ins., DVTUnderlyingExceptionErrorKey=Tried to init dictionary with nil object, NSLocalizedDescription=Scanning for plug-ins failed.}
Function: BOOL _IDEInitializePlugInManager(IDEInitializationOptions, NSError *__autoreleasing *)
Thread: <NSThread: 0x7fdc5b47a2a0>
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
xcodebuild: error: Initialization failed.
Reason: Scanning for plug-ins failed.
STUB: LSRegisterURL
So xcodebuild
with no arguments now segfaults here:
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x20)
* frame #0: 0x00007ffff5b20a6f libobjc.A.dylib`_objc_release [inlined] class_data_bits_t::getBit(this=0x0000000000000020, bit=4) const at objc-runtime-new.h:1142
frame #1: 0x00007ffff5b20a6f libobjc.A.dylib`_objc_release [inlined] objc_class::hasCustomRR(this=0x0000000000000000) const at objc-runtime-new.h:1276
frame #2: 0x00007ffff5b20a6f libobjc.A.dylib`_objc_release [inlined] objc_object::release(this=0x00007fa8a2484ac0) at objc-object.h:551
frame #3: 0x00007ffff5b20a6c libobjc.A.dylib`_objc_release(obj=0x00007fa8a2484ac0) at NSObject.mm:1598
frame #4: 0x00007ffff595028a CoreFoundation`_NSCFRelease2(allocator=0x00007ffff5994640, value=0x00007fa8a2484ac0) at CFInternal.h:24
frame #5: 0x00007ffff57b2fca CoreFoundation`__CFBasicHashDrain [inlined] __CFBasicHashEjectValue(ht=0x00007fa852404880, stack_value=140362253880000) at CFBasicHash.c:420
frame #6: 0x00007ffff57b2f53 CoreFoundation`__CFBasicHashDrain(ht=0x00007fa852404880, forFinalization='\x01') at CFBasicHash.c:1104
frame #7: 0x00007ffff57b4c85 CoreFoundation`__CFBasicHashDeallocate(cf=0x00007fa852404880) at CFBasicHash.c:1556
frame #8: 0x00007ffff5873d05 CoreFoundation`__CFSetDeallocate(cf=0x00007fa852404880) at CFSet.c:105
frame #9: 0x00007ffff586e21d CoreFoundation`_CFRelease(cf=0x00007fa852404880) at CFRuntime.c:1468
frame #10: 0x00007ffff586df54 CoreFoundation`CFRelease(cf=0x00007fa852404880) at CFRuntime.c:558
frame #11: 0x00007ffff59501b9 CoreFoundation`-[__NSCFSet release](self=0x00007fa852404880, _cmd="release") at NSSet.m:994
frame #12: 0x00007ffff6d72ddd DVTFoundation`-[DVTPlugInScanRecord .cxx_destruct] + 31
frame #13: 0x00007ffff5b29446 libobjc.A.dylib`::object_cxxDestruct(id) [inlined] object_cxxDestructFromClass(obj=<unavailable>, cls=<unavailable>) at objc-class.mm:452
frame #14: 0x00007ffff5b29421 libobjc.A.dylib`::object_cxxDestruct(obj=<unavailable>) at objc-class.mm:467
frame #15: 0x00007ffff5b4ce18 libobjc.A.dylib`::objc_destructInstance(obj=<unavailable>) at objc-runtime-new.mm:7681
frame #16: 0x00007ffff5b4cee3 libobjc.A.dylib`::object_dispose(obj=<unavailable>) at objc-runtime-new.mm:7700
frame #17: 0x00007ffff592718a CoreFoundation`_NSCFRelease2(allocator=0x00007ffff5994640, value=0x00007fa8a2448d50) at CFInternal.h:24
frame #18: 0x00007ffff57a0fd3 CoreFoundation`__CFArrayReleaseValues(array=@"58 elements", range=location=0 length=58, releaseStorageIfPossible=true) at CFArray.c:226
frame #19: 0x00007ffff57a2ca6 CoreFoundation`__CFArrayDeallocate(cf=@"58 elements") at CFArray.c:345
frame #20: 0x00007ffff586e21d CoreFoundation`_CFRelease(cf=@"58 elements") at CFRuntime.c:1468
frame #21: 0x00007ffff586df54 CoreFoundation`CFRelease(cf=@"58 elements") at CFRuntime.c:558
frame #22: 0x00007ffff5926a29 CoreFoundation`-[__NSCFArray release](self=@"58 elements", _cmd="release") at NSArray.m:2026
frame #23: 0x00007ffff6f95b2c DVTFoundation`-[DVTPlugInManager _pruneUnusablePlugInsAndScanRecords:linkedFrameworkPaths:] + 5507
frame #24: 0x00007ffff6f8f55e DVTFoundation`-[DVTPlugInManager _scanForPlugIns:] + 843
frame #25: 0x00007ffff5d8e7e7 IDEFoundation`IDEInitialize + 4864
frame #26: 0x00007ffff5bf3858 Xcode3Core`-[Xcode3CommandLineBuildTool run] + 1467
frame #27: 0x00007ffff7ff707f xcodebuild`main + 1301
frame #28: 0x00007ffff47eeef5 libdyld.dylib`start + 1
But xcodebuild -license
gets some more progress:
You have not agreed to the Xcode license agreements. You must agree to both license agreements below in order to use Xcode.
Hit the Return key to view the license agreements at '/Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf'
sh: textutil: command not found
By typing 'agree' you are agreeing to the terms of the software license agreements. Type 'print' to print them or anything else to cancel, [agree, print, cancel] agree
STUB: LSRegisterURL
Unfortunately, it doesn't succeed, because it returns an exit code of 69 and asks again next time.
New output:
Oh and the license agreement only fails because it tries to write to a file in /Library/Preferences
but that directory doesn't exist. Creating it is enough for the license agreement to succeed, so we should install that directory (even if it's empty).
Awesome!! Getting there :tada:
Hi, everyone! I made the STUB for all the missing libraries, constants and functions to run xcodbuild 12.4, but i ran into problem - i got message that i could not accept the license, i tried to call the acceptance of the agreement: sudo xcodebuild -license accept
, but no reaction occurred, xtrace is showing that the application is trying to open the Preference on the path /Library/Preferences. Could you please tell me where I should look for the problem?
PS the xtrace in attachement
xtrace.log
@pperehozhih I believe it's an issue of /Library/Preferences
not existing. We should modify our build to create this directory as an empty directory on install.
Note that my testing until now has been with Xcode 11, not 12.
By the way, quick update on the current progress: with Xcode 11 and the latest commit on master, xcodebuild
in a project actually spawns a service to process the project and set up the build, but this currently hangs while setting up the build, with both processes (xcodebuild
and the helper service) just sleeping. It seems to be a deadlock: the helper service is waiting for input from xcodebuild
and xcodebuild
is waiting for input from the helper service.
Using the command line tools included with Xcode should work now. Doing xcode-select --switch /Applications/Xcode.app
and using the tools works now. What doesn't work properly is certain individual tools, e.g. LLDB (it fails to connect to its debug server).
Note that xcodebuild
itself still doesn't work; seems to be a communication failure between XCBuildService and xcodebuild.
any progress on this ? :)
It actually runs stuff! (doesn't successfully build yet, of course 😄)
This is the result of running xcodebuild
(Xcode 11.7) on https://github.com/facekapow/xcode-helloworld with Darling on the launchd-session
branch:
With the latest code on master
, xcodebuild
and ibtoold
no longer crash!
However, builds still fail because Interface Builder can’t determine the type of “MainMenu.xib”. This may be due to a missing SDK.
After a bit of debugging, this seems to be because we don't have a proper Uniform Type database set up (which would require launchservicesd
to be working): ibtoold
provides UTI information for XIBs and NIBs in its Info.plist
, but since we don't scan that into our UTI database, it's as though the file type doesn't exist.
Something to that effect has been added in https://github.com/darlinghq/darling-corefoundation/pull/6?
I'll test with that and see, but I think that still gets its info from the UTI database, which we're not currently creating because we don't have a working launchservicesd
.
I have an impression it has worked at least somewhat for @CKegel? You need to load the launchd plist which we don't install.
Just tried it and unfortunately I get the same thing. However, I did load up the database with sqlite
and found all the information is scanned and stored correctly, so it seems my initial assumption of this being a UTI database issue was wrong.
Looks like I might have to debug and fix LLDB so I can debug this, since it currently loses connection with the process after the first breakpoint.
As it turned out, the problem was that our implementation of -[NSFileManager contentsOfDirectoryAtPath:error:]
was wrong: for paths that aren't directories, we were returning an empty array along with an error (if given an error pointer). However, we're supposed to return nil
in such cases, and Xcode relies on this behavior to tell if something is actually a file or directory. (https://github.com/darlinghq/darling-foundation/commit/572a76a8b860d5919db88ecffaa32a06564dd286)
With that out of the way, ibtoold
is now progressing further and crashing once again! I'll check it out tomorrow.
With the latest commit (fe0da14074c364bc9f06a33d899ea3eb0c361742), my Hello World app compiles and runs successfully under both Darling and macOS!
There are of course some things still missing/unimplemented. Most notably, all the menu items are broken: under macOS, they're completely missing; under Darling, they all have empty names and no children. This is likely because the current implementation of -[NSMenuItem encodeWithCoder:]
uses the wrong key names.
This is likely because the current implementation of -[NSMenuItem encodeWithCoder:] uses the wrong key names.
I'd be happy to correct this issue if you'd like.
That'd be great, thanks!
Any chance to build something for iOS?