Discussion:
CouchbaseLite and CouchbaseLiteListener as frameworks with module support
Brendan Duddridge
2018-08-17 17:34:15 UTC
Permalink
Hi,

I'm trying to utilize CBL 1.4.2 in a Swift app extension, so I need to
build the dynamic framework version of CBL.

That seems to be ok when I build the iOS Framework - Carthage version
(built right from within Xcode, not actually using Carthage).

But when I do that and try to compile my app which also includes the CBL
Listener framework, I get a bunch of compile errors referencing symbols in
CBL Listener that aren't available for the arm64 architecture:

Undefined symbols for architecture arm64:

"__mdictof", referenced from:

-[CBL_Router queries] in CouchbaseLiteListener(CBL_Router.o)

-[CBLDatabase(REST)
updateAttachment:body:type:encoding:ofDocID:revID:source:status:error:] in
CouchbaseLiteListener(CBLDatabase+REST.o)

-[CBL_Router(Handlers) do_POST_revs_diff:] in
CouchbaseLiteListener(CBL_Router+Handlers.o)

"__castIf", referenced from:

-[CBL_Router bodyAsDictionary] in CouchbaseLiteListener(CBL_Router.o)

-[CBLView(REST) compileFromDesignDoc] in
CouchbaseLiteListener(CBLView+REST.o)

-[CBLView(REST) compileFromProperties:language:] in
CouchbaseLiteListener(CBLView+REST.o)

-[CBLDatabase(REST) getDesignDocFunction:key:language:] in
CouchbaseLiteListener(CBLDatabase+REST.o)

-[CBLDatabase(REST) compileFilterNamed:status:] in
CouchbaseLiteListener(CBLDatabase+REST.o)

-[CBL_Router(Handlers) do_POST_facebook_token] in
CouchbaseLiteListener(CBL_Router+Handlers.o)

-[CBL_Router(Handlers) do_POST_bulk_docs:] in
CouchbaseLiteListener(CBL_Router+Handlers.o)

...

"_$regex", referenced from:

-[CBL_Router processRequestRanges] in
CouchbaseLiteListener(CBL_Router.o)

"__dictof", referenced from:

-[CBLResponse setInternalStatus:] in
CouchbaseLiteListener(CBL_Router.o)

-[CBLResponse setMultipartBody:type:] in
CouchbaseLiteListener(CBL_Router.o)

-[CBLDatabase(REST)
updateAttachment:body:type:encoding:ofDocID:revID:source:status:error:] in
CouchbaseLiteListener(CBLDatabase+REST.o)

-[CBL_Router(Handlers) do_POST_persona_assertion] in
CouchbaseLiteListener(CBL_Router+Handlers.o)

-[CBL_Router(Handlers) do_POST_facebook_token] in
CouchbaseLiteListener(CBL_Router+Handlers.o)

-[CBL_Router(Handlers) do_GET_uuids] in
CouchbaseLiteListener(CBL_Router+Handlers.o)

-[CBL_Router(Handlers) do_GET_session] in
CouchbaseLiteListener(CBL_Router+Handlers.o)

...

"__AssertFailed", referenced from:

-[CBL_Router route] in CouchbaseLiteListener(CBL_Router.o)

-[CBL_Router run] in CouchbaseLiteListener(CBL_Router.o)

_CBLStartServer in CouchbaseLiteListener(CBL_URLProtocol.o)

-[CBLDatabase(REST) attachmentForRevision:named:status:] in
CouchbaseLiteListener(CBLDatabase+REST.o)

___42-[CBL_Router(Handlers) do_POST_bulk_docs:]_block_invoke in
CouchbaseLiteListener(CBL_Router+Handlers.o)

"_$equal", referenced from:

-[CBLHTTPConnection supportsMethod:atPath:] in
CouchbaseLiteListener(CBLHTTPConnection.o)

-[CBLHTTPConnection expectsRequestBodyFromMethod:atPath:] in
CouchbaseLiteListener(CBLHTTPConnection.o)

-[CBL_Router boolQuery:] in CouchbaseLiteListener(CBL_Router.o)

-[CBL_Router cacheWithEtag:] in CouchbaseLiteListener(CBL_Router.o)

-[CBL_Router route] in CouchbaseLiteListener(CBL_Router.o)

-[CBL_Router processRequestRanges] in
CouchbaseLiteListener(CBL_Router.o)

-[CBL_Router sendResponseHeaders] in
CouchbaseLiteListener(CBL_Router.o)

...

ld: symbol(s) not found for architecture arm64

clang: error: linker command failed with exit code 1 (use -v to see
invocation)





Is this because I'm using the dynamic CBL framework and the static CBL
Listener framework together?


Is there a way to compile the CBL Listener as a dynamic framework?


When I type 'file CouchbaseLite', I get the following:



CouchbaseLite: Mach-O universal binary with 2 architectures: [arm_v7:Mach-O
dynamically linked shared library arm_v7] [arm64]

CouchbaseLite (for architecture armv7): Mach-O dynamically linked shared
library arm_v7

CouchbaseLite (for architecture arm64): Mach-O 64-bit dynamically linked
shared library arm64


But when I type 'file CouchbaseLiteListener', I get the following:

CouchbaseLiteListener: Mach-O universal binary with 4 architectures:
[arm_v7:current ar archive] [arm64]
CouchbaseLiteListener (for architecture armv7): current ar archive
CouchbaseLiteListener (for architecture i386): current ar archive
CouchbaseLiteListener (for architecture x86_64): current ar archive
CouchbaseLiteListener (for architecture arm64): current ar archive


So it would seem that the two frameworks are built differently.


Can you think of a reason why CouchbaseLiteListener is not able to see
those symbols?


I think this is the only thing preventing me from successfully compiling my
iOS app extension.


Thanks,


Brendan
--
You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mobile-couchbase+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/20ef2fc2-0622-467f-986d-befe71b50a33%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Jens Alfke' via Couchbase Mobile
2018-08-17 18:16:49 UTC
Permalink
Is this because I'm using the dynamic CBL framework and the static CBL Listener framework together?
Probably, yes. The static listener library is using internal utility functions from CBL that aren't exported from the dynamic lib.
Is there a way to compile the CBL Listener as a dynamic framework?
I'm pretty sure there is. There may not be a premade scheme for it, but look in the list of targets in the Xcode project.

—Jens
Privacy Policy<https://www.couchbase.com/privacy-policy> | Update Marketing Preferences<https://info.couchbase.com/unsubscribe-or-manage-preferences>
--
You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mobile-couchbase+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/DA3F2715-F2DE-49AD-AB06-F95F9F4C522C%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.
Brendan Duddridge
2018-08-17 19:52:59 UTC
Permalink
Thanks for your quick response Jens.

There isn't a CouchbaseLite Listener Framework target. But I won't be using
the listener from within my extension, so I guess I don't need it to be a
dynamic framework. Only CouchbaseLite framework will be used from within
the app extension.

But perhaps if I could just modify the CBL dynamic framework to export the
internal utility functions so that CouchbaseLiteListener framework could
access them, then it would compile?

Is it just a matter of adding the CollectionUtils.h header file from
MyUtilities to the CBL iOS Framework's Headers Build Phase?

I just tried that and it didn't seem to work. When I compile I get the same
issue.

I did try to add CollectionUtils.m to the Compile Sources build phase, but
then I just got errors that there were duplicate symbols. So I'm sure it's
compiling those functions into the app, but as you say, not being exposed
by the dynamic framework.

I feel like I'm so close to getting it...

Thanks,

Brendan
Post by Brendan Duddridge
Post by Brendan Duddridge
Is this because I'm using the dynamic CBL framework and the static CBL
Listener framework together?
Probably, yes. The static listener library is using internal utility
functions from CBL that aren't exported from the dynamic lib.
Post by Brendan Duddridge
Is there a way to compile the CBL Listener as a dynamic framework?
I'm pretty sure there is. There may not be a premade scheme for it, but
look in the list of targets in the Xcode project.
—Jens
Privacy Policy<https://www.couchbase.com/privacy-policy> | Update
Marketing Preferences<
https://info.couchbase.com/unsubscribe-or-manage-preferences>
--
You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mobile-couchbase+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/544d6ca8-5a44-4998-b62b-f7a0c657ecce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Brendan Duddridge
2018-08-17 20:58:39 UTC
Permalink
I got it compiling now by adding the following directly to the Listener IOS
Library target:

MyRegexUtils.m
ExceptionUtils.m
CollectionUtils.m
Test.m
Test_Assertions.m

And now it runs and now I can move on.

Thanks!

Brendan
--
You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mobile-couchbase+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/f134c84d-be2a-4734-a2a0-e6f8f15820eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...