Unsupported compiler 'GCC 4.2' selected for architecture 'armv7' - iphone

Just installed new version XCode 4.2 onto my Mac. I tried compiling my project but got the following error:
Unsupported compiler 'GCC 4.2' selected for architecture 'armv7'
Tried selecting arm7 in drop down for architechture in project and target settings. (The list actually shows just arm 7) still no use.
Please help.
Thanks

you should actually select the LLVM compiler under "Compiler Version" instead of trying to set "Valid Architectures"

xcode build errors:
Unsupported compiler ‘GCC 4.2′ selected for architecture ‘i386′
Solution:
This can be caused by importing a project for a pre- iOS 5 SDK into a copy of xcode with iOS 5 SDK only.
To fix, click your
Project -> Build Settings.
Then under Build Options, there is an entry for Compiler for C/C++/Objective-C. Choose Apple LLVM compiler 3.0.
There is a chance this could effect other aspects of your binaries as you are using a new compiler, so YMMV. That being said, it’s so far caused no issues for me.

If you have multiple projects included within a single xCode project, go to editor>Validate project settings. This will set the compiler to LLVM 5.0 even if you don't see that option normally

Go to BuildSettings->BuildOptions->CompilerFor c/c++/Objective C and change that to LLVM GCC 4.2 from 'Unsupported Compiler GCC4.2'

Related

Swift Version Conflict: this SDK is not supported by the compiler - using BUILD_LIBRARY_FOR_DISTRIBUTION setting. What could be the issue?

I'm building a Swift static library with:
Xcode 13.2 (Swift compiler 5.5.2)
iOS Deployment target 12.0
Build library for distribution YES
Skip install NO
Swift language version 5 and tried with 4.2
Dependency managed with CocoaPods:
Japx 3.0.0
Alamofire 5.2.2
RxSwift
When I try to add it to an iOS project with this setup:
Xcode 13.3 (Swift compiler 5.6)
iOS Deployment target 12.0
Swift language version 5 and tried with 4.2
and build I get this error:
Failed to build module 'LibraryX'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.5.2 effective-4.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)', while this compiler is 'Apple Swift version 5.6 effective-4.2 (swiftlang-5.6.0.323.62 clang-1316.0.20.8)'). Please select a toolchain which matches the SDK.
These are the headers in the .swiftinterface
// swift-interface-format-version: 1.0
// swift-compiler-version: Apple Swift version 5.5.2 effective-4.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
// swift-module-flags: -target arm64-apple-ios12.0 -enable-objc-interop -enable-library-evolution -swift-version 4.2 -enforce-exclusivity=checked -Onone -module-name LibraryX
Obviously if I build the project with the same compiler version or building the library with the iOS project everything works fine. But the purpose here is to release a precompiled library and not its source code.
Every time that I lookup this error online I've found "You have to set Build library for distribution to Yes"
I tried to add the source code of the static library to a new Framework project, but I get the same result.
I also had this error, in my case it was unable to import a sub-dependency of my XCFramework during reading .swiftinterface file, however was showing this absolutely misleading error.
After repeatedly cleaning up DerivedData and trying different Xcode versions (13.0, 13.4.1) I've seen 2 errors: "this SDK is not supported by the compiler", and "No module named 'AnotherLib'" which was an incorrectly specified dependency inside of my Swift Package.
So, maybe only first part of the message is correct "Failed to build module 'LibraryX'", but the reason is something else, NOT the difference in compiler versions.

Cosmos: Update to Swift 4 reveals new issue: The following binaries use incompatible versions of Swift

After I updated my App to Swift 4 I get this error message:
error: The following binaries use incompatible versions of Swift:
/Users/Konrad/Library/Developer/Xcode/DerivedData/ExploreYourCity-btthjezgywzvnmduiurzwgwzrven/Build/Products/Debug-iphoneos/Cosmos/Cosmos.framework/Cosmos
/Users/Konrad/Library/Developer/Xcode/DerivedData/ExploreYourCity-btthjezgywzvnmduiurzwgwzrven/Build/Products/Debug-iphonesimulator/ExploreYourCity.app/ExploreYourCity
I can not find a solution to this misstake. Whats wrong?
Library setup method: CocoaPods
Version of the library. Example: 12.0.1.
Xcode version. Example:9.0.1.
OS version. Example: iOS 11.0.
*Swift Version: Swift 4.0.
1) Select Project in Project Navigator.
2) Go to General Tab.
3) Remove everything under Embedded Binaries.
4) Remove everything under Linked Frameworks and Libraries except Pods_*.framework
5) Clean, Build and Run.

Swift 3.1.1 compile error: unknown key 'SwiftImportAsNonGeneric'

Some time after upgrading to Xcode 9, I discovered that I was no longer able to build a Kitura-based project with the Swift 3.1.1 snapshot (which I have installed via swiftenv).
When I ran swift build, some time into the build I would get:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes:8:28: error: unknown key 'SwiftImportAsNonGeneric'
SwiftImportAsNonGeneric: true
^
<unknown>:0: error: could not build Objective-C module 'Foundation'
It seems that there is a dependency between Swift and Xcode, and Xcode 9 is no longer fully compatible with Swift 3.1.1 (or earlier) snapshots. I believe it may be because my project uses Foundation, and Foundation on Mac is provided as part of Xcode, whereas on Linux it is part of the Swift snapshot (via swift-corelibs-foundation).
I did find a solution to this problem: If I keep a copy of Xcode 8.3.3 around (eg. in /Applications/Xcode8.3.3.app) then I can use sudo xcode-select -s /Applications/Xcode<version>.app/Contents/Developer to select the appropriate one prior to building with SPM, and I can then build both Swift 3.1.1 and 4.0 projects on the same system.
However, this feels a bit clunky. Each time I build a project with the 'other' Swift version, I have to make sure I run xcode-select, or the build will fail. Is having multiple versions of Xcode the right solution in this case, or am I missing a trick with Xcode 9?
note that if, like me, you upgraded Xcode via the App Store, previous versions of Xcode are still available from https://developer.apple.com/download/more/

Facebook Unity SDK and Unity 4.3 have a conflicting instance method 'openURL' on iOS

I had Facebook Unity SDK working in my game prototype until I updated to Unity 4.3. After the update build fails on dSYM generation in xCode. Error message:
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil failed with exit code 11
Most notably before the final error message above I get this warning:
ld: warning: instance method 'application:openURL:sourceApplication:annotation:' in category from /Users//Library/Developer/Xcode/DerivedData/Unity-iPhone-duxgtdhujpdgtjbanfxzqinkvybw/Build/Intermediates/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FbUnityInterface.o overrides method from class in /Users//Library/Developer/Xcode/DerivedData/Unity-iPhone-duxgtdhujpdgtjbanfxzqinkvybw/Build/Intermediates/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/armv7/UnityAppController.o
I investigated this a bit and yes, it seems that both UnityAppController.mm and FbUnityInterface.mm define "openURL" method and that's what xCode doesn't like. I also checked the iOS build that I had worked with on earlier (4.2.x) Unity version and in that build Unity did not define openURL-method in any of its .mm files.
Version Info:
Facebook Unity SDK Version 4.3.4
Unity Editor Version 4.3 (Pro)
Xcode 5.0.2
Changes vs Unity xCode project default configuration:
Added the frameworks that AdMob requires
Added linker flag "-ObjC" that AdMob requires (Build Settings -> Other Linker Flags)
I tested linking without the "-ObjC" flag also. Result is the same. Any ideas on how to fix this?
-tomi
I ran into the same problem but only building with debugging enabled in Build Options. Turn off debugging and you get past it. Or, BuildOptions.None in your build pipeline.
Of course, no debugging ...
We just released version 4.3.6 of the sdk that fixes login with unity version 4.3. It's available at https://developers.facebook.com/

Unsupported compiler 'GCC 4.2' selected for architecture 'armv7' in xcode 4.6

I accidentally updated my iphone to 6.1 and when that happened I came to know that I have to update the xcode version too to Version 4.6 (4H127), which I did. I had a requirement to read qrcode for which I was using Zxing and it was working perfectly well. After all updates, its throwing an error with build failed. The error says
"Unsupported compiler 'GCC 4.2' selected for architecture 'armv7'"
I tried searching for the answer changed the compiler from Default to LLVM GCC 4.2 from default that is APPLE LLVM Compiler 4.2 but with no change.
Please guide me to resolve the issue.