Duplicate symbol using CocoaAsyncSocket

310 views
Skip to first unread message

wbi...@attic.nl

unread,
Dec 31, 2013, 2:14:54 PM12/31/13
to mobile-c...@googlegroups.com
I want to use the 'CocoaAsyncSocket' library in my Couchbase Lite application and I'm getting duplicate symbol errors like 
duplicate symbol _OBJC_IVAR_$_GCDAsyncSocketPreBuffer.preBufferSize. 
I assume this is because Couchbase uses this library as well. 

What's the best way to fix this ?

Jens Alfke

unread,
Dec 31, 2013, 9:47:31 PM12/31/13
to mobile-c...@googlegroups.com

On Dec 31, 2013, at 11:14 AM, wbi...@attic.nl wrote:

I want to use the 'CocoaAsyncSocket' library in my Couchbase Lite application and I'm getting duplicate symbol errors like 
duplicate symbol _OBJC_IVAR_$_GCDAsyncSocketPreBuffer.preBufferSize. 
I assume this is because Couchbase uses this library as well. 

Yes. This causes trouble because Obj-C classes live in a global namespace and there’s no way to hide them.

Your best options, I think, are:
(a) Link against Couchbase Lite but not CocoaAsyncSocket. You’ll still get the GCDAsyncSocket class from Couchbase Lite. You’ll still need the headers around so you can #import them, though.
(b) Or, build CouchbaseLite.framework yourself and remove the GCDAsyncSocket class from the ‘iOS Library’ target.

—Jens

wbi...@attic.nl

unread,
Jan 1, 2014, 4:33:21 AM1/1/14
to mobile-c...@googlegroups.com

Op woensdag 1 januari 2014 03:47:31 UTC+1 schreef Jens Alfke:
(a) Link against Couchbase Lite but not CocoaAsyncSocket. You’ll still get the GCDAsyncSocket class from Couchbase Lite. You’ll still need the headers around so you can #import them, though.

Now I get a undefined symbol for the class I use in my code. 
I'm including Couchbase using CocoaPods - is that relevant ?

Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_AsyncUdpSocket", referenced from:
      objc-class-ref in Logger.o
ld: symbol(s) not found for architecture armv7
 

Jens Alfke

unread,
Jan 1, 2014, 5:00:19 PM1/1/14
to mobile-c...@googlegroups.com

On Jan 1, 2014, at 1:33 AM, wbi...@attic.nl wrote:

Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_AsyncUdpSocket", referenced from:
      objc-class-ref in Logger.o

Couchbase Lite doesn’t use/contain that class, only GCDAsyncSocket. I think you’ll need to go to plan (b).

—Jens

wbi...@attic.nl

unread,
Jan 2, 2014, 4:54:23 AM1/2/14
to mobile-c...@googlegroups.com
I tried both AsyncSocket and GCDAsyncSocket - sorry for the confusion.

I have got it working now by only adding GCDAsyncUdpSocket.m, figuring CouchDb probably doesn't use UDP ! 
Smart huh ?

Thanks for all your fast replies btw.

Willem

Op woensdag 1 januari 2014 23:00:19 UTC+1 schreef Jens Alfke:

wbi...@attic.nl

unread,
Jan 2, 2014, 5:01:38 AM1/2/14
to mobile-c...@googlegroups.com
"I tried both AsyncSocket and GCDAsyncSocket - sorry for the confusion."
that should be ...UdpSocket.
I realize now that I should have mentioned right away that I was using the Udp classes.

Op donderdag 2 januari 2014 10:54:23 UTC+1 schreef wbi...@attic.nl:
Reply all
Reply to author
Forward
0 new messages