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?
1
0
489
Feb ’23
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
655
Aug ’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.
1
0
708
Feb ’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
5.5k
Jun ’20
Can't load 3rd party library
I am trying to load the R library (R 4.0.0 available from https://cran.r-project.org) from my signed and notarized app.But this is what I get on the console:dyld: Library not loaded: /Library/Frameworks/R.framework/Versions/Current/Resources/lib/libR.dylib Referenced from: /Users/hecht/Library/Developer/Xcode/DerivedData/JMP-dgmxmeayjbgthlckfcezeplzucmk/Build/Products/Debug/JMP.app/Contents/Frameworks/tkext//tkrproxy Reason: no suitable image found. Did find: /Library/Frameworks/R.framework/Versions/Current/Resources/lib/libR.dylib: code signature in (/Library/Frameworks/R.framework/Versions/Current/Resources/lib/libR.dylib) not valid for use in process using Library Validation: mapping process has no Team ID and is not a platform binary /Library/Frameworks/R.framework/Versions/Current/Resources/lib/libR.dylib: stat() failed with errno=1 /Library/Frameworks/R.framework/Versions/Current/Resources/lib/libR.dylib: stat() failed with errno=1I have checked that libR.dylib has LC_VERSION_MIN_MACOSX set:% otool -l /Library/Frameworks/R.framework/Versions/Current/Resources/lib/libR.dylib | grep -B 1 -A 3 LC_VERSION_MIN Load command 8 cmd LC_VERSION_MIN_MACOSX cmdsize 16 version 10.13 sdk 10.15I have checked that the library's load path is absolute and doesn't include @rpath:% otool -D /Library/Frameworks/R.framework/Versions/Current/Resources/lib/libR.dylib /Library/Frameworks/R.framework/Versions/Current/Resources/lib/libR.dylib: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libR.dylibMy app has com.apple.security.cs.disable-library-validation set to YES.What am I missing?
5
0
1.6k
May ’20
Xcode 11.4: How to suppress OpenGL deprecation warning?
New with Xcode 11.4, I get this warning: "OpenGL is deprecated. Consider migrating to Metal instead." Clicking the warning takes me to our app's target settings, in the "Frameworks, Libraries, and Embedded Content" section, where we have added a reference to OpenGL.framework.This is an issue that we are quite aware of already. We are currently working on migrating to Metal, but we have not yet fully switched over.Meanwhile, I'd like to roll out this new Xcode version to our entire development team. But the presence of this warning violates our Zero Warnings policy. Is there a way to suppress it? Given the location and specificity of the warning, it seems like it's a special case and not something generic. I read through the Xcode 11.4 Release Notes but saw no mention of the new warning.[Apologies if this is the wrong subgroup. I was looking for a "build system" subgroup but couldn't find one.]--Michael Hecht
1
0
5k
Apr ’20