LLVM ERROR: Broken function found, compilation aborted - ios

Here are couple of simple lines in swift:
let umAB: Unmanaged<ABAddressBookRef> = ABAddressBookCreate()
let ab: ABAddressBookRef = umAB.takeRetainedValue()
The second line breaks code compilation, here's the error that I get:
Bitcast requires both operands to be pointer or neither
%27 = bitcast %objc_object* %26 to %PSs9AnyObject_, !dbg !170
LLVM ERROR: Broken function found, compilation aborted!
Command /Applications/Xcode6-Beta2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift failed with exit code 1
Any ideas what's wrong with the second line?

This is late, but the answer is simple: This is a bug in the compiler. LLVM ERROR implies that bad LLVM IR has been generated, and that is a bug in the calling program.

Related

Swift expression evaluator (LLDB): error while loading Swift module

I have a target with mixed Swift and Objective-C code. I do the following:
I put a breakpoint on a line in a Swift file part of this target.
I run this target.
I type po $someVariableName in the debugger once it hits the breakpoint.
The debugger now shows a host of errors, ending with:
error: failed to import bridging header '/path/to/Bridging-Header.h'
Couldn't initialize Swift expression evaluator due to previous errors.
The output starts with:
Error while loading Swift module:
TARGET_NAME: /path/to/Bridging-Header.h:18:9: note: in file included from /path/to/Bridging-Header.h:18:
In between are a host of nullability annotation warnings and errors about unknown type names. Some errors come from bridging headers in the Carthage builds directory:
error: /path/to/project/Carthage/Build/iOS/Some.framework/Headers/Some-Swift.h
It seems as if whatever is executing after my po statement, lacks a few header imports or executes things in the wrong order. Any clue as to what could be wrong here?
I am using Xcode 11.4 (11E146)

Implicit declaration of function 'xmlFree' is invalid in C99

We use WSDLParser tool to parse our xml content, till Xcode 9.2 everything was ok. As we shifted to Xcode 9.3, we are getting this error in one of parser file "Implicit declaration of function 'xmlFree' is invalid in C99".
The declaration was moved to globals.h, it should compile with this import:
#import <libxml/globals.h>

Upgrade project from swift1.x to swift2

after modifying lots of code for swift2, remove lots of error.
and finally it shows swiftc failed with exit code 1
and I got this error as well...
Invalid bitcast
%16 = bitcast i32 %15 to %CSo15NSManagedObject*, !dbg !252
LLVM ERROR: Broken function found, compilation aborted!
any idea on how can I locate the broken function??
Instead of fixing all the errors manually, you should do it automatically. See attached image.

Compiler error with no line number

Whwn trying to compile my project, the following error appears in AppCode (Xcode only prints the "Error: Command... part"):
AppCode:
Note:Stored value type does not match pointer operand type!
Note: store %CSo7UIColor* %135, %objc_object** %136, align 8, !dbg !4686
Error: %objc_object*LLVM ERROR: Broken function found, compilation aborted!
Error:Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
Is there a way to actually get the line number causing the problem ? Note says something related to UIColor but that's the only thing I got from it :S
P.S: I have deleted Derived Data, checked out a previous commit, created a new project and still the same issue. I'm almost certain that the problem is due to a dependency.
Found the problem...
self.navigationController!.navigationBar.titleTextAttributes = [ NSForegroundColorAttributeName : .clearColor()]
.clearColor() should work...Fixed it by appending UIColor back.

swiftc failed with error code 1

i am building a swift/objc app. I have the app working fine on the device, but when i try to archive i get an error
Command
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc
failed with exit code 1
The error seems to link to my Bridging-Header.h file.
I've tried some solutions with no success:
cleaning the Derived Data
setting the optimization level to None
UPDATE
i've installed xcode 6.3 beta 2 and upgraded class with appropriate swift 1.2; in the editor, the build works fine, but when i try to build in the terminal using:
xcodebuild -project Proj.xcodeproj
and i do get a specific error:
Call parameter type does not match function signature!
%V4Hive15MultivalueEntry.64* %0
%V4Hive15MultivalueEntry* tail call void #_TFFC4Hive22SwiftAddressBookPersonP33_FEAC8E239DA88BD1517B50EB72890C1824convertMultivalueEntriesFS0_U_Ss9AnyObject__FTGSqGSaGVS_15MultivalueEntryQ____9converterFQ_Q0__GSqGSaGS2_Q0____U_FGS2_Q__GS2_Q0__(%V4Hive15MultivalueEntry.64* noalias sret %0, %V4Hive15MultivalueEntry.63* noalias %3, i8* %.fn.load, %swift.refcounted* %6, %swift.type* getelementptr inbounds (%swift.full_type* #_TMdSS, i32 0, i32 1), %swift.type* %7), !dbg !5089
LLVM ERROR: Broken function found, compilation aborted!
2015-03-05 10:08:02.467 xcodebuild[6416:24559] DVTAssertions: Warning in /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-7523/Xcode3Core/LegacyProjects/Frameworks/DevToolsCore/DevToolsCore/BuildSystem/BuildCommandResultsPostprocessing/XCClangResultsPostprocessor.m:68
Details: Unable to read diagnostics from file "/Users/erpk/Documents/Work/Hive/Hive/build/Hive.build/Release-iphoneos/Hive.build/Objects-normal/arm64/AddressBookManager.dia" (Invalid File): Invalid diagnostics signature
Function: void XCGenerateDiagnosticsFromFile(NSString *__strong, NSString *__strong, NSDictionary *__strong, NSDictionary *__strong, IDEActivityLogSectionRecorder *__strong, BOOL (^__strong)(IDEActivityLogMessage *__strong))
Thread: {number = 7, name = (null)}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
the main thing to get from this is
LLVM ERROR: Broken function found, compilation aborted!
this is generated in a certain file:
http://snipsave.com/user/profile/badescualex#10418
It looks like he problem is that there is an internal compiler error in the file AddressBookManager.swift I would start commenting out all implementation until you can get it to pass the build. Binary search style. You should be able to isolate it better that way. It would be great if you could provide the Swift team a failing project. They are generally very responsive given a repeatable test case.

Resources