Posts

Post not yet marked as solved
8 Replies
681 Views
I'm having a hard time relying on TSAN to detect problems due to its rightful insistence on reporting data-races (I know, stick with me). Picture the following implementation of a lazily-allocated property in an Obj-C class: @interface MyClass { id _myLazyValue; // starts as nil as all other Obj-C ivars } @end @implementation MyClass - (id)myLazyValue { if (_myLazyValue == nil) { @synchronized(self) { if (_myLazyValue == nil) { _myLazyValue = <expensive computation> } } } return _myLazyValue; } @end The first line in the method is reading a pointer-sized chunk of memory outside of the protection provided by the @synchronized(...) statement. That same value may be written by a different thread within the execution of the @synchronized block. This is what TSAN complains about, but I need it not to. The code above ensures the ivar is written by at most one thread. The read is unguarded, but it is impossible for any thread to read a non-nil value back that is invalid, uninitialized or unretained. Why go through this trouble? Such a lazily-allocated property usually locks on @synchronized once, until (at most) one thread does any work. Other threads may be temporarily waiting on the same lock but again only while the value is being initialized. The cost of allocation and initialization is guaranteed to be paid once: multiple threads cannot initialize the value multiple times (that’s the reason for the second _myLazyValue == nil check within the scope of the @synchronized block). Subsequent accesses of the initialized property skip locking altogether, which is exactly the performance we want from a lazily-allocated, immutable property that still guarantees thread-safe access. Assuming there isn't a big embarrassing hole in my logic, is there a way to decorate specific portions of our sources (akin to #pragma statements that disable certain warnings) so that you can mark any read/write access to a specific value as "safe"? Is the most granular tool for this purpose the __attribute__((no_sanitize("thread")))? Ideally one would want to ask TSAN to ignore only specific read/writes, rather than the entire body of a function. Thank you!
Posted
by FxFactory.
Last updated
.
Post marked as solved
21 Replies
28k Views
Offering this here for those who may run into the same issue... There is more than one reason you may get the following error message when attempting to build your targets: Cycle inside ...; building could produce unreliable results But if you just switched to Xcode 15 and you are currently customizing DSTROOT to set the root install location for the deliverables (app, bundle, etc) built by your Target, Xcode 15 will refuse to build any target with dependencies on other targets that use the same underlying configuration. There is obviously no real cycle: Xcode 15 is just confused by both targets sharing the same DSTROOT. For example, if you set up your projects with: DSTROOT=/ INSTALL_PATH=/Applications (notice that DSTROOT=/ is even mentioned in the docs) Xcode will wrongfully detect a circular dependency as both targets share the build destination and thus refuse to build. The solution is to not customize DSTROOT, thus allowing it to have a directory name that is target-dependent and thus fairly immune to collisions. Instead, customize the INSTALL_ROOT setting. While this setting does not appear in the Build Phases tab, it defaults to reusing the DSTROOT value. If you set it explicitly, it allows DSTROOT to remain for other purposes, while using the value of INSTALL_ROOT to deploy your deliverables: INSTALL_ROOT=/ INSTALL_PATH=/Applications This allows the build system to proceed without errors.
Posted
by FxFactory.
Last updated
.
Post not yet marked as solved
0 Replies
361 Views
Having just downloaded the newly posted Xcode 15 Beta 3, it shows an "Apple Internal" badge on the debugging/console toolbar. The Dock icon spells the build number. Anyone else seeing the same? Has this been rectified on the developer Downloads section?
Posted
by FxFactory.
Last updated
.
Post not yet marked as solved
0 Replies
452 Views
Xcode 15 warns you when targets contain a Build Carbon Resources phase. The solution is to drag all your .r files to the Copy Bundle Resources phase instead, and deleting the now-empty Build Carbon Resources phase. Beware that after this change your project is unlikely to build correctly with Xcode 14. While both versions of Xcode support .r files in the Copy Bundle Resources phase, invoking Rez to compile your inputs, Xcode 14 incorrectly outputs a .rsrc file whose name matches the input .r file (MyResources.r → MyResources.rsrc). This is wrong, since the Carbon Resource Manager recognizes only one file containing Carbon resources (AFAIK) and its name must match the bundle executable. If your executable is named Foo, your Carbon resources should be in a Foo.rsrc file or else they will be ignored. It is unclear if Xcode 15 is smart enough to merge the output of multiple .r files into a single .rsrc. Lucky me I don't need that functionality for my targets but it's something else to look out for. ...and for those in utter disbelief that in 2023 there are still people talking about and using Carbon Resources as designed and implemented in the 80s... welcome to the world of third-party plug-ins for Adobe apps ;-)
Posted
by FxFactory.
Last updated
.
Post not yet marked as solved
11 Replies
3.2k Views
Hi,My software installs frameworks in the local domain (/Library/Frameworks) that are accessed from third-party apps. Some of these apps are simply code-signed, others are sandboxed. They are obviously signed by other companies, and so far there have been no problems on the part of DYLD in loading and executing code inside our frameworks. The loader is happy to continue looking for our framework outside the app container, in the case of sandboxed apps.What changes are necessary to ensure that our frameworks remain accessible from hardened apps? Hardened Runtime, to the best of my understanding, only allows executables to load code that has been code-signed by the same team, or by Apple. I also think that hardened runtime affects only executables, and yet when I enable the ENABLE_HARDENED_RUNTIME setting in Xcode on my framework targets (via xcconfig) it clearly influences the way they are signed, and suddenly these "hardened frameworks" fail to be loaded by third-party apps, even if these apps aren't yet hardened themselves. In what its perhaps the key to solving this issue, how can one mark non-app targets to enable the library-validation exception? Why would a non-hardened app fail to load code whose only difference may be a simple flag (kill,runtime) in its signature?Maybe I'm wrong to assume that non-app targets deserve any special treatment, but the fact remains that when I enable hardened runtime, our code simply stops being "seen" and loaded by DYLD, with all other variables remaining identical.Thank you!Gabe
Posted
by FxFactory.
Last updated
.
Post not yet marked as solved
2 Replies
1.2k Views
Is anyone else seeing that Xcode 13.2 no longer creates a single default.metallib that combines all *.air files together? (Seeing this with a framework target, at least.) Nothing in the release notes suggests this change... so for now a custom script like the following seems needed: if [ ! -d "${METAL_LIBRARY_OUTPUT_DIR}"/default.metallib ]; then      xcrun -sdk macosx metallib "${TARGET_TEMP_DIR}"/Metal/*.air -o "${METAL_LIBRARY_OUTPUT_DIR}"/default.metallib fi; Would be grateful to know if this is a bug or an intended change in the toolchain. Thanks!
Posted
by FxFactory.
Last updated
.
Post not yet marked as solved
6 Replies
1.6k Views
I would like to be able to write CIKernels that output a lookup table or other blob of data, to be used by subsequent CIKernels.The data generated by such a kernel is fed to subsequent kernels whose corresponsing sampler input has been tagged with the "__table" attribute to disable colormatching for that input. This is a scenario that already works if one has the ability to allocate the CIImage himself, so that a nil colorspace can be passed. But when asking CIKernel for an output image, it is not possible to request an image without a colorspace associated with it. I'm referring to methods like this:- applyWithExtent:roiCallback:arguments:There are also no APIs in Core Image that would allow you to strip colorspace information from an existing image, AFAIK. (As in "hey I know this recipe is tagged with the working/output colorspace, but in reality it contains values that do not encode RGB at all")If I feed the output image from applyWithExtent:... to another kernel whose sampler has the __table attribute, from my observations it still appears to be colormatched. I can see three possibilities:1) I am clearly missing something.2) The __table attribute no longer has the desired effect, perhaps a regression.3) A new API is needed to cover this usage scenario.Any help is greatly appreciated!Best,Gabe
Posted
by FxFactory.
Last updated
.
Post not yet marked as solved
0 Replies
671 Views
Does anyone know why it is impossible to enable/test Private Relay even with an Apple One Premier subscription? Wouldn't it make sense that during the macOS Beta all users would be able to turn in on? This feature looks good on paper but the barrier to testing makes no sense. Any help greatly appreciated.
Posted
by FxFactory.
Last updated
.
Post not yet marked as solved
2 Replies
1.3k Views
The Xcode 13 Beta (1 & 2) is showing some serious performance regressions when building our large project, and wondering if others are noticing the same. If you Build again after a build had just completed, Xcode 13 redoes a ton of work, as visible through the thousands of tasks it takes on. It's as if Xcode 13 lost the ability to skip unnecessary work. Building again in Xcode 12 does incur a small penalty too, but the difference is between 2-3 seconds (Xcode 12) vs 1-2 minutes (Xcode 13). ...and as a side note, the new progress reporter is useless: it switches from reporting progress for one set of tasks (1928/3022 completed) to a completely different set of tasks (444/1255 completed). You never know which "set of tasks" is the last you'll need for the build process as a whole to be done. Any idea why it doesn't display cumulative progress? Thanks!
Posted
by FxFactory.
Last updated
.
Post marked as solved
3 Replies
994 Views
We have a non-sandboxed app that uses a custom URL scheme to allow redirection of certain tasks from Safari to our app, when installed, and with permission from the user. In the latest Beta of Safari 14 on macOS Big Sur Beta, Safari launches our app in its own Sandbox Container. This obviously breaks our software, which expects and requires a "normal" environment. This is a regression in Safari. It still asks for permission before opening every single custom URL. Users still have to install our notarized software beforehand on their systems in order to access these custom URLs. I tried filing a bug. Tried a DTS ticket. No reply to either. Does anyone know of this problem, and know of a workaround? Our software obviously cannot escape Safari’s sandbox container. At best we can detect it, right now, but our software is broken 😫 For the record, if the user launches our app *before* attempting to open the custom URL, then Safari is more than happy to pass along the URL to the running instance of our software (which is great). But if Safari has to launch our app in order to process the custom URL, our app lives within the confines of Safari’s container.
Posted
by FxFactory.
Last updated
.
Post not yet marked as solved
3 Replies
913 Views
Installed the Xcode 12 GM on a couple systems, updating from Beta 6, only to discover that it doesn't include macOS 11 SDK. No indication of this particular change in the release notes. Am I missing something obvious? I would imagine that to be the default SDK, if anything... but instead it defaults to the 10.15 SDK? 🤔 Thanks!
Posted
by FxFactory.
Last updated
.
Post marked as solved
1 Replies
1.9k Views
When looking under /System/Library/Frameworks, it is apparent that while the framework structure is all there, its binary is not. I presume this is due to SIP hiding binaries from the file system. Is there any magic incantation to access those binaries for non-nefarious purposes (e.g. class-dump)? If one gets the NSBundle for one of the classes in AddressBook.framework, for example, its executable path is still reported as: /System/Library/Frameworks/AddressBook.framework/Versions/A/AddressBook ...even though the file isn't part of the file system and thus cannot be accessed. Is there a way to get to the object code without having to disable SIP or otherwise cripple one’s system? Thank you!
Posted
by FxFactory.
Last updated
.
Post not yet marked as solved
1 Replies
698 Views
Is notarization via altool under Xcode 12 Beta 2 and macOS Big Sur Beta supposed to work yet? Altool still works when using the Xcode 11.x tools, but if I switch the command line tools to Xcode 12, any attempt to submit software for notarization via xcrun altool returns error -19,060: "There is no embedded Java executable. Please reinstall the Xcode developer tools." Thanks!
Posted
by FxFactory.
Last updated
.
Post not yet marked as solved
1 Replies
943 Views
Neither the available documentation or WWDC video "All About Notarization" (oh the irony :-)) make any mention of privileged helper tools. Do they need special treatment?I am referring to executables stored inside the container app bundle in: Some.app/Contents/Library/LaunchServices and installed via SMJobBless.Thank you!
Posted
by FxFactory.
Last updated
.
Post not yet marked as solved
2 Replies
942 Views
As part of a custom notarization workflow, I am currently submitting a flat installer package which contains a number of different components (app, frameworks, loadable bundles, etc.). This package does not contain any loadable code such as KEXTs that seems to have its own stricter set of rules.So here is the workflow:1) Upload the flat PKG via altool2) Wait for the ticket to be ready3) Staple the same PKGThis seems like a straighforward workflow, but other posts in the forum suggest that one might have to do this instead:1) Upload all apps that you plan to eventually include in the PKG via altool2) Wait for the ticket to be ready3) Staple apps4) Build flat PKG5) Upload flat PKG via altool6) Wait for the ticket to be ready7) Staple the PKGIs it even necessary to go through the extra steps? Is there any benefit to stapling an app that is installed via a stapled installer?
Posted
by FxFactory.
Last updated
.