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.
Related
I run into this ld assertion error while building an iOS dynamic framework in command line using xcodebuild.
0 0x10163b342 __assert_rtn + 144
1 0x101678a3a archive::File<arm64>::makeObjectFileForMember(archive::File<arm64>::Entry const*) const + 1138
2 0x1016783e8 archive::File<arm64>::justInTimeforEachAtom(char const*, ld::File::AtomHandler&) const + 122
3 0x10168ea75 ld::tool::InputFiles::searchLibraries(char const*, bool, bool, bool, ld::File::AtomHandler&) const + 265
4 0x101697db8 ld::tool::Resolver::resolveUndefines() + 160
5 0x10169a117 ld::tool::Resolver::resolve() + 79
6 0x10163c060 main + 812
7 0x7fff9dd4c5ad start + 1
A linker snapshot was created at:
/tmp/MyKit-2016-02-31-154836.ld-snapshot
ld: Assertion failed: (memberIndex != 0), function makeObjectFileForMember, file /Library/Caches/com.apple.xbs/Sources/ld64/ld64-253.9/src/ld/parsers/archive_file.cpp, line 355.
clang: error: linker command failed with exit code 1 (use -v to see invocation)
According to archive_file.cpp source code (http://www.opensource.apple.com/source/ld64/ld64-253.3/src/ld/parsers/archive_file.cpp) it seems there are some kind of symbol corruption while ld is loading a library. But other than that I have no clue how this issue might be fixed.
This issue shows up only when I try to build my framework with bitcode enabled by adding "-fembed-bitcode" compiler flag.
Also, in my ld command, I am trying to link against a few static libraries, one of them is > 4.25 GB (with bitcode built-in), and this size exceeds an unsigned 32-bit integer's max value (~ 3.99 GB). I previously run into a few issue with libtool related to not being able to handle large binary libs, so this is one of my suspicion.
I wonder if anyone has seen similar problems or figure out how to fix it ? Thanks
a few related questions
Weird xCode linker error I've never seen before saying "Assertion failed"
https://github.com/SciRuby/nmatrix/issues/69
http://lists.llvm.org/pipermail/llvm-dev/2013-October/066722.html
https://github.com/TrinityCore/TrinityCore/issues/14689
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57438
Do you want to read the explanation for your error, which is ld: Assertion failed: (memberIndex != 0) ...? Follow this link
Also, don't worry about the size of your static library. The linker will remove all unnecessary information in the final executable. Please read here
TL; DR version:
Clean your project using Command-Option-Shift-K. Also, choose Window > Organizer and switch to the Projects tab. Click the right-arrow to the right of the Derived Data folder name, delete Derived Data folder, and restart XCode.
go to Build Settings in your project's settings => find Linking->Other linker flags => add -v. This will show you the exact corrupted file that is causing your error, if it still occurs. If you have the error again, please post the path of the corrupted file here, we can work from there.
The reason of your error is because one of your static library is corrupt. You can remove your 4.25gb lib and rebuild again to see if this is the problem. It is under your project's target settings -> build phases -> link binary with libraries. If the error goes away, that might be it. In this case, care to give the name of the lib?
Just adding to oasisweng's answer.
Does one of the following help?:
Every time I upgrade Xcode, I get linker errors with brew installed GCC
Are you reliant on any dependencies that do not have Bitcode enabled?
Similar error reported at the Unity forum; see last post in thread
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.
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.
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.
I'm getting errors in XCode attempting to build OSG for iOS 7.0. I've followed these instructions:
http://www.openscenegraph.org/index.php/documentation/platform-specifics/ios/23-configuring-cmake-for-ios
with the additional step of changing the framework version to 7.0 in the CMakeLists.txt file, as using the default of 6.0 caused XCode to complain about an unknown framework. I chose the IPHONE_SIMULATOR option.
When I attempt to build the project after generating it with CMake, I get three errors in osgDB complaining about stat64, and one about a missing header (perhaps related but I get the feeling something else is going on):
/Users/clay2/src/OpenSceneGraph-3.2.0/src/osgDB/FileUtils.cpp:153:9: error: call to unavailable function 'stat64': not available on iOS
if( stat64( path.c_str(), &stbuf ) == 0 )
^~~~~~
In file included from /Users/clay2/src/OpenSceneGraph-3.2.0/src/osgDB/FileUtils.cpp:87:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/sys/stat.h:380:5: note: candidate function has been explicitly made unavailable
int stat64(const char *, struct stat64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5,__MAC_10_6,__IPHONE_NA,__IPHONE_NA);
^
/Users/clay2/src/OpenSceneGraph-3.2.0/src/osgDB/FileUtils.cpp:176:13: error: call to unavailable function 'stat64': not available on iOS
if( stat64( dir.c_str(), &stbuf ) < 0 )
^~~~~~
In file included from /Users/clay2/src/OpenSceneGraph-3.2.0/src/osgDB/FileUtils.cpp:87:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/sys/stat.h:380:5: note: candidate function has been explicitly made unavailable
int stat64(const char *, struct stat64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5,__MAC_10_6,__IPHONE_NA,__IPHONE_NA);
^
/Users/clay2/src/OpenSceneGraph-3.2.0/src/osgDB/FileUtils.cpp:301:10: error: call to unavailable function 'stat64': not available on iOS
if ( stat64(filename.c_str(), &fileStat) != 0 )
^~~~~~
In file included from /Users/clay2/src/OpenSceneGraph-3.2.0/src/osgDB/FileUtils.cpp:87:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/sys/stat.h:380:5: note: candidate function has been explicitly made unavailable
int stat64(const char *, struct stat64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5,__MAC_10_6,__IPHONE_NA,__IPHONE_NA);
^
/Users/clay2/src/OpenSceneGraph-3.2.0/src/osgDB/FileUtils.cpp:881:18: fatal error: 'CoreServices/CoreServices.h' file not found
#include <CoreServices/CoreServices.h>
^
4 errors generated.
CMake version is 2.8-12, OSG 3.2.0, XCode 5.0.2.
Various things I've tried:
iphone instead of iphone_simulator setting; iphone complains about openthreads being a dynamic library, even though I unchecked DYNAMIC_OPENTHREADS in cmake. It does, however, appear to make the other errors go away.
Blowing away the build directory and re-doing the config step, several times
Manually setting the framework settings for ios in xcode after configuration
I did previously get an OSX build of OSG to work without issue, for what it's worth.