Linking Errors in iOS

41 views
Skip to first unread message

Nathan Jackson

unread,
Aug 25, 2016, 9:40:44 PM8/25/16
to Couchbase Mobile
Hi,

I'm trying to build with Couchbase Lite for iOS. I have successfully linked against Couchbase Lite itself, but have been unsuccessful in trying to link the listener framework.


I am getting the following link errors.

Undefined symbols for architecture x86_64:


  "_$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)


      ...


  "_$regex", referenced from:


      -[CBL_Router processRequestRanges] in CouchbaseLiteListener(CBL_Router.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)


  "__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)


      ...


  "__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)


      ...


  "__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)


ld: symbol(s) not found for architecture x86_64


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


I've added all of the additional libraries including the extra JavaScriptCore framework.

Help would be appreciated!

Jens Alfke

unread,
Aug 25, 2016, 10:10:31 PM8/25/16
to mobile-c...@googlegroups.com
Are you linking with both frameworks? The listener depends on CouchbaseLite.

--Jens

Nathan Jackson

unread,
Aug 25, 2016, 10:22:21 PM8/25/16
to Couchbase Mobile


Yeah, here is what my "Link Binary with Libraries" section looks like.



The libXlsxReaderWriter is for some other functionality of my app.

James Nocentini

unread,
Aug 26, 2016, 2:16:59 AM8/26/16
to Couchbase Mobile
I've tried on Xcode 7 and it linked successfully. Can you try to copy the CBL frameworks in a new Frameworks folder in your Xcode project in Finder first? Then drag them to the Link Binary With Libraries section in Xcode.

If it's a Swift project, the bridging header needs both imports:

#import <CouchbaseLite/CouchbaseLite.h>

#import <CouchbaseLiteListener/CouchbaseLiteListener.h>


James

Nathan Jackson

unread,
Aug 26, 2016, 10:13:34 AM8/26/16
to Couchbase Mobile
I will give this a shot later today when I'm in front of my Mac.

For what its worth, I am integrating Couchbase Lite into my existing Objective-C app. I don't know if that might have anything to do with it.

Jens Alfke

unread,
Aug 26, 2016, 4:43:51 PM8/26/16
to mobile-c...@googlegroups.com
I’m pretty sure you’ve got a mismatched set of CBL libraries — possibly one is Mac and the other iOS, or maybe they’re different versions. Where did you get the libraries from? Check the paths to the libraries in your Xcode project to make sure they’re the ones you expect.

—Jens

Nathan Jackson

unread,
Aug 26, 2016, 4:53:48 PM8/26/16
to Couchbase Mobile
So I removed all references to the library in my build settings. Copied the frameworks into my project's root and then added them to the "Link Binary with Library" list manually. Same result.

The build works fine when adding just "CouchbaseLite.framework". It only breaks when "CouchbaseLiteListener.framework" is added.

I've tried building the framework myself, including it as a submodule, and the libraries that can be downloaded from the CB website. Same result. Its got to be something in my project config, but nothing stands out to me.

Jens Alfke

unread,
Aug 26, 2016, 5:01:21 PM8/26/16
to mobile-c...@googlegroups.com
Email me the project folder (including the frameworks) and I’ll take a look.
Or if it’s too big to email, upload it to Dropbox or something like that and send me a link.

—Jens

Jens Alfke

unread,
Aug 26, 2016, 5:29:07 PM8/26/16
to Couchbase Mobile
The CouchbaseLite.framework you're linking to has the path "Build/Products/Debug-iphoneos/CouchbaseLite.framework". This is a build for iOS devices, not the simulator. That's why you're getting link errors saying that x86-64 symbols are missing: the framework you're using only has ARM code.

The framework you want is at "Build/Products/Debug-iOS-universal/CouchbaseLite.framework". This is a version that's had the ARM and x86 builds merged together into one.

I would not recommend adding Couchbase Lite as a sub-project as you're doing. Xcode tends to get really confused when multiple targets build products with the same names, and you can randomly get the wrong one; this may have happened to you.

—Jens
Reply all
Reply to author
Forward
0 new messages