LLVM 2.0 can't build for iPhone simulator. GCC 4.2 works fine - iphone

When I build my project (any project, really - I tried creating a new empty project with the same results), it builds fine with GCC 4.2 under either Xcode4 or Xcode 3.2.4.
If I build using LLVM 2.0 under Xcode4 or with LLVM 1.5 under Xcode3, I get compile-time build failures, but only when building for the Simulator.
The build errors that I get under LLVM are all in headers over which I have no control, such as UIView.h, UIDevice.h, UIApplication.h, UITextView.h and UIWebView.h in UIKit and CGPDFContext.h in CoreGraphics.
Here's an example error, in WebView.h:
#property(nonatomic) UIDataDetectorTypes dataDetectorTypes __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_3_0); //<--- Unknown type 'UIDataDetectorTypes'
when UIDataDetectorTypes is indeed declared in UIDataDetectors.h which is included in that file.
sniff

Might be a bug in Xcode 3.2.4 or the SDK configuration.
Try placing a line like one of these in your Build Settings Preprocessor Macros:
-D__IPHONE_OS_VERSION_MIN_REQUIRED=040100
or
-D__IPHONE_OS_VERSION_MIN_REQUIRED=030103

It sounds to me like your installation is borked.
When you installed Xcode4 did you make sure to install it to a completely separate directory to your existing Xcode install?
It could also have something to do with your include paths or something in that vein. I'm not too sure how to go about fixing that.
I would suggest backing up any custom templates etc. and running the uninstall script for both Xcode 3.x and 4, and then reinstalling to see if that fixes the issues.

Does this issue persist with XCode 3.2.5?
Just curious since I haven't downloaded it yet.

Related

Xcode not displaying compile errors

I'm working in a specific Xcode project and deliberatly making errors in my code (like using undeclared variables), but Xcode doesnt seem to show any compile errors in my code.
It shows errors only when its build or clean.
Tried clean and build, cleaning derived data and restarted both Xcode and system, none of it works.
Using Xcode 8.2.1 (8C1002) and Swift 3
Besides the DerivedData folder, also try cleaning Xcode caches completely:
rm -rf $HOME/Library/Caches/com.apple.dt.Xcode/
I would recommend also killing the SourceKit process — always a source of issues these days! — but since you are already did a full reboot, so looks like you are good there.
If everything fails, you might consider upgrading to the latest Xcode, version 8.3. Just be aware that:
Xcode 8.3 no longer supports Swift 2.3. Please migrate your projects containing Swift 2.3 code to Swift 3 syntax by opening the project and choosing Edit > Convert > To Current Swift Syntax.
Project Settings, "Show all issues" fixed it for me.
For me, I had to first ensure all of my Xcode Targets had valid Signing & Capabilities like a development Team selected... then I was able to update all of my Targets to Swift 5 using the warning that was presented to me. Immediately after all of the targets were all updated to Swift 5 and the Provisioning was fixed, the red errors were flagged again!
I had the same problem using Xcode 13.3 with Swift version 5.5
Upgrading to Xcode version 14.1 (14B47b) which also upgrades Swift tools to version 5.7.1 fixed the problem.

Cocos2d-x project's 2nd rebuild onwards gives an error 'Xcode cannor run using selected device'

Fresh cocos2d-x project build using Xcode runs normally on iOS simulator/device, but after making changes to cpp source files, rebuild fails with error-
Xcode cannor run using selected device. Choose a destination with a supported architecture in order to run on this device.
The only way to make it work is delete build binaries (i.e. delete XCode>Derived Data folder), and take fresh build after restarting Xcode.
Can someone please help me resolve this issue?
Additional Details:
This error is related to mismatching device architecture and armv6 armv7 flags. But first build works fine, and stops working after second build onwards, that means this is not a possible issue.
If the project is not using cocos2d-x (i.e. plain Objective-C project), then there is no such error after second build.
Compiler selected: Apple LLVM Compiler 4.2
Thanks in advance!
Following my comment you should make sure you use the latest templates for creating cocos2d projects. Some templates will only work for a specific Xcode version so make sure you use the right templates for your xcode version (There are some for xcode 3.x and others for xcode 4.x)
Change Valid architecture to armv7 and armv7s. Remove armv6. See image for more information.

How to use .a's built in lower version with Xcode 4.5

Can I use .a's built with Xcode 4.3.3 in Xcode 4.5? When I build with simulator it is building fine, when I'm build for device it is showing many reference error. What I am suspecting is .a's I'm using is older. Am I right. Is there any way I can fix this problem instead of building all .a's with Xcode 4.5.
thanks.
I think this is an issue with using a library which was build supporting armv6, which has been dropped in Xcode 4.5
The best long term solution is to ask the developer who created these libraries to rebuild to support the latest Xcode, but in the meantime you can try following these instructions

How to make Xcode 3.2.3 build a specfic architecture?

I'm getting the following error when including static libraries:
missing required architecture i386 in
file
This worked 30 seconds previously, and only failed when I upgraded to Xcode 3.2.3. I've used "file" command to check - and, yes, XCode is building completely the wrong architecture (armv6 + armv7 instead of i386).
This seems to be a major bug in latest Xcode, where Apple has re-written the build / compile / link settings. There's a note in the release notes saying very vaguely that they've "Changed it" because it used to be "confusing". This is not helpful.
The build settings for the library VERY clearly say:
"Valid architectures: i386"
There's no confusion here - Xcode is building something other than what the target says it should.
The question is: how do you un-break this? How do you force Xcode to do what it's supposed to? I've re-installed Xcode from scratch, cleaned everything, and manually inspected the build files. There's nothing wrong (and, of course, it worked perfectly in xcode 3.2.2)
After considerable research, I believe the answer is:
"this is now impossible - Apple has deliberately hard-coded XCode to ignore build settings"
However, I've come up with a script that automatically builds ALL platforms of a project (which you HAVE to do with static libraries - you don't have much choice now, because Apple has disabled Targets), and the script could easily be modified to do all targets, instead of all platforms:
Build fat static library (device + simulator) using Xcode and SDK 4+
Right click on your Target app under Targets and make sure that the Base SDK is set to iOS.

Linker error (only simulator) with own library after update to iPhone SDK 4.0

I recently updated to iPhone SDK 4.0 and are no longer able to build my project for the iPhone simulator. The problem is that classes of one of my own libraries can no longer be found by ld:
"_OBJC_CLASS_$_Book", referenced from:
objc-class-ref-to-Book in Category.o
(maybe you meant: ...)
ld: symbol(s) not found
collect2: ld returned 1 exit status
I already read some other posts about similar problems, like e.g. here. "Unfortunately", my problem has nothing to do with a SDK framework, but with my own lib, so the solutions mentioned there are not applicable here.
The library is included under "Link Binary With Libraries" of my target, library search paths are correct (checked this with XCode and with a plain text editor directly in my project file) and correctly added to the gcc command.
I'm using iPhone Simulator 3.2 as Base SDK, but the same problem occurs with SDK 4.0. Again, this works with my device target but not with my simulator target. It worked with both, though, before I updated from iPhone SDK 3.2 to 4.0. I was also able to reproduce this error by creating a new project with only one file and the linked lib. However, the lib should be okay as it worked with simulator 3.2 before I updated XCode and my SDK.
More Facts: Mac OS X 10.6.3, XCode 3.2.3 64-Bit, iPhone OS 3.2, GCC 4.2
Any help would be highly appreciated.
EDIT:
After reinstalling SDK 3.2, everything worked as expected again. It must be noted, that the SDKs in folder /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs are overwritten with each installation. I then tried to reinstall SDK 4.0 again and the same error as above occurred. I didn't change anything in my project and always used 3.2 as Base SDK.
The problem can therefore possibly be narrowed down to the following options:
Apple changed sth. in the Simulator SDK 3.2 that causes the problem
a change in XCode 3.2.3 causes the problem
wrong/missing compiler flags while building my own library (those flags, however, would only cause problems with a changed SDK or the changed IDE)
I also did a folder diff on /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk for both the old and the new version of this folder. It turned out that there are actually minor changes within the "same" SDK. I still think it's an IDE/compiler flag problem, though.
Anybody any ideas? I don't want to stick to 3.2 forever...
Make sure that you recompile your libraries with the same base SDK as you're using for your app.
I was finally able to figure out which flags were missing in my compiler call to build my lib. So, to answer my question: If anybody has problems linking his/her own static lib to a target in XCode 3.2.3 (using iPhoneSimulator3.2.sdk or iPhoneSimulator4.0.sdk), you need to build your lib with the following two flags:
-fobjc-abi-version=2
-fobjc-legacy-dispatch
Thanks again to PhoneyDeveloper for his hints.
Another thought- this has happened to me in the past even when libraries weren't involved.
Double check that you haven't imported files using the 'group folder references' option. It seems that this gives Xcode a headache. (At least it did in my case.)
i got solved this when i removed flags like (-ObjC, -all_load) under 'Other Linker Flags' which I was using in the project.there was -all_load conflict actually.