Building Xcode project without a provisioning profile - macos

I'm sorry if it's already answered here but I wasn't able to find it.
I want to play a bit with DriverKit and SEXTs but I'm not in the Apple Developer Program. Is there a way to build a project using DriverKit in Xcode without using a provisioning profile? Or can I generate a 'fake' one manually? I'm trying to build a DriverKit project by Scott Knight but I'm getting ""USBApp" requires a provisioning profile with the System Extension feature." and ""MyUserUSBInterfaceDriver" requires a provisioning profile." errors.
I tried to run a small demo which uses the Endpoint Security framework. I built it using clang and ran it in a virtual machine with SIP disabled. However, I'd like to try to develop a bigger project (and to also try writing DEXT) and I don't want to build it using clang every time neither to use Xcode in the virtual machine (I don't even know if I would be able to build it using Xcode in the VM plus disk space limitations).
My goal is to develop and build in the comfort of my host machine without need of the VM, and then to run (and debug) it in the virtual machine.
P.S.: For ones that want to build the same demo (got SIGSEGV but I was able to build it and run it on Catalina 10.15.3):
clang -framework Foundation -framework SystemConfiguration /usr/lib/libEndpointSecurity.dylib /usr/lib/libbsm.dylib EndpointSecurityDemo.m -o esdemo

Related

How to get macos app signing set up for packages

I am new to macOS development and am having a terrible time trying to get my code signed. The documentation to me seems to be horrible.
My specific situation...
I am building a cross-platform app that runs on Linux, Windows, macOS and eventually iOS and Android.
It is a console app that runs as a service or LaunchDaemon
It has a UI served by WebView, http, or console commands depending on the scenario.
It is built with Go 17 in VScode.
I am not using xCode other than the command line tools.
My goal on macOS it to distribute it as a package (pkg) and not as an app.
I have been using MunkiPkg to build it
I am hung up on understanding how the various certificates need to be set up. I have not been able to get a successfully signed package notarized.
Can someone please point me to some documentation that explains how my scenario works? Most of what I found requires it to be built in xCode. And the Apple docs seem mostly to focus on how great their tools are without actually explaining how to use them.
Help!

Xcode Provisioning Profile issue on GitLab CI Build machine

We have a team of developers that work independtly on separate apps using XCode, locally we can build etc and any issues with provisioning profile Xcode automatically sorts out.
We use GitLab as our main repository and have set up a runner on a Mac mini to handle our distribution builds.
Now generally this works fine, until we change our provisining profile (mainly by adding in app purchasing or push notifications). When this happens our local laptops auto syncs with apple and update the profile locally.
When we come to build on Mac mini, it fails due to profile not containing relevant info.
If we go to the Mac mini, load Xcode, build our projects, its fine after that but this step is causing problems, mainly as most engineers aren’t office based, so have to make a special trip in to sort the Mac mini.
Is there a solution to this?
How do others handle it?
IS there a command line option to force Xcode to update profiles before we build, which we could add to the CI script.
Is there a way of embedding the profile into projects?
Thanks

How to emulate clean mac environment to test .app

I created the .app with Qt application that I'd like to distribute. It works fine on my developer machine and now I want to test it on clean mac system to check if all dependencies bundled and it works correctly. But I don't have another clean mac.
Is there a way to emulate clean environment on dev machine to check the .app?
You can install macOS on a virtual machine, using Parallels or VMware Fusion.
This can be useful to ensure your app is deployed correctly, with all the dependencies in the right place.
However, keep in mind that the VM won't support accelerate graphics, so if your app is using OpenGL, you will not be able to test it in this kind of environment.

Xcode Instruments is stripping symbols despite all build settings to the contrary

Problem
Instruments' Time Profiler is stripping all symbols except system libraries from my app, despite the fact that I have disabled this behavior in all relevant build settings in Xcode — but only on one development machine. The other dev machine behaves normally.
Description
Instruments' Time Profiler is stripping all symbols except system libraries, despite the fact that I have disabled this behavior in all relevant build settings in Xcode — but this is only happening on one of my development machines. I have two development machines running the same version of OS X, Xcode, and Instruments, and each machine is using an identical copy of the same Xcode project with identical build settings, schemes, and other configurations, and the app is profiled using the same test device (iPhone 4S with the latest public version of iOS 5).
Machine 1
- Mac OS X 10.7.4
- Xcode 4.3.2 (4E2002)
- Instruments 4.3 (4321)
Machine 2
- Mac OS X 10.7.4
- Xcode 4.3.2 (4E2002)
- Instruments 4.3 (4321)
Steps To Reproduce
Open included sample project on each machine.
Make sure the iPhone 4S is selected as the test device.
Select Product > Profile
When Instruments launches, select Time Profiler and continue.
Run the app.
Notice how the symbols are stripped when running on the iMac (Machine 1) but not on the MacBook Air (Machine 2).
Expected Behavior
Symbols from my own code should appear in the Time Profiler on both machines.
Regression
I have tried all of the following, with no change in the actual results:
Rebooting the machine.
Trying other Xcode projects
Deleting the "Derived Data" for all projects in the Xcode Organizer.
Re-symbolicating the document in Instruments (carefully selecting the correct DSYM file in ~/Library/blahBlahBlah…)
Final Notes
Here is a link to a .zip file of a sample project: Sample Project .zip
I was finally able to get it to work by a method that's just shy of a nuke-and-pave scenario:
Make absolutely sure all symbol stripping is disabled for your current build configuration. Make sure you've done this for your Release config if that's what's being profiled for Instruments.
Delete the app from the iOS device.
Restart the iOS device.
Restart the Mac (I don't trust Xcode or Lion at all to quit all relevant processes otherwise).
Launch Xcode, go to Organizer > Projects and delete Derived Data for the affected project.
Clean your project. Hell, why not?
Build and profile for Instruments.
Choose the Time Profiler in Instruments for clarity.
The first run will not show the symbols, but don't quit. Leave Instruments running!
Re-symbolicate the document in Instruments, navigating carefully to the correct dSYM file for the current build. This should be easier since you've deleted the derived data in step 5.
Now you should be able to see your symbols. It helps if you hide non-objective-C symbols.
Why do I suggest that you delete the app and restart the iOS device in Steps 2 and 3? I have a suspicion that Xcode doesn't perform a clean installation of each build, but may install deltas, such that the symbol addresses present in Instruments are a mixture of the current build plus previous builds. If so, then this issue is even more common for someone like me, who shares a single test device between more than one Mac. This assumption could be wildly incorrect.
If the above steps don't work for you, please let me know in the comments. I'd like to create a detailed radar report at some point in the future.
I'm not sure that it has been fixed in the 4.3 but this is a known problem in 4.2 seen here
Instruments
There is a known issue with the Profile action from Xcode 4.2. After a build in which no source files have changed, Instruments will be unable to gather symbols for the target application.
This affects projects where both:
The Release configuration is selected for the Profile action.
(default)
The Strip Linked Product build setting is set to "Yes”, or
a custom Run Script build phase strips the product. (non-default)
The workaround is to do any one of the following:
Perform a "Clean" on the product before initiating the Profile
action.
Do a Clean of the product and temporarily set the Strip Linked
Product build setting to "No" while Profiling.
Set the configuration of the Profile action to Debug.
Run successive profiles directly from within Instruments when you do
not need to rebuild. When developing Mac apps, using the GC Monitor
template in Instruments may cause Instruments to crash. To
workaround the problem please consider migrating your application to
ARC.
I've had a similar problem for days. I was able to profile the Debug configuration, but not Release. First I tried to make a copy of the release configuration (as suggested somewhere on the web), but that copy did not work either.
Then I made a copy of Debug, called it Profile, tried it and the symbols of Profile were shown in the profiler. Great! I then changed the optimization levels etc. to the same as Release, and now it works! Just wanted to share this, as this comment would have spared me hours...
Have been facing the same and stumbled upon this thread.
I realized that I first profiled the app with release build and after changing the scheme in Xcode for the same app, the profiler was still unable to symbolize. I have tried all obvious solutions you mentioned above but in vain.
The profiler somehow is still referring to the first build (release build)'s settings and hence it is not able to symbolize. So, I just changed the app's bundle identifier for testing purpose so that a new app is created altogether for profiling purpose. I could check the code where leaks exist now.
Try it out and let me know if this works for you too. Still pondering over why Instruments is failing to symbolize though.
I had a similar issue where I had no symbols in my os x application that I built from the command line (so in this case it is not an iphone or xcode issue). It turned out the problem was due to a bad DYLD_LIBRARY_PATH that contained my PATH. When I got rid of all those non-library paths, such as /usr/bin/, it worked.
I have a lot of third party frameworks whose symbols and binaries are unfortunately getting lost.
Additionally, my app's binary was getting lost.
I.e. if I selected File > Symbols, clicked my target, and found the similarly named item, the Binary Path was showing up red.
The solution was to go to Instruments > Preferences > Symbols, and add /Users/<MY_USER>/Library/Developer/Xcode/DerviedData to the search paths. Library is not indexed by Spotlight. After doing this, I have at least had the symbols for my app. The little circle next to my app's name goes from Yellow to Green when I do this, and persists between restarting Instruments, unlike other solutions to manually set the binary.
Let me know if you can tell me how to get all the ones for my third party frameworks. I use Carthage for some, others installed manually. Have had no luck with these yet.
I've managed to solve this by:
Disconnecting the device
Deleting the iOS Device Support files for the device's version of iOS in ~/Library/Developer/Xcode/iOS Device Support
Reconnecting the device and letting Xcode reinstall device support.
To be safe I first quit Xcode and Instruments, deleted derived data, and did a clean build as mentioned above, but no need to delete the app or restart any devices this way.
Try open XCode 3 and him Organizer. And try add from this Organizer a devices to both machines.
Just open Organizer and wait him processes. If you're see a button "Use for development" then click him.
Sometimes, XCode 4 can't add a device a truely for full development.

Running Xcode 4 locally, executing code externally?

We have a CUDA server at work that is running Linux.
I am running Xcode on my Mac which does not have a CUDA device. I wondered if it was possible to use Xcode 4 as an IDE to develop the code, but executing/building and debugging the code on the external CUDA server?
In other words, I want to store the files etc, on the CUDA server (I have SSH access), but manage the project/files from my Mac. When I press the build button in Xcode, I want everything to be build on the CUDA server.
Is this possible or do I have to use ssh and vim to develop my code?
How about mounting the Linux server over SFTP through the Finder, and then using Xcode to start a project directly on the server? It might be tricky to tell Xcode where to find the nvcc compiler and other necessary stuff on the Linux server, but I would try that first.

Resources