[swift-users] libswift frontend ios

Ramakrishna Mallireddy ramakrishna.malli at gmail.com
Wed Mar 23 12:58:19 CDT 2016


Finally I am able to run the swift front end [swift 2.2 released
yesterday].

When running in simulator with arch i386 and debug configuration, I hit
with

*Assertion failed: ((PtrWord & ~PointerBitMask) == 0 && "Pointer is not
sufficiently aligned"), function setPointerAndInt, file
/Users/chinnari/Tutorials/libswift/llvm/include/llvm/ADT/PointerIntPair.h,
line 114.*

my input source.swift file contains a import UIKit & a let statement.

Can someone help me on this please.

The complete back trace is below:

(lldb) bt all

* thread #1: tid = 0xc5054, 0x0e6fa69a
libsystem_kernel.dylib`__pthread_kill + 10, queue =
'com.apple.main-thread', stop reason = signal SIGABRT

    frame #0: 0x0e6fa69a libsystem_kernel.dylib`__pthread_kill + 10

    frame #1: 0x0e6c5634 libsystem_pthread.dylib`pthread_kill + 101

  * frame #2: 0x03d45350 LLVMTest`::raise(sig=6) + 32 at Signals.inc:422

    frame #3: 0x03d4543a LLVMTest`::abort() + 26 at Signals.inc:439

    frame #4: 0x03d45412 LLVMTest`::__assert_rtn(func="setPointerAndInt",
file="/Users/chinnari/Tutorials/libswift/llvm/include/llvm/ADT/PointerIntPair.h",
line=114, expr="(PtrWord & ~PointerBitMask) == 0 && \"Pointer is not
sufficiently aligned\"") + 178 at Signals.inc:435

    frame #5: 0x04af3cf5 LLVMTest`llvm::PointerIntPair<void*, 1u, bool,
llvm::PointerUnionUIntTraits<swift::ProtocolDecl*,
swift::ProtocolConformance*> >::setPointerAndInt(this=0x7e5e0bd0,
PtrVal=0x7e5e0b34, IntVal=true) + 165 at PointerIntPair.h:113

    frame #6: 0x045578d4 LLVMTest`llvm::PointerUnion<swift::ProtocolDecl*,
swift::ProtocolConformance*>::operator=(this=0x7e5e0bd0, RHS=0xbff4f800) +
68 at PointerUnion.h:172

    frame #7: 0x0442dbdf
LLVMTest`swift::ConformanceLookupTable::registerProtocolConformance(this=0x7e5e08f0,
conformance=0x7e5e0b34) + 591 at ConformanceLookupTable.cpp:870

    frame #8: 0x04557435
LLVMTest`swift::NominalTypeDecl::registerProtocolConformance(this=0x7e435bf0,
conformance=0x7e5e0b34) + 53 at ProtocolConformance.cpp:631

    frame #9: 0x04ed4ec6
LLVMTest`swift::ModuleFile::readNormalConformance(this=0x7c3c6200,
conformanceID=(Value = 311)) + 1158 at Deserialization.cpp:578

    frame #10: 0x04ed4436
LLVMTest`swift::ModuleFile::readConformance(this=0x7c3c6200,
Cursor=0x7c3c623c) + 1910 at Deserialization.cpp:501

    frame #11: 0x04edd176
LLVMTest`swift::ModuleFile::loadAllConformances(this=0x7c3c6200,
D=0x7e435bf0, contextData=2533274845394404, conformances=0xbff4ff80) + 630
at Deserialization.cpp:4006

    frame #12: 0x0442c102 LLVMTest`void
swift::ConformanceLookupTable::forEachInStage<swift::ConformanceLookupTable::updateLookupTable(swift::NominalTypeDecl*,
swift::ConformanceLookupTable::ConformanceStage,
swift::LazyResolver*)::$_2,
swift::ConformanceLookupTable::updateLookupTable(swift::NominalTypeDecl*,
swift::ConformanceLookupTable::ConformanceStage,
swift::LazyResolver*)::$_3>(this=0x7e5e08f0, stage=RecordedExplicit,
nominal=0x7e435bf0, resolver=0xbff5a2a8,
nominalFunc=swift::ConformanceLookupTable::(anonymous class) @ 0xbff4ffe0,
extensionFunc=swift::ConformanceLookupTable::(anonymous class) @
0xbff4ffe8)::$_2,
swift::ConformanceLookupTable::updateLookupTable(swift::NominalTypeDecl*,
swift::ConformanceLookupTable::ConformanceStage,
swift::LazyResolver*)::$_3) + 386 at ConformanceLookupTable.cpp:156

    frame #13: 0x0442b985
LLVMTest`swift::ConformanceLookupTable::updateLookupTable(this=0x7e5e08f0,
nominal=0x7e435bf0, stage=RecordedExplicit, resolver=0xbff5a2a8) + 229 at
ConformanceLookupTable.cpp:274

    frame #14: 0x0442b9b6
LLVMTest`swift::ConformanceLookupTable::updateLookupTable(this=0x7e5e08f0,
nominal=0x7e435bf0, stage=Inherited, resolver=0xbff5a2a8) + 278 at
ConformanceLookupTable.cpp:294

    frame #15: 0x0442f598
LLVMTest`swift::ConformanceLookupTable::lookupConformance(this=0x7e5e08f0,
module=0x7c387340, nominal=0x7e435bf0, protocol=0x7bbb9830,
resolver=0xbff5a2a8, conformances=0xbff50560) + 104 at
ConformanceLookupTable.cpp:887

    frame #16: 0x0455726d
LLVMTest`swift::NominalTypeDecl::lookupConformance(this=0x7e435bf0,
module=0x7c387340, protocol=0x7bbb9830, conformances=0xbff50560) const +
125 at ProtocolConformance.cpp:593

    frame #17: 0x044fdc26
LLVMTest`swift::ModuleDecl::lookupConformance(this=0x7c387340, type=Type @
0xbff50694, protocol=0x7bbb9830, resolver=0xbff5a2a8) + 2166 at
Module.cpp:886

    frame #18: 0x04deda3d
LLVMTest`swift::TypeChecker::conformsToProtocol(this=0xbff5a2a8, T=Type @
0xbff50754, Proto=0x7bbb9830, DC=0x7bbbaf70, options=(Storage = 1),
Conformance=0x00000000, ComplainLoc=SourceLoc @ 0xbff50768) + 205 at
TypeCheckProtocol.cpp:4053

    frame #19: 0x04c76964
LLVMTest`swift::constraints::ConstraintSystem::simplifyConformsToConstraint(this=0xbff59540,
type=Type @ 0xbff508d4, protocol=0x7bbb9830, kind=ConformsTo,
locator=ConstraintLocatorBuilder @ 0xbff50950, flags=0) + 676 at
CSSimplify.cpp:2283

    frame #20: 0x04c7ccb0
LLVMTest`swift::constraints::ConstraintSystem::simplifyConformsToConstraint(this=0xbff59540,
type=Type @ 0xbff50984, protocol=Type @ 0xbff50988, kind=ConformsTo,
locator=ConstraintLocatorBuilder @ 0xbff50be8, flags=0) + 224 at
CSSimplify.cpp:2250

    frame #21: 0x04c83ce6
LLVMTest`swift::constraints::ConstraintSystem::simplifyConstraint(this=0xbff59540,
constraint=0x7b9d8698) + 2038 at CSSimplify.cpp:4393

    frame #22: 0x04c8d28f
LLVMTest`swift::constraints::ConstraintSystem::simplify(this=0xbff59540,
ContinueAfterFailures=false) + 239 at CSSolver.cpp:331

    frame #23: 0x04c90517
LLVMTest`swift::constraints::ConstraintSystem::solveRec(this=0xbff59540,
solutions=0xbff58df0, allowFreeTypeVariables=Disallow) + 119 at
CSSolver.cpp:1215

    frame #24: 0x04c94f52 LLVMTest`tryTypeVariableBindings(cs=0xbff59540,
depth=4, typeVar=0x7b9d8670, bindings=ArrayRef<(anonymous
namespace)::PotentialBinding> @ 0xbff51ddc, solutions=0xbff58df0,
allowFreeTypeVariables=Disallow)::PotentialBinding>,
llvm::SmallVectorImpl<swift::constraints::Solution>&,
swift::FreeTypeVariableBinding) + 1602 at CSSolver.cpp:1078

    frame #25: 0x04c92d1d
LLVMTest`swift::constraints::ConstraintSystem::solveSimplified(this=0xbff59540,
solutions=0xbff58df0, allowFreeTypeVariables=Disallow) + 909 at
CSSolver.cpp:1551

    frame #26: 0x04c9080b
LLVMTest`swift::constraints::ConstraintSystem::solveRec(this=0xbff59540,
solutions=0xbff58df0, allowFreeTypeVariables=Disallow) + 875 at
CSSolver.cpp:1256

    frame #27: 0x04c94f52 LLVMTest`tryTypeVariableBindings(cs=0xbff59540,
depth=3, typeVar=0x7b9d8700, bindings=ArrayRef<(anonymous
namespace)::PotentialBinding> @ 0xbff5344c, solutions=0xbff58df0,
allowFreeTypeVariables=Disallow)::PotentialBinding>,
llvm::SmallVectorImpl<swift::constraints::Solution>&,
swift::FreeTypeVariableBinding) + 1602 at CSSolver.cpp:1078

    frame #28: 0x04c92d1d
LLVMTest`swift::constraints::ConstraintSystem::solveSimplified(this=0xbff59540,
solutions=0xbff58df0, allowFreeTypeVariables=Disallow) + 909 at
CSSolver.cpp:1551

    frame #29: 0x04c9080b
LLVMTest`swift::constraints::ConstraintSystem::solveRec(this=0xbff59540,
solutions=0xbff58df0, allowFreeTypeVariables=Disallow) + 875 at
CSSolver.cpp:1256

    frame #30: 0x04c94f52 LLVMTest`tryTypeVariableBindings(cs=0xbff59540,
depth=2, typeVar=0x7b9d8858, bindings=ArrayRef<(anonymous
namespace)::PotentialBinding> @ 0xbff54abc, solutions=0xbff58df0,
allowFreeTypeVariables=Disallow)::PotentialBinding>,
llvm::SmallVectorImpl<swift::constraints::Solution>&,
swift::FreeTypeVariableBinding) + 1602 at CSSolver.cpp:1078

    frame #31: 0x04c92d1d
LLVMTest`swift::constraints::ConstraintSystem::solveSimplified(this=0xbff59540,
solutions=0xbff58df0, allowFreeTypeVariables=Disallow) + 909 at
CSSolver.cpp:1551

    frame #32: 0x04c9080b
LLVMTest`swift::constraints::ConstraintSystem::solveRec(this=0xbff59540,
solutions=0xbff58df0, allowFreeTypeVariables=Disallow) + 875 at
CSSolver.cpp:1256

    frame #33: 0x04c94f52 LLVMTest`tryTypeVariableBindings(cs=0xbff59540,
depth=1, typeVar=0x7b9d8610, bindings=ArrayRef<(anonymous
namespace)::PotentialBinding> @ 0xbff5612c, solutions=0xbff58df0,
allowFreeTypeVariables=Disallow)::PotentialBinding>,
llvm::SmallVectorImpl<swift::constraints::Solution>&,
swift::FreeTypeVariableBinding) + 1602 at CSSolver.cpp:1078

    frame #34: 0x04c92d1d
LLVMTest`swift::constraints::ConstraintSystem::solveSimplified(this=0xbff59540,
solutions=0xbff58df0, allowFreeTypeVariables=Disallow) + 909 at
CSSolver.cpp:1551

    frame #35: 0x04c9080b
LLVMTest`swift::constraints::ConstraintSystem::solveRec(this=0xbff59540,
solutions=0xbff58df0, allowFreeTypeVariables=Disallow) + 875 at
CSSolver.cpp:1256

    frame #36: 0x04c94f52 LLVMTest`tryTypeVariableBindings(cs=0xbff59540,
depth=0, typeVar=0x7b9d87f0, bindings=ArrayRef<(anonymous
namespace)::PotentialBinding> @ 0xbff5779c, solutions=0xbff58df0,
allowFreeTypeVariables=Disallow)::PotentialBinding>,
llvm::SmallVectorImpl<swift::constraints::Solution>&,
swift::FreeTypeVariableBinding) + 1602 at CSSolver.cpp:1078

    frame #37: 0x04c92d1d
LLVMTest`swift::constraints::ConstraintSystem::solveSimplified(this=0xbff59540,
solutions=0xbff58df0, allowFreeTypeVariables=Disallow) + 909 at
CSSolver.cpp:1551

    frame #38: 0x04c9080b
LLVMTest`swift::constraints::ConstraintSystem::solveRec(this=0xbff59540,
solutions=0xbff58df0, allowFreeTypeVariables=Disallow) + 875 at
CSSolver.cpp:1256

    frame #39: 0x04c9011c
LLVMTest`swift::constraints::ConstraintSystem::solve(this=0xbff59540,
solutions=0xbff58df0, allowFreeTypeVariables=Disallow) + 268 at
CSSolver.cpp:1193

    frame #40: 0x04d29d58
LLVMTest`swift::TypeChecker::solveForExpression(this=0xbff5a2a8,
expr=0xbff59c3c, dc=0x7bbbaf70, convertType=Type @ 0xbff58bfc,
allowFreeTypeVariables=Disallow, listener=0xbff59bb8, cs=0xbff59540,
viable=0xbff58df0, options=(Storage = 16)) + 808 at
TypeCheckConstraints.cpp:1154

    frame #41: 0x04d2d22f
LLVMTest`swift::TypeChecker::typeCheckExpression(this=0xbff5a2a8,
expr=0xbff59c3c, dc=0x7bbbaf70, convertType=Type @ 0xbff59b3c,
convertTypePurpose=CTP_Unused, options=(Storage = 16), listener=0xbff59bb8)
+ 1247 at TypeCheckConstraints.cpp:1304

    frame #42: 0x04d2f0ea
LLVMTest`swift::TypeChecker::typeCheckBinding(this=0xbff5a2a8,
pattern=0xbff59c40, initializer=0xbff59c3c, DC=0x7bbbaf70) + 442 at
TypeCheckConstraints.cpp:1624

    frame #43: 0x04d2f3ad
LLVMTest`swift::TypeChecker::typeCheckPatternBinding(this=0xbff5a2a8,
PBD=0x7bbbb0c8, patternNumber=0) + 269 at TypeCheckConstraints.cpp:1674

    frame #44: 0x04d796c0
LLVMTest`validatePatternBindingDecl(tc=0xbff5a2a8, binding=0x7bbbb0c8,
entryNumber=0) + 1312 at TypeCheckDecl.cpp:1214

    frame #45: 0x04d844b7 LLVMTest`(anonymous
namespace)::DeclChecker::visitPatternBindingDecl(this=0xbff59f50,
PBD=0x7bbbb0c8) + 119 at TypeCheckDecl.cpp:2842

    frame #46: 0x04d83340 LLVMTest`swift::ASTVisitor<(anonymous
namespace)::DeclChecker, void, void, void, void, void,
void>::visit(this=0xbff59f50, D=0x7bbbb0c8) + 144 at DeclNodes.def:91

    frame #47: 0x04d76519 LLVMTest`(anonymous
namespace)::DeclChecker::visit(this=0xbff59f50, decl=0x7bbbb0c8) + 41 at
TypeCheckDecl.cpp:2672

    frame #48: 0x04d76473
LLVMTest`swift::TypeChecker::typeCheckDecl(this=0xbff5a2a8, D=0x7bbbb0c8,
isFirstPass=false) + 195 at TypeCheckDecl.cpp:5561

    frame #49: 0x04e96466 LLVMTest`(anonymous
namespace)::StmtChecker::visitBraceStmt(this=0xbff5a138, BS=0x7bbbb0f0) +
1222 at TypeCheckStmt.cpp:1078

    frame #50: 0x04e95d1f LLVMTest`swift::ASTVisitor<(anonymous
namespace)::StmtChecker, void, swift::Stmt*, void, void, void,
void>::visit(this=0xbff5a138, S=0x7bbbb0f0) + 95 at StmtNodes.def:43

    frame #51: 0x04e9517b LLVMTest`bool (anonymous
namespace)::StmtChecker::typeCheckStmt<swift::BraceStmt>(this=0xbff5a138,
S=0xbff5a16c) + 43 at TypeCheckStmt.cpp:325

    frame #52: 0x04e950d2
LLVMTest`swift::TypeChecker::typeCheckTopLevelCodeDecl(this=0xbff5a2a8,
TLCD=0x7bbbaf50) + 114 at TypeCheckStmt.cpp:1405

    frame #53: 0x04cf62e9
LLVMTest`swift::performTypeChecking(SF=0x7bbbad80, TLC=0xbff5a958,
Options=(Storage = 1), StartElem=0) + 1177 at TypeChecker.cpp:585

    frame #54: 0x001287c9
LLVMTest`swift::CompilerInstance::performSema(this=0xbff5d6d0) + 12249 at
Frontend.cpp:464

    frame #55: 0x000e8f91 LLVMTest`performCompile(Instance=0xbff5d6d0,
Invocation=0xbff5d368, Args=ArrayRef<const char *> @ 0xbff5c458,
ReturnValue=0xbff5c6ec) + 3825 at frontend_main.cpp:666

    frame #56: 0x000e782d LLVMTest`frontend_main(Args=ArrayRef<const char
*> @ 0xbff5deb0, Argv0="swift", MainAddr=0x0574b020) + 11773 at
frontend_main.cpp:1118

    frame #57: 0x000a215e LLVMTest`+[LibSwiftWrapper
runSwiftFrontend:](self=LibSwiftWrapper, _cmd="runSwiftFrontend:",
options=unable to read data) + 174 at libSwiftWrapper.mm:23

    frame #58: 0x001374c0 LLVMTest`LLVMTest.ViewController.viewDidLoad
(self=0x7b0208e0)() -> () + 400 at ViewController.swift:17

    frame #59: 0x001376b2 LLVMTest`@objc
LLVMTest.ViewController.viewDidLoad (LLVMTest.ViewController)() -> () + 34
at ViewController.swift:0

    frame #60: 0x0ca062ae UIKit`-[UIViewController
_sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 44

    frame #61: 0x0ca0adce UIKit`-[UIViewController loadViewIfRequired] +
1384

    frame #62: 0x0ca0b1ed UIKit`-[UIViewController view] + 35

    frame #63: 0x0c8b8f94 UIKit`-[UIWindow
addRootViewControllerViewIfPossible] + 69

    frame #64: 0x0c8b96b1 UIKit`-[UIWindow _setHidden:forced:] + 304

    frame #65: 0x0c8b9a67 UIKit`-[UIWindow _orderFrontWithoutMakingKey] + 49

    frame #66: 0x0c8cd118 UIKit`-[UIWindow makeKeyAndVisible] + 80

    frame #67: 0x0c8356e7 UIKit`-[UIApplication
_callInitializationDelegatesForMainScene:transitionContext:] + 4190

    frame #68: 0x0c83ccd6 UIKit`-[UIApplication
_runWithMainScene:transitionContext:completion:] + 1989

    frame #69: 0x0c861ee5 UIKit`__84-[UIApplication
_handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke3218
+ 68

    frame #70: 0x0c839966 UIKit`-[UIApplication
workspaceDidEndTransaction:] + 163

    frame #71: 0x0f5fec76 FrontBoardServices`__37-[FBSWorkspace
clientEndTransaction:]_block_invoke_2 + 71

    frame #72: 0x0f5fe74d FrontBoardServices`__40-[FBSWorkspace
_performDelegateCallOut:]_block_invoke + 54

    frame #73: 0x0f61c173 FrontBoardServices`-[FBSSerialQueue _performNext]
+ 184

    frame #74: 0x0f61c5aa FrontBoardServices`-[FBSSerialQueue
_performNextFromRunLoopSource] + 52

    frame #75: 0x0f61b8a6
FrontBoardServices`FBSSerialQueueRunLoopSourceHandler + 33

    frame #76: 0x0c3c96ff
CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ +
15

    frame #77: 0x0c3bf38b CoreFoundation`__CFRunLoopDoSources0 + 523

    frame #78: 0x0c3be7a8 CoreFoundation`__CFRunLoopRun + 1032

    frame #79: 0x0c3be0e6 CoreFoundation`CFRunLoopRunSpecific + 470

    frame #80: 0x0c3bdefb CoreFoundation`CFRunLoopRunInMode + 123

    frame #81: 0x0c839206 UIKit`-[UIApplication _run] + 540

    frame #82: 0x0c83ebfa UIKit`UIApplicationMain + 160

    frame #83: 0x0013711c LLVMTest`main + 140 at AppDelegate.swift:12

    frame #84: 0x0e3c6a21 libdyld.dylib`start + 1


  thread #2: tid = 0xc5088, 0x0e6fb8ce libsystem_kernel.dylib`kevent64 +
10, queue = 'com.apple.libdispatch-manager'

    frame #0: 0x0e6fb8ce libsystem_kernel.dylib`kevent64 + 10

    frame #1: 0x0e38a048 libdispatch.dylib`_dispatch_mgr_invoke + 257

    frame #2: 0x0e389d98 libdispatch.dylib`_dispatch_mgr_thread + 60

(lldb)


Thanks

Ramakrishna

On Tue, Mar 22, 2016 at 12:59 AM, Ramakrishna Mallireddy <
ramakrishna.malli at gmail.com> wrote:

> After resolving the opengles conflict with llvm code base, I am stuck at
> undefined symbol error,
>
> Undefined symbols for architecture i386:
>
>   "(anonymous namespace)::*LoweredValue*::*$_6*::*$_7*::*~$_7()*",
> referenced from:
>
>       (anonymous namespace)::*LoweredValue*::*LoweredValue*(*swift*::
> *irgen*::*Explosion*&) in libSwift.a(*IRGenSIL*.o)
>
> ld: symbol(s) not found for architecture i386
>
> I am not getting this error, when I link the swift libs generated by the
> build script that comes with the swift source.
>
> This error is generated, only when I included all the swift front-end
> source[except Immediate.a source ] in my project and compiled it as a
> single static library and linked it to my app.
>
> I believe the following code (*IRGenSIL.cpp*) is the one that mentioned
> in the error:
>
> *LoweredValue(Explosion &e)*
>
> *    : kind(Kind::Explosion), explosion{{}} {*
>
> *    auto Elts = e.claimAll();*
>
> *    explosion.values.append(Elts.begin(), Elts.end());*
>
> *  }*
>
> Thanks
>
> Ramakrishna
>
> On Fri, Mar 18, 2016 at 3:17 AM, Joe Groff <jgroff at apple.com> wrote:
>
>>
>> > On Mar 17, 2016, at 2:22 PM, Ramakrishna Mallireddy <
>> ramakrishna.malli at gmail.com> wrote:
>> >
>> > The libLLVMContainer.dylib is actually from opengl.framework.
>> > On iOS the lib may be loaded by opengles.framework and I am not using
>> any opengl myself, ios may be loading it by default.
>> >
>> > I have compiled llvm core & support libs along with my llvmtest code,
>> Even then the conflict remains.
>> > How to I get around this.
>>
>> You should statically link in any LLVM libraries you need, ensuring you
>> link the versions built as part of your swiftc build. LLVM libraries are
>> not ABI-stable, and any LLVM libraries that might happen to be distributed
>> in the OS are not for use outside the OS.
>>
>> -Joe
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160323/00f3cfa1/attachment.html>


More information about the swift-users mailing list