dkimitsa / robovm-robopods

32 stars 9 forks source link

Compile error with Facebook SDK #5

Closed fgnm closed 4 years ago

fgnm commented 4 years ago

Hi, I'm trying to integrate latest Facebook SDK into my project. I've followed instructions as usual, copied FBSDKCoreKit, FBSDKShareKit andFBSDKLoginKit into libs folder, added to robovm.xml file and java part. Now when I try to compile it returns this error:

[ERROR] 17:42:55.631 Undefined symbols for architecture arm64:
[ERROR] 17:42:55.631   "associated conformance descriptor for Foundation._ErrorCodeProtocol.Foundation._ErrorCodeProtocol._ErrorType: Foundation._BridgedStoredNSError", referenced from:
[ERROR] 17:42:55.643       l_got.$s10Foundation18_ErrorCodeProtocolP01_B4TypeAC_AA21_BridgedStoredNSErrorTn in FBSDKLoginKit(LoginManager.o)
[ERROR] 17:42:55.770   "protocol descriptor for Foundation._ErrorCodeProtocol", referenced from:
[ERROR] 17:42:55.782       l_got.$s10Foundation18_ErrorCodeProtocolMp in FBSDKLoginKit(LoginManager.o)
[ERROR] 17:42:55.920   "method descriptor for Foundation._BridgedStoredNSError.init(_nsError: __C.NSError) -> A", referenced from:
[ERROR] 17:42:55.933       l_got.$s10Foundation21_BridgedStoredNSErrorP8_nsErrorxSo0D0C_tcfCTq in FBSDKLoginKit(LoginManager.o)
[ERROR] 17:42:56.082   "associated conformance descriptor for Foundation._BridgedStoredNSError.Foundation._BridgedStoredNSError.Code: Swift.RawRepresentable", referenced from:
[ERROR] 17:42:56.097       l_got.$s10Foundation21_BridgedStoredNSErrorP4CodeAC_SYTn in FBSDKLoginKit(LoginManager.o)
[ERROR] 17:42:56.245   "base conformance descriptor for Foundation._ErrorCodeProtocol: Swift.Equatable", referenced from:
[ERROR] 17:42:56.258       l_got.$s10Foundation18_ErrorCodeProtocolPSQTb in FBSDKLoginKit(LoginManager.o)
[ERROR] 17:42:56.398   "associated conformance descriptor for Foundation._BridgedStoredNSError.Foundation._BridgedStoredNSError.Code: Foundation._ErrorCodeProtocol", referenced from:
[ERROR] 17:42:56.411       l_got.$s10Foundation21_BridgedStoredNSErrorP4CodeAC_AA06_ErrorE8ProtocolTn in FBSDKLoginKit(LoginManager.o)
[ERROR] 17:42:56.542   "base conformance descriptor for Foundation._BridgedStoredNSError: Swift.Hashable", referenced from:
[ERROR] 17:42:56.555       l_got.$s10Foundation21_BridgedStoredNSErrorPSHTb in FBSDKLoginKit(LoginManager.o)
[ERROR] 17:42:56.702   "base conformance descriptor for Foundation._BridgedStoredNSError: Foundation.CustomNSError", referenced from:
[ERROR] 17:42:56.716       l_got.$s10Foundation21_BridgedStoredNSErrorPAA06CustomD0Tb in FBSDKLoginKit(LoginManager.o)
[ERROR] 17:42:56.854   "method descriptor for static Foundation.CustomNSError.errorDomain.getter : Swift.String", referenced from:
[ERROR] 17:42:56.868       l_got.$s10Foundation13CustomNSErrorP11errorDomainSSvgZTq in FBSDKLoginKit(LoginManager.o)
[ERROR] 17:42:57.002   "base conformance descriptor for Foundation.CustomNSError: Swift.Error", referenced from:
[ERROR] 17:42:57.016       l_got.$s10Foundation13CustomNSErrorPs5ErrorTb in FBSDKLoginKit(LoginManager.o)
[ERROR] 17:42:57.150   "method descriptor for Foundation._ObjectiveCBridgeableError.init(_bridgedNSError: __shared __C.NSError) -> A?", referenced from:
[ERROR] 17:42:57.163       l_got.$s10Foundation26_ObjectiveCBridgeableErrorP15_bridgedNSErrorxSgSo0F0Ch_tcfCTq in FBSDKLoginKit(LoginManager.o)
[ERROR] 17:42:57.299   "method descriptor for Swift.Error._getEmbeddedNSError() -> Swift.AnyObject?", referenced from:
[ERROR] 17:42:57.312       l_got.$ss5ErrorP19_getEmbeddedNSErroryXlSgyFTq in FBSDKLoginKit(LoginManager.o)
[ERROR] 17:42:57.450   "method descriptor for Swift.Error._userInfo.getter : Swift.AnyObject?", referenced from:
[ERROR] 17:42:57.463       l_got.$ss5ErrorP9_userInfoyXlSgvgTq in FBSDKLoginKit(LoginManager.o)
[ERROR] 17:42:57.596   "method descriptor for Swift.Error._code.getter : Swift.Int", referenced from:
[ERROR] 17:42:57.609       l_got.$ss5ErrorP5_codeSivgTq in FBSDKLoginKit(LoginManager.o)
[ERROR] 17:42:57.738   "protocol conformance descriptor for Swift.Int : Swift.FixedWidthInteger in Swift", referenced from:
[ERROR] 17:42:57.751       lazy protocol witness table accessor for type Swift.Int and conformance Swift.Int : Swift.FixedWidthInteger in Swift in FBSDKLoginKit(LoginManager.o)
[ERROR] 17:42:57.890   "type metadata for Swift.Int", referenced from:
[ERROR] 17:42:57.904       lazy protocol witness table accessor for type Swift.Int and conformance Swift.Int : Swift.FixedWidthInteger in Swift in FBSDKLoginKit(LoginManager.o)
[ERROR] 17:42:58.051   "protocol descriptor for Foundation.CustomNSError", referenced from:
[ERROR] 17:42:58.066       l_got.$s10Foundation13CustomNSErrorMp in FBSDKLoginKit(LoginManager.o)
[ERROR] 17:42:58.209   "static Swift._DictionaryStorage.allocate(capacity: Swift.Int) -> Swift._DictionaryStorage<A, B>", referenced from:
[ERROR] 17:42:58.223       function signature specialization <Arg[0] = Owned To Guaranteed, Arg[1] = Dead> of generic specialization <serialized, Swift.String, Any> of Swift.Dictionary.init(dictionaryLiteral: (A, B)...) -> [A : B] in FBSDKLoginKit(LoginManager.o)
[ERROR] 17:42:58.360   "__swiftEmptyDictionarySingleton", referenced from:
[ERROR] 17:42:58.374       function signature specialization <Arg[0] = Owned To Guaranteed, Arg[1] = Dead> of generic specialization <serialized, Swift.String, Any> of Swift.Dictionary.init(dictionaryLiteral: (A, B)...) -> [A : B] in FBSDKLoginKit(LoginManager.o)
[ERROR] 17:42:58.503   "(extension in Foundation):Foundation._BridgedStoredNSError.hash(into: inout Swift.Hasher) -> ()", referenced from:
[ERROR] 17:42:58.517       protocol witness for Swift.Hashable.hash(into: inout Swift.Hasher) -> () in conformance __C_Synthesized.related decl 'e' for FBSDKLoginError : Swift.Hashable in __C_Synthesized in FBSDKLoginKit(LoginManager.o)
[ERROR] 17:42:58.517       protocol witness for Swift.Hashable._rawHashValue(seed: Swift.Int) -> Swift.Int in conformance __C_Synthesized.related decl 'e' for FBSDKLoginError : Swift.Hashable in __C_Synthesized in FBSDKLoginKit(LoginManager.o)
[ERROR] 17:42:58.662   "(extension in ObjectiveC):__C.NSObject.hashValue.getter : Swift.Int", referenced from:
[ERROR] 17:42:58.676       protocol witness for Swift.Hashable.hashValue.getter : Swift.Int in conformance __C_Synthesized.related decl 'e' for FBSDKLoginError : Swift.Hashable in __C_Synthesized in FBSDKLoginKit(LoginManager.o)
[ERROR] 17:42:58.808   "method descriptor for static Swift._ObjectiveCBridgeable._conditionallyBridgeFromObjectiveC(_: A._ObjectiveCType, result: inout A?) -> Swift.Bool", referenced from:
[ERROR] 17:42:58.819       l_got.$ss21_ObjectiveCBridgeableP024_conditionallyBridgeFromA1C_6resultSb01_A5CTypeQz_xSgztFZTq in FBSDKCoreKit(Permission.o)
[ERROR] 17:42:58.962   "method descriptor for Swift.RawRepresentable.init(rawValue: A.RawValue) -> A?", referenced from:
[ERROR] 17:42:58.974       l_got.$sSY8rawValuexSg03RawB0Qz_tcfCTq in FBSDKCoreKit(Permission.o)
[ERROR] 17:42:58.975       l_got.$sSY8rawValuexSg03RawB0Qz_tcfCTq in FBSDKLoginKit(LoginManager.o)

[Stripped output because too long]

It's appear to be a common problem with SDK v7, have you any advice on how to fix in RoboVM? It seams to miss some swift libraries

dkimitsa commented 4 years ago

this happens when you use static Facebook frameworks. in this case swift dependencies are not solved automatically. there is two options:

    <libs>
        <lib>libswiftCore.dylib</lib>>
        <lib>libswiftCoreFoundation.dylib</lib>>
        <lib>libswiftCoreGraphics.dylib</lib>>
        <lib>libswiftCoreImage.dylib</lib>>
        <lib>libswiftDarwin.dylib</lib>>
        <lib>libswiftDispatch.dylib</lib>>
        <lib>libswiftFoundation.dylib</lib>>
        <lib>libswiftMetal.dylib</lib>>
        <lib>libswiftObjectiveC.dylib</lib>>
        <lib>libswiftQuartzCore.dylib</lib>>
        <lib>libswiftUIKit.dylib</lib>>

        <lib>swiftCompatibility51</lib>
    </libs>
fgnm commented 4 years ago

@dkimitsa thank you so much, indeed it worked! And thank you for explain how to link swift manually, might be useful in other contexts. I only suggest to add these info somewhere in readme :)