Post

Replies

Boosts

Views

Activity

'leaks' message
My app has a debugging mode in which it invokes 'leaks' on itself. I am now seeing this message on stderr: Target process is an ancestor and permitting live process for ancestors so not generating a corpse to save resources by default. This sort of makes sense, but I would like a more detailed explanation. Is there some option I should be sending to 'leaks' to operate in a better mode? Should I be invoking it differently?
3
0
768
Feb ’25
Changes to CGLayerRef in Ventura?
My app uses CGLayerRef to do some of its drawing. With Ventura, this doesn't work reliably. I'm wondering if there have been changes to CGLayerRef that might account for this new undesired behavior? I did not see anything in the release notes regarding it. To be more specific, sometimes some of the drawing I do does not seem to make it to the layer. So when the layer is later drawn it appears that some of my window content is missing. I would replicate this in a sample app if I could, but it is not possible.
0
0
747
Aug ’22
How to change DYLD_LIBRARY_PATH at runtime?
Hello, I've searched for other posts on this topic but I haven't found anything that provides an answer.Here's my test program snippet, using the Xcode Mac Application Obj-C starter project:- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { // Insert code here to initialize your application char const * dyld_library_path_original = getenv("DYLD_LIBRARY_PATH"); char dyld_library_path_new[1024]; strcpy(dyld_library_path_new, "/Applications/MATLAB_R2020a.app/bin/maci64:"); strcat(dyld_library_path_new, dyld_library_path_original); int rc = setenv("DYLD_LIBRARY_PATH", dyld_library_path_new, 1); NSLog(@"DYLD_LIBRARY_PATH=%s, rc=%d", getenv("DYLD_LIBRARY_PATH"), rc); void * handle1 = dlopen("libeng.dylib", RTLD_NOW); NSLog(@"Test 1: dlopen(libeng.dylib) = %p, err=%s", handle1, dlerror()); void * handle2 = dlopen("/Applications/MATLAB_R2020a.app/bin/maci64/libeng.dylib", RTLD_NOW); NSLog(@"Test 2: dlopen(libeng.dylib) = %p, err=%s", handle2, dlerror()); }As you can see, I'm trying to dlopen a dylib in the installed MATLAB application. But I don't think the specific dylib matters. What matters is that I'm dlopening it using just the leaf name of the path, after setting DYLD_LIBRARY_PATH at runtime to include MATLAB's dir (Test 1). This fails.But when I dlopen it with the full path (Test 2) it works. Here's the output:DYLD_LIBRARY_PATH=/Applications/MATLAB_R2020a.app/bin/maci64:/Users/hecht/Library/Developer/Xcode/DerivedData/TestML-droybqyctybedebamivvyiixjhnn/Build/Products/Debug:/usr/lib/system/introspection, rc=0 Test 1: dlopen(libeng.dylib) = 0x0, err=dlopen(libeng.dylib, 2): image not found Test 2: dlopen(libeng.dylib) = 0x6000039041a0, err=(null)I have Hardened Runtime enabled, with these entitlements turned on:Allow DYLD Environment VariablesDisable Library ValidationThe second one is doing its job, because without it, Test 2 fails also.But the first one doesn't help in allowing me to modify DYLD_LIBRARY_PATH at runtime. If I set the environment variable before launching (Xcode > Product > Scheme > Edit Scheme > Arguments > Environment Variables) then Test 1 works. Is there a way to get dyld to honor changes to this environment variable made at runtime?
5
0
6k
Mar ’22
Controlling process architecture from Cocoa?
From Cocoa, how can I do the following two things: Determine the architectures available within a binary? The equivalent of 'file foo.dylib', but by calling an API rather than launching a task to run that command. Launch a process using a specific architecture in a universal binary, say an executable with both arm64 and x86_64, and I want to launch the x86_64 arch on an M1 Mac. The equivalent of 'arch -arch x86_64 foo', but perhaps by specifying an option to NSTask rather than launching an 'arch' task.
Topic: UI Frameworks SubTopic: AppKit Tags:
1
0
823
Feb ’22
'leaks' message
My app has a debugging mode in which it invokes 'leaks' on itself. I am now seeing this message on stderr: Target process is an ancestor and permitting live process for ancestors so not generating a corpse to save resources by default. This sort of makes sense, but I would like a more detailed explanation. Is there some option I should be sending to 'leaks' to operate in a better mode? Should I be invoking it differently?
Replies
3
Boosts
0
Views
768
Activity
Feb ’25
Command-line tool for .ips files?
So apparently Monterey has switched to creating .ips files instead of .crash files for application crashes. Console.app can convert these .ips files to "old-style" crash format. But is there a command-line tool to do the same thing?
Replies
9
Boosts
1
Views
7.4k
Activity
Aug ’24
Changes to CGLayerRef in Ventura?
My app uses CGLayerRef to do some of its drawing. With Ventura, this doesn't work reliably. I'm wondering if there have been changes to CGLayerRef that might account for this new undesired behavior? I did not see anything in the release notes regarding it. To be more specific, sometimes some of the drawing I do does not seem to make it to the layer. So when the layer is later drawn it appears that some of my window content is missing. I would replicate this in a sample app if I could, but it is not possible.
Replies
0
Boosts
0
Views
747
Activity
Aug ’22
How to change DYLD_LIBRARY_PATH at runtime?
Hello, I've searched for other posts on this topic but I haven't found anything that provides an answer.Here's my test program snippet, using the Xcode Mac Application Obj-C starter project:- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { // Insert code here to initialize your application char const * dyld_library_path_original = getenv("DYLD_LIBRARY_PATH"); char dyld_library_path_new[1024]; strcpy(dyld_library_path_new, "/Applications/MATLAB_R2020a.app/bin/maci64:"); strcat(dyld_library_path_new, dyld_library_path_original); int rc = setenv("DYLD_LIBRARY_PATH", dyld_library_path_new, 1); NSLog(@"DYLD_LIBRARY_PATH=%s, rc=%d", getenv("DYLD_LIBRARY_PATH"), rc); void * handle1 = dlopen("libeng.dylib", RTLD_NOW); NSLog(@"Test 1: dlopen(libeng.dylib) = %p, err=%s", handle1, dlerror()); void * handle2 = dlopen("/Applications/MATLAB_R2020a.app/bin/maci64/libeng.dylib", RTLD_NOW); NSLog(@"Test 2: dlopen(libeng.dylib) = %p, err=%s", handle2, dlerror()); }As you can see, I'm trying to dlopen a dylib in the installed MATLAB application. But I don't think the specific dylib matters. What matters is that I'm dlopening it using just the leaf name of the path, after setting DYLD_LIBRARY_PATH at runtime to include MATLAB's dir (Test 1). This fails.But when I dlopen it with the full path (Test 2) it works. Here's the output:DYLD_LIBRARY_PATH=/Applications/MATLAB_R2020a.app/bin/maci64:/Users/hecht/Library/Developer/Xcode/DerivedData/TestML-droybqyctybedebamivvyiixjhnn/Build/Products/Debug:/usr/lib/system/introspection, rc=0 Test 1: dlopen(libeng.dylib) = 0x0, err=dlopen(libeng.dylib, 2): image not found Test 2: dlopen(libeng.dylib) = 0x6000039041a0, err=(null)I have Hardened Runtime enabled, with these entitlements turned on:Allow DYLD Environment VariablesDisable Library ValidationThe second one is doing its job, because without it, Test 2 fails also.But the first one doesn't help in allowing me to modify DYLD_LIBRARY_PATH at runtime. If I set the environment variable before launching (Xcode > Product > Scheme > Edit Scheme > Arguments > Environment Variables) then Test 1 works. Is there a way to get dyld to honor changes to this environment variable made at runtime?
Replies
5
Boosts
0
Views
6k
Activity
Mar ’22
Controlling process architecture from Cocoa?
From Cocoa, how can I do the following two things: Determine the architectures available within a binary? The equivalent of 'file foo.dylib', but by calling an API rather than launching a task to run that command. Launch a process using a specific architecture in a universal binary, say an executable with both arm64 and x86_64, and I want to launch the x86_64 arch on an M1 Mac. The equivalent of 'arch -arch x86_64 foo', but perhaps by specifying an option to NSTask rather than launching an 'arch' task.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
1
Boosts
0
Views
823
Activity
Feb ’22