Xcode 4.5 hangs when compiling large file - xcode

I have an Xcode project I want to archive.
However, the archive takes a very long time and trows an error: Xcode can not compile a file with about 19.000 lines.
Is there a limit on the number of lines Xcode can compile?
Is there a way to actually get Xcode to compile this file?
EDIT:
I have to note that this file only contains some parsed content, i.e. is a data model which can not be split.
I know it could be extracted into a database of some sort, but the question is really about Xcode and its compiling behaviour.

I changed my project to have <19,000 lines however a similar error still persisted!
what worked for me in Xcode5 after all was to change the Build Settings: Set "optimisation level" for RELEASE (or all) to NONE. worked wonders.

Divide & Conquer
What kind of code is that in a single class/file?
You could have broken that code into modules by creating other classes/objects. That would be simpler to understand and manage.

Related

Swift libraries included twice in IPA

I discovered that all the Swift libraries (libswiftCore.dylib, libswiftCoreGraphics.dylib,...) exist twice in the IPA. After decompressing the IPA, there is one version of theses libraries inside the folder SwiftSupport and the same files again inside Payload/Frameworks.
As far as I found out, the SwiftSupport folder is always generted by Xcode when a Swift-project is built. But where do the Swift libraries in Payload/Frameworks come from and how can I get rid of them?
I think that if your code already uses Swift, you have no set the Flag "Embedded Content contains Swift code" in Build Options to NO, otherwise Xcode will add the libraries because it thinks that you use some frameworks that have swift code
I am experiencing the same issue. I have read some answers which suggest that it isn't a big deal and I have to say that it looks like it isn't.
My app contains 3 targets - main app and 2 today extensions. When I create an archive its size is a whooping 126 MB. Most of it is Swift support libraries which are about 45 MB in my case and they are included twice.
However, when I check the binary size through test flight it is 23.6 MB. Now, this is still a lot considering that my application is a simple utility.
However, it is not too much if you take into account that Swift libraries have to be included. So far I would say that even though these libraries are included twice in the IPA they are not included twice in the actual binary.
This obviously doesn't answer the original question and I am also eagerly waiting for someone to come up with the exact solution, but it might be helpful.
I've found that playing around with 'Embedded content contains Swift' value yielded some good results, and was actually crucial for my app with an Apple Watch extension to pass validation.
I have written an answer about the details for the Apple Watch fix here.

Compiling Autotalent v2 Issues with Xcode 5.0.1 and Mavericks

I've been struggling to get Auto Talent from Oli Larkin to compile for some time now. I'm pretty new to Xcode and that may be the issue, but either way I figured I'd see if anyone could help me. I'm trying to compile this in order to make a 64 bit version.
Starting from the top:
I've traced down a few things that I thought were the issues.
Noticed that wdl sdk was missing. Downloaded it from https://github.com/olilarkin/wdl-ol. Added the wdl folder outside of the src folder.
Got some warnings when starting up Xcode 5.0.2. Let Xcode fix them.
Realized that the /Developer/Examples folder doesn't exist in Mavericks. Found https://developer.apple.com/library/mac/samplecode/CoreAudioUtilityClasses/Introduction/Intro.html#//apple_ref/doc/uid/DTS40012328-Intro-DontLinkElementID_2, downloaded the sample code, linked to AUBase as I realized this path needed updating in the AU Build Settings (see screenshot).
iPlug.xcodeproj is in red. Not sure what to do about this. Any ideas? I'm assuming it's important.
Update: Based on the recent comments, I'm now getting somewhere. But, at the moment I'm getting the following errors. This has to do with not having a Lice SDK or something. Is this absolutely needed? If so, do you have the time to elaborate on this and where to get it? Thanks again for all of the help.
It looks like I'm getting another issue as well related to clang. Maybe related to Xcode - Command /Developer/usr/bin/clang failed with exit code 1, not sure.
Note: Before finally getting to the errors above, I had to...
Link CoreMIDI.framework "Frameworks and Libraries" -> "Linked Frameworks" -> App to /System/Library/Frameworks/CoreMIDI.framework.
Set compiler in the build settings to default compiler. Otherwise it said unsupported compiler and threw some warnings. Hopefully this didn't mess anything up.
Rename aeffect.h and aeffectx.h to aeffect.h and aeffectx.h from the VST3 SDK. You can find these files in public.sdk -> source -> vst2.x. Apparently 2.x isn't really supported anymore. After renaming them, I moved them to the VST_SDK folder in WDL as the readme instructed.
the source you have will not compile straight off with recent versions of WDL-OL, since lots has changed. The way to upgrade it is to strip out the pertinent source code (i.e. autotalent.h/cpp and the mayer fft stuff) and re-duplicate one of the template projects in WDL-OL and bring it in to the new folder.
I've done it for you:
https://github.com/olilarkin/autotalent
you can clone this repository into the IPlugExamples folder of WDL-OL, and provided you've put all the SDK files in place it should compile straight off.
oli

Xcode shows many errors but program compiles and runs fine (in both simulator and device)

After installing the CocoaLumberjack' log compressor class I've been getting this annoying behavior: Xcode complains that there are many undeclared identifiers and gives me many errors (not warnings but errors with the red icon).
The thing is that I can compile and run my iPad app just fine but Xcode won't do any autocompletion. I tried cleaning the build folder (Product > option + Clean), and also deleting derived data. I've also rebooted to no avail.
As you can imagine this is a pain to work with. I did have this behavior happen before on a previous version of Xcode; it had something to do with stuff in my precompiled headers file but using the solution above would always fix it. I'm currently using Xcode 4.4 (4F250).
Sample error I'm getting:
Semantic Error: use of undeclared identifier 'DDTTYLogger'
The above happens even with classes that I wrote myself and that have not changed since installing the CocoaLumberjack compressor class.
I finally solved this after MANY attempts using the following:
Remove the last #import from my Prefix.pch and build again. Errors would happen (obviously). Put the line back and build again. No errors would show and after 10 seconds or so, errors would come back again.
Repeat the above except instead of the last #import, remove the last TWO imports, then three, four, etc. I did this until I removed five imports and when I put them back and waited, Xcode stopped complaining.
Note that this didn't occur to me at all. I read this solution on a blog somewhere.
Weird bug...
Open build settings and set "Precompile Prefix Header" to "No", that solved my problem.
Kudos for: https://stackoverflow.com/a/7035492/936957
I've been running into these issues constantly on all the latest versions of Xcode, in both Objective-C and Swift.
I noticed today that I was getting the errors in one particular class file. I removed it from some extra targets it was in and the errors finally went away!
I think Xcode has some fundamental bugs with it's handling of multiple targets right now. My theory is that if the other target is not built, you will essentially see errors from that target. Anyway hope this helps someone.
Not bad,
If you follow these Steps-
1-Clean Xcode(Cmd+Shif+K).
2- Clear Derived Data(Cmd+Shift+G).
Enter this path( ~/Library/Developer/Xcode/DerivedData/).
3- Quit and open again Xcode.
This problem can cause by setting "Target Membership" for some files are not the same.
Example:
A class XYZ put in file "a.swift" and it's used in file "b.swift". But "Target Membership" setting of "a.swift" is not the same "Target Membership" setting of b.swift.
Check "Target Membership" setting as below:
I was having issues with a library installed via cocoapods. Going to Build Settings and searching for 'Allow Non-modular Includes In Framework Modules' then setting it to Yes did the trick.
I had it on Xcode 10.1 when I accidentally pressed:
Cmd+Shift+U - ( build for Testing )
try Clean (Cmd+Shift+K) and then:
Cmd+Shift+R ( build for Running )
After update to Xcode 11, I met the same problem. I tried all the mentioned advices (cleaning folders, turning on/off different settings, restarting xCode), but nothing helped. Also, I have a big project in C, so, I'd like to keep using precompiled headers.
Finally I found that simple restart of Mac OS solves the problem! It's really weird behaviour, but I'm happy anyway that I found a solution – it's hard to code when lots of colourful error messages float around.
For me it helped cleanning the project. XCode->Product->Clean
I got the similar type of issue.
Alternate option to fix this is
Open organizer and delete the derived data of your project or delete all the projects in organizer projects tab. It works fine..
I just had the same thing in Xcode 5.1.
I fixed it by making sure there were no blank lines between #import's
I have removed some extra spaces and extra lines from .pch file and it xcode stopped complaining
This happened to me as well, but cleaning didn't fix it. What did was quitting and reopening XCode. Afterwards, all the phantom errors were gone. For those wondering, the tabs you have open when you close will still be open when you reopen.
I had this issue recently. It can be remedied in some cases by deleting the ModuleCache folder inside DerivedData, along with the project folder in DerivedData. Note that Xcode must be quit before doing this.
Running on Xcode Version 10.1 (10B61), I set the build setting "Increase Sharing of Precompiled Headers" to NO. I was working in an .xcworkspace with many projects sharing the same frameworks, and no Objective-C bridging header (meaning I've added no obj-c code myself). I'm not sure when Xcode did away with .pch files by default, but I didn't have any of those in my project.
Open up a terminal and create a nice little function accessible via the command line...
nano ~/.bashrc
add (making the necessary substitutions between the pointy braces)
cycle() {
git stash save "BACKUP"
git checkout <<SOME OTHER BRANCH>>
git branch -D $1
xcodebuild -allowProvisioningUpdates -workspace <<YOUR WORKSPACE>>.xcworkspace -scheme <<YOUR SCHEME>> -configuration Release clean
git checkout $1
}
^X and save it by following the prompts, then enter source ~/.bashrc to make it visible to the current terminal session.
Make sure your branch is pushed to origin, cause we're going to delete it :)
Call the function using cycle <<MY BRANCH>> (once it's run you might want to call git stash pop to restore any working copy changes)
Hope it works for you! Xcode, get on your game!
In my case (mixed objc/swift project) at least part of errors were caused by absence of imports for some used frameworks, e.g. "import UIKit". Project was compiled successfully because frameworks were anyway included in headers in Prefix.pch file. But errors were shown, for example about not finding method defined in UILabel extension, and yes, this extension was without "import UIKit". So I think these errors in most cases depends on Prefix.pch precompilation/updating.
Touching Prefix.pch, cleaning, removing derived data, closing/opening XCode sometimes helps, but not always.
Using SPM, it can be that the Module you import, which you use at the location of the errors, has missing dependencies itself.
In my case I had an error about a missing initializer, XCode trying to use a different one than the one already defined in the other Module. But the project compiled fine! Nothing worked at first. Then I tried first cleaning, and then Product -> Perform Action -> Compile "myfile.swift" and it showed what the missing dependency in the dependency was! Note: This goes recursive. In multiple places a depenendency may have not been declared in the package.swift -> compile the same file repeatedly until it compiles successfully.
So.. it wasn't that the module with the error had a missing dependency, but rather that the direct dependency did miss a Module-dependency declaration in its package.swift declaration.
My explanation is that to generate the Error-output of XCode, Modules get compiled alone on their own. Import errors then show up. But when Modules are built as part of a larger Module, then that large module may import the missing dependency of the broken sub-Module already, making the build pass.

Xcode flex lexer not generated

I'm having an issue with xcode. My project has a lexer which should be created (from lexer.l) before compiling anything. Flex should create two files from lexer.l: lexer.c and lexer.h. The latter is included in some other files. What happens now is Xcode does not process lexer.l and then complains about missing lexer.h. lexer.l is include in the compile sources list under build phases. Any thoughts?
One year late I can provide a solution. Maybe someone else can use it.
As I read on some answer on SO Xcode needs some special file extensions to map them to the different programming languages. When you want to compile c++ code f.e. you have to give the lexfile the ending .lpp. Xcode will handle the rest

Is it possible to prevent/stop xcodebuild from rebuilding everything

I am trying to compile my project twice in a row, just with one preprocessor defined for the second build. (this #define is only used in one source file)
However when i call xcodebuild for the second time it rebuild everything! Using LLVM Compiler 3.0. XCode 4.2
Do you mean pre-processor flag? Whats the difference between the two builds? Just asking because sometimes there are other ways to achieve the same result.
You need to give us some more details and examples of you command lines etc.
Ijust did a quick google and checked the Xcode doco, GCC_PREPROCESSORDEFINITIONS should be GCC_PREPROCESSOR_DEFINITIONS. Xcodebuild is simply ignoring your setting because it doesn't recognise it.

Resources