building for UIKitForMac, but linking in .tbd built for macOS - xcode11

I'm trying to compile my iOS app to work on macOS and after checking the Mac checkbox, I'm getting this error on compile:
d: building for UIKitForMac, but linking in .tbd built for macOS, file '/Users/jan/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks//GLKit.framework/GLKit.tbd' for architecture x86_64
Any idea what it means and how to fix it?

Though I've not had this particular error I have had similar ones when trying to port from iPad to UIKitForMac. UIKitForMac appears to be the iOS SDK built for x86_64 when you're linking with frameworks. As a result it shouldn't be trying to pull the x86_64 files from the macOS SDK.
I'd be tempted to check over your 'architectures' and 'valid architectures' settings in Xcode to make sure that any settings you have are deleted and switched back to the standard ones.
Remove architectures

Related

Can Xcode on m1 Mac build targeting Intel

I have a 2020 m1 MacBook Pro and need to build a .dylib library targeting x86_64 architecture in order to open it in a java project that is giving me the following error:
mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')
I've checked this apple link where it says that Xcode on m1 automatically builds a universal executable https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary.
When I open my Build Settings to select the target Architecture I don't have other choices:
screenshot
How can I build the way I need to?

CorePlot framework with universal build for Mac Apple Silicon

Is there a way to compile the CorePlot framework as a universal build including arm architectures ?
When I open the project on Xcode 12, I make sure I select Standard Architectures but it doesn't seem to be working. I've test it with the file command on terminal I only get 1 build for x86_64.
Is there a way to check what the $(ARCHS_STANDARD) variable value is ?
CorePlot framework:
https://github.com/core-plot/core-plot
Make sure you're using the code on the release-2.4 branch. Choose "Any Mac (Apple Silicon, Intel)" instead of "My Mac" from the Scheme menu at the top of the window before building the framework.
$ lipo -info (build folder)/CorePlot.framework/Versions/A/CorePlot
Architectures in the fat file: (build folder)/CorePlot.framework/Versions/A/CorePlot are:
x86_64 arm64

How can I get boost to compile for an earlier deployment target on OSX?

this question has been asked before, but none of the answers seem to be currently working.. whether that's because they are incomplete, or things have changed, I don't know.
I build my code for a deployment target of 10.7 (my clients use their machines for music production, so they often prefer to stick with what they know works rather than updated with every new OS release).
I'm using boost.
So when I buid I get a bunch of warnings
ld: warning: object file (/usr/local/lib/libboost_filesystem.a(path.o)) was built for newer OSX version (10.10) than being linked (10.7)
ld: warning: object file (/usr/local/lib/libboost_system.a(error_code.o)) was built for newer OSX version (10.10) than being linked (10.7)
and so on.
So, I want to build boost (version 1.58 currently, unfortunately cmake is usually a couple of versions behind in what it can find) for a deployment target of 10.7
It seems the magic instruction is
macosx-version-min=10.7
except I can't make it work.
./bootstrap.sh
sudo ./b2 -a macosx-version-min=10.7 install
Just doesn't do it, nor do any of the other things I've tried (I'm not familar with how b2 works, so I'm grasping in the dark).
I expect I'm missing something simple, but some help would be much appreciated
regards
Jon
I ran into the same issue and could only fix it by building boost with the 10.7 library. I've used XCode 8.2.1. Here is what I did:
Modifying "Darwin.Jam". Look for this line: feature macosx-version-min : : propagated optional ;
and add this line below feature.extend macosx-version-min : 10.7 ;
Modify "Info.plist" in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform and set <key>MinimumSDKVersion</key>
<string>10.11</string>
Make sure your XCode.app has the 10.7 SDK installed. This is the right location: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs You can extract or copy it from an earlier version of XCode.
Now build boost with these options: cxxflags="-stdlib=libc++ -std=c++11 -mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"
E.g. ./b2 -a cxxflags="-stdlib=libc++ -std=c++11 -mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"
The solution above will build Boost with the 10.7 SDK instead just setting the Target SDK to 10.7

linking against dylib built for MacOSX file '/usr/lib/libSystem.B.dylib' for architecture i386

I recently switched my development MacBook from a classic MacBook (32 bit) to a MacBook Air (64 bit). I am trying to open a project that was made on my old MacBook (32 bit) running XCode 4.
The project is a PhoneGap application made in PhoneGap 1.7.0.
My new MacBook Air (64 bit) is running XCode 5.
I imported my developer profiles from my old MacBook to my new MacBook Air. But when I try to run it, I get the following error message.
I have tried changing the my architecture in the build settings to armv7 but still no luck :(
Does anyone know why I'm getting this error and how to fix it?
Thanks
OK so as it turns out, XCode 5 changes the default architecture to armv7 when my application does not support armv7. I am running Cordova 1.7.0 and that version does not have support for armv7 architecture.
Fix architecture issue:
Removed ALL architectures from Build Settings -->
Valid Architecture
Added armv6 to Build Settings --> Valid Architecture
Fix libSystem.B.dylib issue:
Removed /usr/lib/libSystem.B.dylib from Build Settings --> Linking --> Other Linker Flags
Also removed -weak_library from Build Settings --> Linking --> Other Linker Flags
Xcode 5 asks you to build your libraries for the simulator (1) and for iOS (2). You can then merge (3) these into a fat binary which you then link to your main project. I use the same flags as Xcode is using to build your main project (as seen in your screendump).
Expressed in common gnu toolchain variables I do:
1. Building a library for the simulator
CC=clang
IPHONEOS_DEPLOYMENT_TARGET=7.0
PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH"
CFLAGS="-arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk -mios-simulator-version-min=7.0"
2. Building a library for iOS
CC=clang
IPHONEOS_DEPLOYMENT_TARGET=7.0
PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH"
CFLAGS="-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -miphoneos-version-min=7.0"
3. Merging to a fat binary
Choose either of .a or .dylib depending on what you use:
lipo -create "your armv7 lib".a "your simulator lib".a -output "your lib".a
lipo -create "your armv7 lib".dylib "your simulator lib".dylib -output "your lib".dylib

Cocos2d 2.x ARC issue on device

I'm working on a game that has cocos2d with ARC.
The game builds & runs fine in Simulator, but when I build for device I get Apple Mac-O Linker Errors, saying that I'm missing the libraries for libcocos2d.a etc.
clang: error: no such file or directory: '/Users/aleksandartrpeski/Library/Developer/Xcode/DerivedData/jellyfish-fsomqwhqasishxcfzhgvccrdvzpt/Build/Products/Debug-iphoneos/libcocos2d.a'
clang: error: no such file or directory: '/Users/aleksandartrpeski/Library/Developer/Xcode/DerivedData/jellyfish-fsomqwhqasishxcfzhgvccrdvzpt/Build/Products/Debug-iphoneos/libCocosDenshion.a'
clang: error: no such file or directory: '/Users/aleksandartrpeski/Library/Developer/Xcode/DerivedData/jellyfish-fsomqwhqasishxcfzhgvccrdvzpt/Build/Products/Debug-iphoneos/libkazmath.a'
clang: error: no such file or directory: '/Users/aleksandartrpeski/Library/Developer/Xcode/DerivedData/jellyfish-fsomqwhqasishxcfzhgvccrdvzpt/Build/Products/Debug-iphoneos/liblibpng.a'
When I go to the folder where the file is missing I only see jellyfish.app.
I don't have much experience in this kind of issues & I'm not clear why this happens,
I checked how to start the project from TinyTimGames & LearnCocos2D, still not clear what I'm doing wrong.
I've solved the issue, the builds for the binaries were somehow ignored by XCode because they were for another architecture, by settings the build settings for the cocos2d target Build For Active Architectures Only to NO, the issue dissapeared.
Sounds like you'll have to add these libraries to the Link Binary With Libraries build phase.
See my tutorial on Enabling ARC for Cocos2D projects for details.
It's strange that it would work for the Simulator though, since it's using the same target. I wouldn't rule out that the device is incompatible, you'll have to have at least a 3rd generation (iPhone 3GS) device running iOS 4.0 or higher.

Resources