Apple Silicon

RSS for tag

Build apps, libraries, frameworks, plug-ins, and other executable code that run natively on Apple silicon.

Apple Silicon Documentation

Posts under Apple Silicon tag

69 Posts
Sort by:
Post not yet marked as solved
5 Replies
2.9k Views
On xcode 13, I have macos project that runs fine on intel machine. On apple silicon (M1 Plus) I get the error "A build only device cannot be used to run this target.", when I try to run from Xcode. This seems to be an ios error. All Google suggested fixes involve picking a new device which is an ios fix. Right? Bulids fine and Archive app runs fine. I get the error for both intel and Arm64 architectures. I tried building for Target deployment target device families and Deployment as: macos 12.0 sdk any suggestions?
Posted
by jhjames3.
Last updated
.
Post not yet marked as solved
3 Replies
1.2k Views
#include <stdio.h> int main() { unsigned long a, d; __asm__ volatile ( "\n\t" "movl $0x77777777, %%eax\n\t" "movl $0xffffffff, %%ecx\n\t" "xorl %%edx, %%edx\n\t" "divl %%ecx\n\t" "cwtd\n\t" "movq %%rax, %0\n\t" "movq %%rdx, %1\n\t" : "=r"(a), "=r"(d) :: "rax", "rdx" ); printf("rax: %lx, rdx, %lx", a, d); } The minimal program above was expected to give rax: 0, rdx: 77770000 but on macOS with Rosetta 2 it gave rax: 0, rdx, 0. It causes specfic programs (e.g. Genshin Impact) to crash.
Posted
by Waterlens.
Last updated
.
Post not yet marked as solved
1 Replies
432 Views
I am using Macaw vector graphics and need to convert my app from x86_64 architecture to a universal x86/amd64 architecture. Macaw won't build for amd64 so I would like to conditionally build that library only for x86 and ignore amd64. How can I do this? I tried protecting blocks of code with #if arch(x86_64) but I get errors that the library isn't found then.
Posted Last updated
.
Post not yet marked as solved
0 Replies
669 Views
I am asking this more in hope than expectation, but would greatly appreciate any help or suggestions (with apologies for a rather lengthy post). The problem I have with my existing OpenCL code is, quite simply, that I am unable to get it to build in Xcode (I have always used Xcode without problems in the past). So my question, quite simply, is: Can anyone advise how to configure and use Xcode in order to successfully build OpenCL code for Apple Silicon? Background: Having just received a shiny new M3 MacBook Pro, I would really like to try out one or two of my GPU programs. They were all written several years using OpenCL, before Apple decided to give up on it in favour of Metal. (In fact, I have since converted one of them to use CUDA, but that is not useful here.) Now, I completely understand that the right thing to do is to convert them to use Metal directly, and will do this when I have time, but I suspect that it will take me several days, if not weeks (I have never had reason to use Metal until now, so I will also have to learn how to convert my code; there are quite a few kernels). I don’t have time to do that at the moment. Meanwhile, I would very much like to try the programs right now, using OpenCL, simply to find out how they run on Apple Silicon (I have previously only used them on older, Intel Macs with AMD GPUs). It would be great to see my code running on the M3’s GPU! The reasons I think this must still be possible are (a) there are plenty of Geekbench OpenCL results for the M3 chips; and (b) I have managed to compile and run a really trivial OpenCL program (but only using clang from the command line; I have been unable to work out how to compile individual .cl files containing OpenCL kernels). The problem I am getting is that, having cloned one of my sets of programs into Xcode on my new M3 Mac, I am unable to get any of the kernels even to build. The failure I’m getting is that Xcode is trying to run a version of openclc in the directory /System/Library/Frameworks/OpenCL.framework/Libraries/, which gives the error condition Bad CPU type in executable when Xcode tries to use it. It seems that this is an x86_64 version of openclc. There is a universal binary version in /System/Library/PrivateFrameworks/GPUCompiler.framework/Versions/A/Libraries/, but I have been unable to find a way to configure (or force ….) Xcode to use that one. It may well be, of course, that if I manage to get past this problem, another one will present itself. Nonetheless, if any of you can suggest anything that I might try, I would be most grateful. One secondary question, if I may: Using openclc to compile a .cl file (containing a kernel) from the command line, is there a parameter (e.g. a value to specify with -arch) or combination of parameters that will cause it to produce a .bc file for an Apple Silicon GPU and also the .cl.h header file that has to be #included in the C or C++ code that will dispatch the kernel? Thanks …. Andrew PS. I’ve also posted this question on MacRumors, because there seem to be quite a number of people there who understand Apple Silicon, but I rather suspect there’s a better chance of getting getting the help I need here ….
Posted
by Kronsteen.
Last updated
.
Post marked as solved
1 Replies
390 Views
Hello, we're trying to running Unity game built for iPhones and iPads on Mac, just like this. https://developer.apple.com/documentation/apple-silicon/running-your-ios-apps-in-macos Getting device model with Unity API works on iPhone and iPad, but we got "iPad8,1"(or iPad8,2/3/4/..., one of the model of iPad Pro 3) for device model, and get "iPadOS 16.6" for Operating system on Mac. They are not Mac device information, how we get Mac device model and Mac OS version if we are running on Mac? (Additionally, not Mac Catalyst.)
Posted
by Zhumoumou.
Last updated
.
Post not yet marked as solved
10 Replies
1.4k Views
I maintain a cross-platform client side network library for persistent TCP connections targeting Win32, Darwin and FreeBSD platforms. I recently upgraded to a Mac Studio w/ M1 Max (Ventura 13.1) from a late 2015 Intel Macbook Pro (Monterey 12.6.2) and I've encountered a discrepancy between the two. For secure TCP connections my lib uses WolfSSL across all platforms but also supports use of system provided Security libraries. On Darwin platforms this is SecureTransport. Yes I am aware SecureTransport is deprecated in favor of Network. I intend to attempt to integrate with Network later but for now my architecture dictates that I use similar C-style callbacks akin to WolfSSL, OpenSSL, MBedTLS etc. On the first call to SSLHandshake the SecureTransport write callback generates 151 bytes for my TLS 1.2 connection to example.com:443 on both platforms. However, while on Intel MBP I am able to continue with the full handshake I immediately receive 0 bytes with EOF. In Wireshark on the Intel MBP the 151 bytes are observed as a TLS 1.2 client hello while on M1 it is observed as an SSL continuation message and that is the last message observed.
Posted
by otcintel.
Last updated
.
Post not yet marked as solved
2 Replies
475 Views
I am the author of the open-source Dynace. This is an OO extension to C. It has been in production use for around 20 years. It has been used on DOS, all Windows, Linux, macOS/Intel, VMS, PLAN9, COSMIC, SUNOS, etc. all without a problem. However it does not run on Apple M1, M2 machines. I traced the problem to variadic function calls. I am creating a va_list in a ... function. I then pass the va_list to a second function. I wrote something to copy the the va_list (via va_copy) to see what I am getting. The first function works okay. But the second function does not. (I know you can't re-use a va_list.) I have spend a couple of days on this and can't find a problem with my code. I tried creating a simple example but it worked. Apparently the problem is situational. Anyway, I have no idea what is wrong or what to do next. I'd sure appreciate any help! Thanks!
Posted
by blake1024.
Last updated
.
Post not yet marked as solved
1 Replies
403 Views
I have a Python code that parses XML string. When I run that code on MacOS, it shows me an error. But when I run the same code on my Linux machine or on Windows it works completely fine. I'm wondering how is possible for a platform-independent language that runs on Linux but not on Mac. from lxml.etree import fromstring s = """<Abstract><AbstractText>The genus Cinchona is known for a range of alkaloids, such as quinine, quinidine, cinchonine, and cinchonidine. Cinchona bark has been used as an antimalarial agent for more than 400 years. Quinine was first isolated in 1820 and is still acknowledged in the therapy of chloroquine-resistant falciparum malaria; in lower dosage quinine has been used as treatment for leg cramps since the 1940s. Here we report the effects of the quinoline derivatives quinine, quinidine, and chloroquine on human adult and fetal muscle nicotinic acetylcholine receptors (nAChRs). It could be demonstrated that the compounds blocked acetylcholine (ACh)-evoked responses in Xenopus laevis oocytes expressing the adult nAChR composed of αβ𝜀δ subunits in a concentration-dependent manner, with a ranked potency of quinine (IC50 = 1.70 **M), chloroquine (IC50 = 2.22 **M) and quinidine (IC50 = 3.96 **M). At the fetal nAChR composed of ** subunits, the IC50 for quinine was found to be 2.30 **M. The efficacy of the block by quinine was independent of the ACh concentration. Therefore, quinine is proposed to inhibit ACh-evoked currents in a non-competitive manner. The present results add to the pharmacological characterization of muscle nAChRs and indicate that quinine is effective at the muscular nAChRs close to therapeutic blood concentrations required for the therapy and prophylaxis of nocturnal leg cramps, suggesting that the clinically proven efficacy of quinine could be based on targeting nAChRs.</AbstractText></Abstract>""" print(fromstring(s))
Posted Last updated
.
Post not yet marked as solved
2 Replies
596 Views
Hello, My purpose is to understand how macOS works. Here is what i've done: I have wrote a c program on a M1 CPU with this lines: printf("Before breakpoint\n"); asm volatile("brk #0"); printf("After breakpoint\n"); When i run this program with lldb, a breakpoint is hit on the second line. So i suppose lldb is writing a "brk #0" instruction when we put a breakpoint manually. I can't continue to next line with lldb "c" command. PC stays on the brk instruction. I need to manually set PC to next instruction in lldb. Now, what i want to do is to create my own debugger. (I want to understand how lldb works). I have managed to ptrace the target program and i was able to catch an event with waitpid when "brk #0" is hit. But i don't know how i can increase PC value and continue execution because i can't do this on Silicon CPU: ptrace(PTRACE_GETREGS, child_pid, NULL, &amp;regs); ptrace(PTRACE_SETREGS, child_pid, NULL, &amp;regs); kill(child_pid, SIGCONT); So my question is: How does lldb managed to change ARM64 registers of a remote process ? Thanks
Posted Last updated
.
Post not yet marked as solved
15 Replies
5.4k Views
I have code that has worked for many years for writing ProRes files, and it is now failing on the new M1 Max MacBook. Specifically, if I construct buffers with the pixel type "kCVPixelFormatType_64ARGB", after a few frames of writing, the pixel buffer pool becomes nil. This code works just fine on non Max processors (Intel and base M1 natively). Here's a sample main that demonstrates the problem. Am I doing something wrong here? //  main.m //  TestProresWriting // #import <Foundation/Foundation.h> #import <AVFoundation/AVFoundation.h> int main(int argc, const char * argv[]) {     @autoreleasepool {         int timescale = 24;         int width = 1920;         int height = 1080;         NSURL *url = [NSURL URLWithString:@"file:///Users/diftil/TempData/testfile.mov"];         NSLog(@"Output file = %@", [url absoluteURL]);         NSFileManager *fileManager = [NSFileManager defaultManager];         NSError *error = nil;         [fileManager removeItemAtURL:url error:&error];         // Set up the writer         AVAssetWriter *trackWriter = [[AVAssetWriter alloc] initWithURL:url                                                    fileType:AVFileTypeQuickTimeMovie                                                         error:&error];         // Set up the track         NSDictionary *videoSettings = [NSDictionary dictionaryWithObjectsAndKeys:                                        AVVideoCodecTypeAppleProRes4444, AVVideoCodecKey,                                        [NSNumber numberWithInt:width], AVVideoWidthKey,                                        [NSNumber numberWithInt:height], AVVideoHeightKey,                                        nil];                  AVAssetWriterInput *track = [AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeVideo                                                         outputSettings:videoSettings];         // Set up the adapter         NSDictionary *attributes = [NSDictionary                                     dictionaryWithObjects:                                     [NSArray arrayWithObjects:[NSNumber numberWithUnsignedInt:kCVPixelFormatType_64ARGB], // This pixel type causes problems on M1 Max, but works on everything else                                      [NSNumber numberWithUnsignedInt:width],[NSNumber numberWithUnsignedInt:height],                                      nil]                                     forKeys:                                     [NSArray arrayWithObjects:(NSString *)kCVPixelBufferPixelFormatTypeKey,                                      (NSString*)kCVPixelBufferWidthKey, (NSString*)kCVPixelBufferHeightKey,                                      nil]];         /*         NSDictionary *attributes = [NSDictionary                                     dictionaryWithObjects:                                     [NSArray arrayWithObjects:[NSNumber numberWithUnsignedInt:kCVPixelFormatType_32ARGB], // This pixel type works on M1 Max                                      [NSNumber numberWithUnsignedInt:width],[NSNumber numberWithUnsignedInt:height],                                      nil]                                     forKeys:                                     [NSArray arrayWithObjects:(NSString *)kCVPixelBufferPixelFormatTypeKey,                                      (NSString*)kCVPixelBufferWidthKey, (NSString*)kCVPixelBufferHeightKey,                                      nil]];         */         AVAssetWriterInputPixelBufferAdaptor *pixelBufferAdaptor = [AVAssetWriterInputPixelBufferAdaptor                             assetWriterInputPixelBufferAdaptorWithAssetWriterInput:track                             sourcePixelBufferAttributes:attributes];         // Add the track and start writing         [trackWriter addInput:track];         [trackWriter startWriting];         CMTime startTime = CMTimeMake(0, timescale);         [trackWriter startSessionAtSourceTime:startTime];         while(!track.readyForMoreMediaData);         int frameTime = 0;         CVPixelBufferRef frameBuffer = NULL;         for (int i = 0; i < 100; i++)         {             NSLog(@"Frame %@", [NSString stringWithFormat:@"%d", i]);             CVPixelBufferPoolRef PixelBufferPool = pixelBufferAdaptor.pixelBufferPool;             if (PixelBufferPool == nil)             {                 NSLog(@"PixelBufferPool is invalid.");                 exit(1);             }             CVReturn ret = CVPixelBufferPoolCreatePixelBuffer(nil, PixelBufferPool, &frameBuffer);             if (ret != kCVReturnSuccess)             {                 NSLog(@"Error creating framebuffer from pool");                 exit(1);             }             CVPixelBufferLockBaseAddress(frameBuffer, 0);             // This is where we would put image data into the buffer.  Nothing right now.             CVPixelBufferUnlockBaseAddress(frameBuffer, 0);             while(!track.readyForMoreMediaData);             CMTime presentationTime = CMTimeMake(frameTime+(i*timescale), timescale);             BOOL result = [pixelBufferAdaptor appendPixelBuffer:frameBuffer                                            withPresentationTime:presentationTime];             if (result == NO)             {                 NSLog(@"Error appending to track.");                 exit(1);             }             CVPixelBufferRelease(frameBuffer);         }         // Close everything         if ( trackWriter.status == AVAssetWriterStatusWriting)             [track markAsFinished];         NSLog(@"Completed.");     }     return 0; }
Posted
by tessive.
Last updated
.
Post not yet marked as solved
4 Replies
550 Views
In an old project we just moved on mac ARM + Sonoma + Xcode 15 (fresh install), we get this link error: '_yytext' from '.../Objects-normal/arm64/html.lexer.o' not 8-byte aligned, which cannot be encoded as a target of LDR/STR in '_PHPyylex' from '.../Objects-normal/arm64/php.lexer.o' We don't get this error on Xcode 15 on mac Intel, nor with Xcode 14 on mac ARM. Does anyone know what we could do to fix that? thanks!
Posted
by bilbo42.
Last updated
.
Post not yet marked as solved
4 Replies
1.2k Views
Hi, I have an iPad app that has menus, like:  CommandGroup(replacing: .help) {                 Button("Help") { showHelp = true }                     .keyboardShortcut("/")  } They works fine in iPad and also if compiled to Mac Catalyst, but will crash on Apple Silicon Mac when selected the menu items with errors like: [General] -[_UIEditMenuInteractionMenuController propertyList]: unrecognized selector sent to instance 0x600000190540 I did not use storyboard and only use SwiftUI. Any suggestions? Note: of course the best solution is to compile to Mac Catalyst, but the app has some other issues when run in Mac Catalyst. So I can only release it as iPad app.
Posted
by limtc.
Last updated
.
Post not yet marked as solved
7 Replies
4.0k Views
My device is MacBook Pro 13-inch, M1, 2020 Use source code provided by article https://developer.apple.com/documentation/virtualization/running_gui_linux_in_a_virtual_machine_on_a_mac When installing Debian, Fedora or Ubuntu, installation process can stuck at any point and cause the installation failed. Even if it is lucky enough to pass the installation phase, stuck could still happen at any time when the virtual machine is started. It seems that there is some low level error that cause the Linux kernel panic, while during this process error seems to be accumulated--it starts with some user level application in Linux starts to behave weirdly, such as sudo does not authenticate a valid user, apt can not run properly, then Linux kernel panic. Sometimes it behaves like the VM get stuck where it is not sure what happened inside it. I can't provide more detail as it happens randomly and the phenomenon differs each time. While generally it appears to be an accumulated error and eventually the VM get stuck.
Posted
by mark07.
Last updated
.
Post not yet marked as solved
0 Replies
533 Views
When I build a new project, I constantly get the following errors. unexpected service error: The Xcode build system has crashed. Build again to continue. Xcode Version 15.0 (15A240d) and Command CpResource failed with a nonzero exit code
Posted Last updated
.
Post not yet marked as solved
0 Replies
514 Views
Hi there! I have a problem running UI tests on simulator, while using M1 Mac. After running for a couple of minutes, usually 3 minutes is enough, tests begin to fail every ±60s on XCUIApplication().launch() with Failed to terminate com.***.***:10552: Failed to terminate com.***.***:0 At this point, my simulator window does not even react to any manual input. That issue have been happening since Xcode 13. Unit tests are running completely fine though. Also, that issue does not appear on an Intel-based Mac. Sadly, I haven't found any information on that issue, however, there are some posts on SO mentioning the same issue, and only one of those posts has an answer, but it mentions unchecking 'Open using Rosetta' option for Xcode, which is not possible anymore. I would appreciate any advice, as I feel like I have tried everything already :(
Posted
by p_sedra.
Last updated
.
Post not yet marked as solved
2 Replies
1k Views
Users can run our apps on Macs with Apple Silicon via the "iPad Apps on Mac" feature. The apps use PHPhotoLibrary.requestAuthorization(for: .addOnly, handler: callback) to request write-only access to the user's Photo Library during image export. This works as intended on macOS, but a huge problem arises when the user denies access (by accident or intentionally) and later decides that they want us to add their image to Photos: There is no way to grant this permission again. In System Preferences → Privacy &amp;amp; Security → Photos, the app is just not listed – in fact, none of the "iPad Apps on Mac" apps appear here. Not even tccutil reset all my.bundle.id works. It just reports tccutil: Failed to reset all approval status for my.bundle.id. Uninstalling, restarting the Mac, and reinstalling the app also doesn't work. The system seems to remember the initial decision. Is this an oversight in the integration of those apps with macOS, or are we missing something fundamental here? Is there maybe a way to prompt the user again?
Posted Last updated
.
Post not yet marked as solved
0 Replies
338 Views
Hi How can i delete macOs versions 1.1 and 1.2 (both are macOs compiled, NOT iOs based)? In fact, I want to submit my iOs version for macOs devices (with apple silicon, and ignore intel onces). But: In App Store Connect In Pricing & Availability section there is this section : Apple Silicon Mac Availability when i click on checkbox :"Make this app available", and try to save, the save do not happen (stays blue) , and if i try to go to another section, it tells me that i have to save otherwise changes will be ignored (so that another confirms that my intent is not saved). so i assume i have to delete app first. in this link https://developer.apple.com/help/app-store-connect/create-an-app-record/remove-an-app/ it says that all versions (so in my case, event curent iOS App) should not be Ready for sale so is the only solution is te remove app from all appstores and refill things again?
Posted
by Bulltech.
Last updated
.
Post not yet marked as solved
3 Replies
809 Views
I just transitioned to an M2 silicon and compiled some of my previous programs. However, I am running into some execution problems when my code is not able to find the libSystem.B.dylib. I am runing Apple M2 Max, OS 13.5.2 (22G91) I installed XCODE and command line utilities as normal and installed gcc/gfortran using homebrew. The resulting fault text is below dyld[13777]: dyld cache '(null)' not loaded: syscall to map cache into shared region failed dyld[13777]: Library not loaded: /usr/lib/libSystem.B.dylib Referenced from: /Users/gamalakabani/Applications/TALYS_CODE/talys/bin/talys Reason: tried: '/usr/lib/libSystem.B.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/lib/libSystem.B.dylib' (no such file), '/usr/lib/libSystem.B.dylib' (no such file, no dyld cache), '/usr/local/lib/libSystem.B.dylib' (no such file) ./verify: line 12: 13777 Abort trap: 6 $talys &lt; talys.inp &gt; talys.out Is this an issue with homebrew gcc? Any help will be appreciated. Thanks
Posted
by gakabani.
Last updated
.