Post

Replies

Boosts

Views

Activity

Building universal C++ libraries from source
My app uses several 3rd party C++ libraries such as Google's Protobuf and many others. Most of them are dynamic libs (.dylib) and were built using standard .configure/make/make install from source. It is not clear to me how to build these in order to get universal libraries which run on Intel and Apple Silicon. Is there a flag in the standard build system that causes it to output a universal binary? Or can I build two libs (one for Intel and one for Apple Silicon) and combine them into a universal binary?
2
0
4.1k
Jul ’20
Stapling fails when executed from build server
I'm using a Jenkins Build Server on a Mac Mini running Catalina 10.15.6 to build two macOS apps with almost identical setups (two versions of the same app basically) and so far this has worked well. When I wanted to build a new version yesterday one of the targets built successfully while the second failed during the stapling phase. The notarization is done from a Python script and the notarization per se worked for both targets and returned no error. "xcrun stapler staple <target.app>" returns the following error description when executed from the build script for one of the targets: Processing: <target.app> Certificate trust evaluation did not return expected result. (5) [leaf AnchorApple AnchorTrusted ChainLength IntermediateMarkerOid LeafMarkersProdAndQA SSLHostname ServerAuthEKU ValidityPeriodMaximums] Certificate trust evaluation for 24.134.186.233 did not return expected result. CSSMERRTPNOTTRUSTED. Certificate trust evaluation did not return expected result. (5) [leaf AnchorApple AnchorTrusted ChainLength IntermediateMarkerOid LeafMarkersProdAndQA SSLHostname ServerAuthEKU ValidityPeriodMaximums] Certificate trust evaluation for 24.134.186.233 did not return expected result. CSSMERRTPNOTTRUSTED. Could not establish secure connection to api.apple-cloudkit.com error is Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=<NSLocalizedDescription=cancelled, NSErrorFailingURLKey=<URL I'm obviously not allowed to post here> CloudKit's response is inconsistent with expections: (null) The staple and validate action failed! Error 68. Any idea what might be causing this? When I'm running the "xcrun stapler staple <target.app>" command from the Terminal it works but it has worked from the build script before and it also works for the other target. I'm a bit lost as I don't know what to look into. Thanks in advance!
3
0
1.1k
Sep ’20
Targeting older macOS SDKs with Xcode 12
We have a macOS app that supports macOS 10.12 and later. We're using a 2018 Mac mini running macOS 10.15.7 for the release builds with Jenkins. In the last years and with older versions of Xcode we have always installed older macOS SDKs (using publicly available scripts) and used them to build against as we have run into several issues when building against the latest SDK version and only setting the deployment target to an older version (which we still do of course). With the latest version of Xcode this doesn't seem to be possible anymore so we thought we'd just do it the "official" way then: targeting the most recent macOS SDK and only setting the deployment target. When a user reported a bug with a release build now we sent him a debug build which was built on macOS 10.14.6 and Xcode 11 (also targeting the 10.14 SDK) and the issue is gone. No code changes whatsoever. When he switches back to the official release version the issue returns immediately. So I have to assume it has something to do with the version of macOS that is used to build against. What's the best way to go about this and how to go forward from here? Thanks and best regards, Flo
1
0
2.2k
Mar ’21
Most performant way of downloading pixel data from the GPU
We have a video rendering engine we're currently transitioning from OpenGL to Metal. Things are working fine and the overall performance is great but we’re hitting a bottleneck which we also hit with OpenGL which is downloading pixel data from the GPU to host memory. Our app offers playback functionality through third party manufacturers’ PCIe and Thunderbolt video devices. The respective SDK hands us a buffer pointer and it’s our job to fill that buffer with image data. Since we’re compositing on the GPU we at some point always need to do a GPU->CPU transition which takes several milliseconds. With an RGBA 8 Bit buffer we measured about 25 ms for a 4K video frame which would be a deal breaker with 50 or 60 Hz playback. We can of course try moving this to YUV to get the number of bytes down but it will still be a problem when we go to e.g 10 bits. But since we're rather new to Metal it may be that we're missing something. Our current way of getting the pixel data is this: [_resultTexture getBytes:data              bytesPerRow:_resultTexture.width * 4               fromRegion:MTLRegionMake2D(0, 0, _resultTexture.width, _resultTexture.height)           mipmapLevel:0]; But we have also tried to copy the data with a MTLBlitCommandEncoder as described here: https://developer.apple.com/documentation/metal/onscreen_presentation/reading_pixel_data_from_a_drawable_texture with similar results. Since the manufacturers of these devices now also start supporting 8K workflows I'm really starting to wonder if there's a better and much more performant way of getting the content of a GPU texture into a host memory block. Any help would be appreciated!
1
0
622
Sep ’22
Seeking to specific frame index with AVAssetReader
We're using code based on AVAssetReader to get decoded video frames through AVFoundation. The decoding part per se works great but the seeking just doesn't work reliably. For a given H.264 file (in the MOV container) the decoded frames have presentation time stamps that sometimes don't correspond to the actual decoded frames. So for example: the decoded frame's PTS is 2002/24000 but the frame's actual PTS is 6006/24000. The frames have burnt-in timecode so we can clearly tell. Here is our code: - (BOOL) setupAssetReaderForFrameIndex:(int32_t) frameIndex { NSError* theError = nil; NSDictionary* assetOptions = @{ AVURLAssetPreferPreciseDurationAndTimingKey: @YES }; self.movieAsset = [[AVURLAsset alloc] initWithURL:self.filePat options:assetOptions]; if (self.assetReader) [self.assetReader cancelReading]; self.assetReader = [AVAssetReader assetReaderWithAsset:self.movieAsset error:&theError]; NSArray<AVAssetTrack*>* videoTracks = [self.movieAsset tracksWithMediaType:AVMediaTypeVideo]; if ([videoTracks count] == 0) return NO; self.videoTrack = [videoTracks objectAtIndex:0]; [self retrieveMetadata]; NSDictionary* outputSettings = @{ (id)kCVPixelBufferPixelFormatTypeKey: @(self.cvPixelFormat) }; self.videoTrackOutput = [AVAssetReaderTrackOutput assetReaderTrackOutputWithTrack:self.videoTrack outputSettings:outputSettings]; self.videoTrackOutput.alwaysCopiesSampleData = NO; [self.assetReader addOutput:self.videoTrackOutput]; CMTimeScale timeScale = self.videoTrack.naturalTimeScale; CMTimeValue frameDuration = (CMTimeValue)round((float)timeScale/self.videoTrack.nominalFrameRate); CMTimeValue startTimeValue = (CMTimeValue)frameIndex * frameDuration; CMTimeRange timeRange = CMTimeRangeMake(CMTimeMake(startTimeValue, timeScale), kCMTimePositiveInfinity); self.assetReader.timeRange = timeRange; [self.assetReader startReading]; return YES; } This is then followed by this code to actually decode the frame: CMSampleBufferRef sampleBuffer = [self.videoTrackOutput copyNextSampleBuffer]; CVPixelBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer); if (!imageBuffer) { CMSampleBufferInvalidate(sampleBuffer); AVAssetReaderStatus theStatus = self.assetReader.status; NSError* theError = self.assetReader.error; NSLog(@"[AVAssetVideoTrackOutput copyNextSampleBuffer] didn't deliver a frame - %@", theError); return false; } Is this method by itself the correct way of seeking and if not: what is the correct way? Thanks!
0
0
680
Jul ’23
Stored credentials reset after a few hours when using "notarytool store-credentials"
I'm using the "notarytool store-credentials" command to store my access credentials for notarizing our apps from a build server through Jenkins. The machine is a Mac Mini M1 running Ventura. This works per se but for a reason I don't understand, I need to do this repeatedly. When I store the credentials, it will work for the next hours but at some point the machine will "forget" the access credentials resulting in this error output: Conducting pre-submission checks for <app name> and initiating connection to the Apple notary service... Error: No Keychain password item found for profile: notarization Run 'notarytool store-credentials' to create another credential profile. I then have to run the store-credentials command again so I can use it again for the next few hours. This is obviously quite annoying especially since it's absolutely not obvious why it behaves that way. The machine is on 24/7 and I don't see why the keychain item gets removed. I'd appreciate any insight and would like to know what I have to do to store the credentials permanently.
5
0
860
Oct ’23