Create custom Platform and SDK for Xcode 8.3+ - xcode

I'm trying to create a custom .platform and SDK in Xcode 8.3 and higher.
I am ultimately attempting to update the old DarwinBuild build system so that I can compile a few of the Apple open source components. DarwinBuild used to use this technique in order to be able to compile against a different set of headers and libraries without having to chroot.
DarwinBuild includes a setup script, installXcode32, that creates a new .platform under Xcode's Developer/Platforms directory, and a new sdk under the platform's Developer/SDKs directory. It also creates an Info.plist and SDKSettings.plist in the right spots. This script needs some updating to work with Xcode 8.3.
I know this is unsupported, but that doesn't matter in this case. After all, Apple published the original script...
I updated the original installXcode32 script to work with the new Xcode paths (/Applications/Xcode.app/Contents/...), and it produces the new .platform, Info.plist, and SDKSettings.plist, and they're all symlinked to the right spots. However, xcodebuild -showsdks now produces this error:
xcodebuild: error: Initialization failed.
Reason: Required content for platform darwin is missing.
I know it's an issue with the Info.plist and SDKSettings.plist files. I have tried copying the entire MacOSX.platform directory, and changing the names in the .plist, and I get the same error.
Does anyone know enough about Xcode and platforms to know what is required to get Xcode 8.3+ to recognize a "new" Platform and sdk?
Many thanks!

I have successfully done this with Xcode 9.4, pretty much like you did. I changed:
CanonicalName
PLATFORM_NAME
DisplayName

Related

Error Compiling Publish (Sundell) from Manifest File

TLDR;
I installed John Sundell's Publish according to the accepted practices and immediately get an error when I try to build my site package. How do I successfully install the product?
After cloning the publish package:
git clone https://github.com/JohnSundell/Publish.git
I cd'd into the Publish folder and ran:
make
which created an executable at /usr/local/bin/publish
I opened a new terminal window, created a directory using mkdir Saturday and then cd'd into that folder. I typed publish new and was successful:
✅ Generated website project for 'Saturday'
Run 'open Package.swift' to open it and start building
When I open the manifest file (Package.swift) and type cmd-S (Save) it imports all the necessary packages, and everything looks good to go.
When I type cmd-B (Build), however this error message comes up:
The package product 'CollectionConcurrencyKit' requires minimum platform version 13.0 for the iOS platform, but this target supports 11.0
When I look at the clone/install of Publish I see:
Computing version for https://github.com/johnsundell/collectionConcurrencyKit.git
Computed https://github.com/johnsundell/collectionConcurrencyKit.git at 0.1.0 (0.37s)
Notice it says version 0.1.0. In the generated package for my site, it retrieves version 0.2.0. I don't know if that's an issue.
But not one other Package.swift file in all the fetched dependencies mentions iOS.
I have this line in my Package.swift
platforms: [.macOS(.v12)],
So I know I haven't added this dependency on iOS inadvertently, so I don't understand the error message.
I'm running macOS Monterey 12.6 on Xcode 14.0 (14A309) - both are the most recent release versions available.
The hardware is: MacBook Pro (16-inch, 2021) using the Apple M1 Pro chip
If I'm leaving anything out, please comment and I'll provide more detail.
This is a slap your forehead 🤦🏽‍♂️ kind of thing here.
It turns out that when I opened the Package.swift it defaulted to an iOS scheme that I had just been using. I updated the scheme to a macOS based one, the problem went away. Now I understand the source of the iOS error. Apparently the two versions of ConcurrencyKit is a red herring.
Hope this helps others! Always check your target when compiling.

Xcode 11.2.1 - Command CodeSign failed with a nonzero exit code

I'm working on a SFML app for macOS with the latest Xcode version.
I got a "Command CodeSign failed with a nonzero exit code" error when it tries to sign the SFML frameworks. I added these under "Link Binary with Libraries" and "Copy Files" in Target, under Build Phases. Before, I was working with my local frameworks under /Library/Frameworks, and it was working very well.
Now I need to create an archive .app.
I've tried a lot of things seen on other posts here (like lock and unlock my keychains), but nothing worked. Still got that error.
My SFML Frameworks in "Link Binary with Libraries"
/Users/lounesksouri/Library/Developer/Xcode/DerivedData/Squadro-gqwjbvsooypqaifxxyzhdrahkdpo/Build/Intermediates.noindex/ArchiveIntermediates/Squadro/InstallationBuildProductsLocation/Applications/Squadro.app/Contents/Frameworks/sfml-system.framework/Versions/A: bundle format unrecognized, invalid, or unsuitable
Command CodeSign failed with a nonzero exit code
Ok, I solved my problem, after long hours.
It's a lot more simple to use the script already present in Build Phases tab, generated if you use the SFML App Xcode template (see here the original script). I had tried it at first, but it didn't work so I let it down.
But, in this script, the first three lines are not the good ones, for a normal SFML installation on macOS. We need to modify these lines with the good paths to the Frameworks and lib folders, as follows :
SFML_DEPENDENCIES_INSTALL_PREFIX="/Library/Frameworks"
CMAKE_INSTALL_FRAMEWORK_PREFIX="/Library/Frameworks"
CMAKE_INSTALL_LIB_PREFIX="/usr/local/lib"
FRAMEWORKS_FULL_PATH="$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/"
Secondly, there is still the code signing problem : the archive will created but we will get an error if we start the .app. The solution to this problem is to check Disable Library Validation under Target/Signing & Capabilities to allow the application to load plug-ins or frameworks signed by other developers.
Finally, if we create the archive and launch the application, everything goes normally, as planned.
I faced this problem with the new update of Xcode. I was reading your discussion, and did some accidental modifications. I am definetely not an expert but what I did fixed the problem so I did not receive tgis error anymore. So I added the sfml libraries (5 libraries), whose paths are written in build settings -> framework swarch paths. And this adding automatically added them in Embedded Frameworks under the Build phases section. What I did is unchecking the checkboxes of all 5 libraries "Code sign On copy". Thank you guys for giving me the path for "solving" the problem :))))
For the Code-signing issue:
Open a Terminal,
Go to the Framework folder (cd /Library/Frameworks) and sing them.
choose your identity
security find-identity -vp codesigning
sign them Frameworks!
codesign -s AD90FAFAFAFAFAFAFAF-YOURHASH-9D6 ogg.framework
codesign ... all the others
run and enjoy!

XCode 9 unable to build - linker fails with "File not found" on object files - project builds fine in XCode 8.3.3

Here's a frustrating one. My project builds perfectly in 8.x versions of XCode, and yet in 9.x versions, it fails consistently in the linker phase, as the linker is unable to find the .o file for a seemingly random class.
For example, in one build it will be unable to find the intermediate object file for my UIWindow subclass:
In other builds, other files may be identified as the culprit, with the same "file not found" linker error.
So, clearly there is a disconnect in the linker phase. I can understand that. But I cannot make it work to save my life.
Here's what DIDN'T work:
• Deleting derived data
• Cleaning and option-cleaning
• In the .swift file inspector, removing the file from the target and re-adding to target
• Renaming the target
• Deleting the supposedly erroneous files from the project, and moving to trash, then re-adding the files to the project and target.
• Switching advanced workspace settings for Build Settings from "XCode default" to "Legacy"
• Updating XCode from 9.0 to 9.0.1
• Deintegrating Cocoapods and reinstalling them
Jeez.
So, none of the usual suspects are at play here.
Additional details :
• When I look in the folder specified in the linker error message, the .o files are NOT THERE. (Are they not being created? Is there a setting for that?)
• Using Mac OS High Sierra on a MacBook Pro Retina 15
So there's my conundrum.
Does anyone know why XCode 9 would either not be creating .o files, or would be unable to find those files, for a project that build perfectly in previous versions of XCode?
Thanks!
The only solution I found was admittedly pretty painful. I created a new project and then re-imported all the files and dependencies into the new project. Then setup all the build settings, etc. At that point the project was back to building and working fine.
If this happened again, I would try deleting the .xcworkspace file and re-generating it with pod install first before starting a new project.
May this not happen to you.

How to change qmake when upgrading to qt5 for pyqt5

I am trying to install Pyqt but I am having significant issues getting all the seperate installation processes to work in sync. I have looked online but I can't find anything to help in my specific situation.
So far I have downloaded and built Sip4.16.7. I saved the file to a random location on my directory and ran the configure file, it then installed the module in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages and seemed to work.
I then downloaded the latest version of Qt5.2 and installed it using the installer. The files are stored in /users/MyUsername/Qt
I then installed PyQt5.4.1 and tried to run the configure file but I obviously have an older version of qmake on my system as I get an error of Error: PyQt5 requires Qt v5.0 or later. You seem to be using v4.7.4. Use the
--qmake flag to specify the correct version of qmake. This is confirmed by typing qmake -v in the terminal and I get the output of QMake version 2.01a
Using Qt version 4.7.4 in /opt/anaconda1anaconda2anaconda3/lib. I have scoured the internet and I can't work out how to tell whether I have a new qmake for the Qt5.2 or If I have to make it. And I have no idea how to get set the right Qtmake directory for the new PyQt configure file.
I apologise for the very specific and confused question but I am totally lost at the moment. As an additional question When you download the PyQt and SIP files should they be saved in specific directories relative to each other?
To follow the entire discussion for how I answered this refer to https://forum.qt.io/topic/53035/installation-problems-with-pyqt-locating-old-version-of-qmake/37
There were 2 main problems:
1) The --qmake=/Users/MyUsername/Qt/5.4/ios/bin/qmake was directed to the iOS qmake which requires a subscription to apple developers program. using the --verbose option returned Check dependencies
Code Sign error: No code signing identities found: No valid signing identities (i.e. certificate and private key pair) matching the team ID “(null)” were found.
CodeSign error: code signing is required for product type 'Application' in SDK 'iOS 8.1'
The solution to this was to refer qmake to the clang-64 version to allow development on OS X not iOS.
2) I had saved the PyQt directory in my google drive and therefore there was a space in the file name. Therefore when I referred to the qmake in the clang-64 directory I got the error of ```clang: error: no such file or directory: Drive/Personal/Code/PyQT/PyQt-gpl-5.4.1 (when using --verbose) So I had to move the PyQT file to outside my google drive and rerun, and it worked fine.

Added Mac target to iOS project in Xcode, now 'Error Starting Executable File'

I've decided to make a Mac OSX port of my iOS app, so based on a number of suggestions I've received I've simply added a new Cocoa target to my iOS project, and set up a series of 'libraries' (which encapsulate the core business logic of my app) which I have added to the OSX target. I have not added all of the UIViewController code to the OSX target - I will have to rewrite the UI code, for obvious reasons. The app is building fine (no compiler errors for missing libraries, etc.), but for some reason I get the following error message when I try to run the 'hello world' program, which I'd like to get working before I start coding in earnest. Here's the message:
Error Starting Executable 'MyExecutableMac'
No executable file found.
Use "file" or "exec-file" command.
As per this SO question, I made sure that the proper executable file was listed under the scheme build settings, so that it will actually run. However it actually appears that the .app file is not being packaged properly - the .app file is stil listed as "red" in the file list, meaning the file is missing. What might be causing this error?
I had this problem in Xcode 4.2, I found that first doing a clean (Xcode > Product > Clean and option clicking Product > Clean Build Folder…) fixed it.

Resources