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

75 Posts
Sort by:
Post not yet marked as solved
0 Replies
30 Views
I am using UDP communication in a app. Here is what i do, Initialises a UDP broadcast connection object. Bind it with a port to listen Receives the IP & Port from the UDP connection to connect further with TCP connection. After updating Xcode 15.3, It works until the iPad is connected with mac in debug mode. When i create build to test remotely, it stops receiving IP & Port from UDP connection. Here is how i concluded this is Xcode issue, I tried to debug this issue with Xcode 15.2 and it works as expected with debug and after creating build also. Any help / suggestion would be appreciated.
Posted Last updated
.
Post not yet marked as solved
2 Replies
90 Views
When running an iOS app as designed for iPad on an m1 Mac mini the UIImagePickerController.isSourceTypeAvailable(.camera) api returns true leading to a crash (attached) if the camera is selected to upload an image to the app as my much loved Mac mini does not have a camera. For the moment have disabled camera if platform is Mac by adding the qualification: ProcessInfo().isiOSAppOnMac == false but this seems like a bug or does the crash also happen on Macs with cameras? Other image picker options work fine. Crash log
Posted
by ptclarke.
Last updated
.
Post not yet marked as solved
2 Replies
71 Views
Hello, I am developing a tool in python or nodejs to intercept flows between two applications (MITM). I want to use the FRIDA library, but when I use it I get the following error: Error: module not found at "/usr/lib/libSystem.B.dylib". Indeed, the library is not present in the folder. I tried to get help directly from FRIDA but I couldn't find any help and on the current forum I did see some posts talking about this problem but I couldn't solve it. Do you have an idea of how to solve this problem. Thank you. Ps: I'm new to the APPLE ecosystem (Mac mini - Apple M1)
Posted
by MathRails.
Last updated
.
Post marked as solved
2 Replies
1.2k Views
I am working on an Apple M2 Pro, MacOS Sonoma 14.3.1. Today Xcode automatically updated from 15.2 to 15.3 and downloaded the new 17.4 simulators and runtime tools. I can no longer run my apps in simulator. On Xcode 15.2, there was an option to choose the destination architecture, under Product -> Destination -> Destination Architectures -> Rosetta (the one I have ben required to select in order to run apps for the last few versions). On Xcode 15.3, the option to chose the destination architecture is now missing. I am still able to build successfully to my phone directly. I am unable to build to a simulator, I get the same error for regarding a linker error failure. I have tried: reboot laptop delete information stored in derived data delete local Podfile.lock delete Pods folder pod install reopen xcode run on device - works! run on 17.2 simulator - fails with error run on 17.4 simulator - fails with error Our Podfile looks like this: require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' require_relative '../node_modules/react-native-permissions/scripts/setup' platform :ios, '13.4' prepare_react_native_project! setup_permissions([ 'AppTrackingTransparency', 'Camera', 'LocationAlways', 'LocationWhenInUse', 'Notifications', ]) target 'myapp' do config = use_native_modules! # @react-native-firebase/app requirement: use_frameworks! :linkage => :static $RNFirebaseAsStaticFramework = true use_react_native!( :path => config[:reactNativePath], # to enable hermes on iOS, change `false` to `true` and then install pods :hermes_enabled => false ) # Pods for GoogleMaps on iOS rn_maps_path = '../node_modules/react-native-maps' pod 'react-native-google-maps', :path => "#{rn_maps_path}" pod 'react-native-camera', path: '../node_modules/react-native-camera', subspecs: [ 'BarcodeDetectorMLKit' ] pod 'RNSquareInAppPayments', :path => '../node_modules/react-native-square-in-app-payments' target 'myappTests' do inherit! :complete # Pods for testing end # Enables Flipper. # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable the next line. # use_flipper!("Flipper-DoubleConversion" => "1.1.7") #avoid duplicate symbols for architecture x86_64 for Folly post_install do |installer| react_native_post_install(installer) installer.pods_project.targets.each do |target| if target.name == "RCT-Folly" target.build_configurations.each do |config| config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'FOLLY_HAVE_CLOCK_GETTIME=1'] end end end end end I'm open to additional suggestions, at this point, I can't see a way to tell xcode that we need the other build option (like specifying Rosetta which I used to be able to do). Also, if anyone can help me understand why it is doing this, I'm busy on Google, but not finding what I'm looking for, so I wonder if I'm looking for the right things. Thanks so much! Error:
Posted Last updated
.
Post not yet marked as solved
0 Replies
104 Views
We develop virtual instruments for Mac/AU and are trying to get our AU-Plugins and our Standalone player to work with Audio Workgroups. When the Standalone App or Logic Pro is in the foreground and active all is well and as expected. However when the App or Logic Pro is not in focus all my auxiliary threads are running on E-Cores. Even though they are properly joined to the processing thread's workgroup. This leads to a lot of audible drop outs because deadlines are not met anymore. The processing thread itself stays on a p-core. But has to wait for the other threads to finish. How can I opt out of this behaviour? Our users certainly have use cases where they expect the Player to run smoothly even though they currently have a different App in focus.
Posted Last updated
.
Post not yet marked as solved
11 Replies
793 Views
I've been working on an iOS project for the iPhone and would like to support running it on macOS computers with Apple Silicon. In the Targets / Supported Destinations we added "Mac (Designed for iPhone)" but experienced Thread 1: EXC_BAD_ACCESS crashes immediately when we tried to run it. We've isolated it down to Stepper UI elements in our view. Starting a new project and just trying to present a single Stepper in the ContentView, we get the same crash. Here is code that presents the issue: // ContentView.swift import SwiftUI struct ContentView: View { @State var someValue = 5 var body: some View { VStack { Stepper("Stepper", value: $someValue, in: 0...10) } } } When run from Xcode on an iOS device or the simulator, it runs fine. Trying to run it on the Mac, it crashes here: // Stepper_01App.swift import SwiftUI @main // <-- Thread 1: EXC_BAD_ACCESS (code=2, address=0x16a643f70) struct Stepper_01App: App { var body: some Scene { WindowGroup { ContentView() } } } Xcode 14.3 (14E222b), MacOS Ventura 13.3.1 (a), Mac mini M2. Target: Mac (Designed for iPhone) We have verified that the same code crashes on all the Apple Silicon Macs we have access to. Searching the Internet and Apple Developer forums I dont find other reports, so I kind of feel there must be some level of either user error or system/project misconfiguration going on? If any iOS app that used Steppers was just crashing when trying to run on a Mac, it seems like this would be a big deal. If anyone has input or can point out what we need to do differently, it would be appreciated!
Posted Last updated
.
Post not yet marked as solved
1 Replies
172 Views
Im honestly a bit lost and looking for general pointers. Here is the general flow of my project. I have an Xcode project where I want to return and convert the temperature values accessed from the apple smc and I found a GitHub repo with all the smc key sensors for the M3Pros/Max chips: https://github.com/exelban/stats/issues/1703 basically, I have all these keys stored in an array in obj-c like so: NSArray *smcKeys = @[ @"Tp01", @"Tp05", @"Tp09", @"Tp0D", @"Tp0b", @"Tp0f", @"Tp0j", @"Tp0n",@"Tp0h", @"Tp0L", @"Tp0S", @"Tp0V", @"Tp0z", @"Tp0v", @"Tp17", @"Tp1F", @"Tp1J", @"Tp1p", @"Tp1h", @"Tp1R", ]; I am passing all these keys by passing 'smcKeys' in a regular C code file I have here that is meant to open, close and read the data shown here: #include "smc.h" #include <mach/mach.h> #include <IOKit/IOKitLib.h> #include "smckeys.h" io_connect_t conn; kern_return_t openSMC(void) { kern_return_t result; kern_return_t service; io_iterator_t iterator; service = IOServiceGetMatchingServices(kIOMainPortDefault, IOServiceMatching("AppleSMC"), &iterator); if(service == 0) { printf("error: could not match dictionary"); return 0; } result = IOServiceOpen(service, mach_task_self(), 0, &conn); IOObjectRelease(service); return 0; } kern_return_t closeSMC(void) { return IOServiceClose(conn); } kern_return_t readSMC(char *smcKeys, SMCVal_t *val) { kern_return_t result; uint32_t keyCode = *(uint32_t *)smcKeys; SMCVal_t inputStruct; SMCVal_t outputStruct; inputStruct.datasize = sizeof(SMCVal_t); inputStruct.datatype = 'I' << 24; //a left shift operation. turning the I into an int by shifting the ASCII value 24 bits to the left inputStruct.data[0] = keyCode; result = IOConnectCallStructMethod(conn, 5, &inputStruct, sizeof(SMCVal_t), &outputStruct, (size_t*)&inputStruct.datasize); if (result == kIOReturnSuccess) { if (val -> datasize > 0) { if (val -> datatype == ('f' << 24 | 'l' << 16 | 't' << 8 )) { //bit shifting to from 32bit operation associated with the ASCII charecters'f', 'l', and 't', sets datatype field. double temp = *(double *)val -> data; return temp; } } } return 0.0; } Which I am then then calling the functions from this file in a swift file and converting the values to Fahrenheit but no data is being printed in my console: import IOKit public class getTemperature { public struct SMCVal_t { var datasize: UInt32 var datatype: UInt32 var data: (UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8) } @_silgen_name("openSMC") func openSMC() -> kern_return_t @_silgen_name("closeSMC") func closeSMC() -> kern_return_t @_silgen_name("readSMC") func readSMC(key: UnsafePointer<CChar>?,val: UnsafeMutablePointer<SMCVal_t>) -> kern_return_t func convertAndPrintTempValue(key:UnsafePointer<CChar>?,scale: Character, showTemp: Bool ) -> kern_return_t { let openSM = openSMC() guard openSM == 0 else { print("Failed to open SMC: \(openSM)") return kern_return_t() } let closeSM = closeSMC() guard closeSM == 0 else { print("could not close SMC: \(closeSM)") return IOServiceClose(conn) } func convertAndPrint(val: SMCVal_t) -> Double { if val.datatype == (UInt32("f".utf8.first!) << 24 | UInt32("l".utf8.first!) << 16 | UInt32("t".utf8.first!) << 8) { let extractedTemp = Double(val.data.0) return( extractedTemp * 9.0 / 5.0 + 32.0 ) } return 0.0 } let smcValue = SMCVal_t(datasize: 0, datatype: 0, data: (0,0,0,0,0,0,0,0)) let convertedVal = convertAndPrint(val: smcValue) print("Temperarure:\(convertedVal)F°") return kern_return_t() } } I know this is a lot but I am honestly looking for any tips to fill in any gaps in my knowledge for anyone who's built a similar application meant to extract any sort of data from Mac hardware.
Posted
by Aor1105.
Last updated
.
Post not yet marked as solved
0 Replies
229 Views
I'm working on an app for macOS where it would be very useful to display the GPU (graphics card) workload usage as a percentage. CPU usage monitoring is easy, but GPU monitoring on Apple Silicon is next-to-impossible. Apple only seems to give us our app’s GPU usage which is not what we want, since we want to total GPU workload for the whole system. I'm using the latest version of Xcode and Swift, any ideas how to achieve this?
Posted
by Filip27.
Last updated
.
Post not yet marked as solved
1 Replies
241 Views
I'm struggling with compiling lib opus so that it works in the simulator on Apple silicon. I found a thread on the forums that seems to address part of the issue, but I am unable to build the static lib so that it shows the platform it is targeting. The thread mentions that I should be able to run otool and see a "load commands" that indicate the platform. When I run otool against the static library that we have created, it doesn't list any load commands. I don't see LC_BUILD_VERSION or LC_VERSION_MIN_***. Why would there not be any "Load command" entries? % otool -l -arch arm64 dependencies/lib/libopus.a Archive : dependencies/lib/libopus.a dependencies/lib/libopus.a(bands.o): is an LLVM bit-code file dependencies/lib/libopus.a(celt.o): is an LLVM bit-code file dependencies/lib/libopus.a(celt_encoder.o): is an LLVM bit-code file dependencies/lib/libopus.a(celt_decoder.o): is an LLVM bit-code file ... dependencies/lib/libopus.a(mlp.o): is an LLVM bit-code file dependencies/lib/libopus.a(mlp_data.o): is an LLVM bit-code file The static library has the two architectures embedded in it, but when compiling the framework for the simulator platform the linking phase complains that we are building for the simulator, but linking object code built for ios. % lipo -info dependencies/lib/libopus.a Architectures in the fat file: dependencies/lib/libopus.a are: x86_64 arm64 In case you are curious, I'm just piggybacking on this project that has a build-libopus.sh script in the root directory that builds the official open source Opus library files. My hope is to build this static library for ios, ios-simulator, and mac-catalyst platforms and then include them in a xcframework.
Posted
by tethridge.
Last updated
.
Post not yet marked as solved
1 Replies
252 Views
Is there a way in pure C (not Objective-C, and certainly not Swift) way to detect if an iOS app is running on a Mac? I'm aware of iOSAppOnMac, but AFAICT I'd need to write Objective-C code to use it. My application is quite old and large, with portions going back to the 1980s, so the burden of moving on the anything that can't be accessible directly from C is quite high.
Posted
by iseggev.
Last updated
.
Post not yet marked as solved
5 Replies
1.7k Views
My device has an M2 Max chip, and I am using Xcode version 15.1 Beta 3. My app runs normally in iOS and iPad simulators, but when I attempt to run it in the Vision Pro simulator, even though the compilation is successful, a dialog box appears stating, 'AppName's architectures (Intel 64-bit) include none that Apple Vision Pro can execute (arm64).' Consequently, the app is not successfully installed in the Vision Pro simulator. Additionally, my project uses Cocoapods for dependency management. I would appreciate any help, thank you!
Posted
by jsonzb.
Last updated
.
Post marked as solved
2 Replies
376 Views
Consider the following program, memory-leak.c: #include <stdlib.h> void *p; int main() { p = malloc(7); p = 0; // The memory is leaked here. return 0; } If I compile this with clang memory-leak.c and test the output with the built-in MacOS memory leak detector leaks using leaks -quiet -atExit -- ./a.out, I get (partly) the following output: 1 leak for 16 total leaked bytes. However, if I remove the 'leaking' line like so: #include <stdlib.h> void *p; int main() { p = malloc(7); return 0; } Compiling this file and again running leaks now (partly) returns: 0 leaks for 0 total leaked bytes. The man page for leaks shows that it is only un-reachable memory that is considered a leak. Is there a configuration to detect un-free'd reachablemalloc segments?
Posted
by noicest.
Last updated
.
Post not yet marked as solved
5 Replies
2.7k 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
943 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
329 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
491 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
316 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.3k 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
368 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
300 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
.