ForestDB: Linker errors after adding libCBLForestDBStorage.a

80 views
Skip to first unread message

Ibrahim

unread,
Jul 4, 2015, 11:32:16 PM7/4/15
to mobile-c...@googlegroups.com
I'm trying to use ForestDB in my iOS project, but got lots of linker errors after adding `libCBLForestDBStorage.a`, i tried separate project and it compiled well, but don't know what could be the reason of those errors

```

duplicate symbol _register_unicodesn_tokenizer in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/Pods/couchbase-lite-ios/CouchbaseLite.framework/CouchbaseLite(sqlite3_unicodesn_tokenizer.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(sqlite3_unicodesn_tokenizer.o)

duplicate symbol _sqlite3Fts3UnicodeSnTokenizer in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/Pods/couchbase-lite-ios/CouchbaseLite.framework/CouchbaseLite(fts3_unicodesn.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(fts3_unicodesn.o)

duplicate symbol _english_UTF_8_stem in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/Pods/couchbase-lite-ios/CouchbaseLite.framework/CouchbaseLite(stem_UTF_8_english.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(stem_UTF_8_english.o)

duplicate symbol _english_UTF_8_create_env in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/Pods/couchbase-lite-ios/CouchbaseLite.framework/CouchbaseLite(stem_UTF_8_english.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(stem_UTF_8_english.o)

duplicate symbol _english_UTF_8_close_env in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/Pods/couchbase-lite-ios/CouchbaseLite.framework/CouchbaseLite(stem_UTF_8_english.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(stem_UTF_8_english.o)

duplicate symbol _create_s in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/Pods/couchbase-lite-ios/CouchbaseLite.framework/CouchbaseLite(utilities_sq3.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(utilities_sq3.o)

duplicate symbol _lose_s in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/Pods/couchbase-lite-ios/CouchbaseLite.framework/CouchbaseLite(utilities_sq3.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(utilities_sq3.o)

duplicate symbol _skip_utf8 in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/Pods/couchbase-lite-ios/CouchbaseLite.framework/CouchbaseLite(utilities_sq3.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(utilities_sq3.o)

duplicate symbol _in_grouping_U in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/Pods/couchbase-lite-ios/CouchbaseLite.framework/CouchbaseLite(utilities_sq3.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(utilities_sq3.o)

duplicate symbol _in_grouping_b_U in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/Pods/couchbase-lite-ios/CouchbaseLite.framework/CouchbaseLite(utilities_sq3.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(utilities_sq3.o)

duplicate symbol _out_grouping_U in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/Pods/couchbase-lite-ios/CouchbaseLite.framework/CouchbaseLite(utilities_sq3.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(utilities_sq3.o)

duplicate symbol _out_grouping_b_U in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/Pods/couchbase-lite-ios/CouchbaseLite.framework/CouchbaseLite(utilities_sq3.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(utilities_sq3.o)

duplicate symbol _eq_s in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/Pods/couchbase-lite-ios/CouchbaseLite.framework/CouchbaseLite(utilities_sq3.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(utilities_sq3.o)

duplicate symbol _eq_s_b in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/Pods/couchbase-lite-ios/CouchbaseLite.framework/CouchbaseLite(utilities_sq3.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(utilities_sq3.o)

duplicate symbol _find_among in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/Pods/couchbase-lite-ios/CouchbaseLite.framework/CouchbaseLite(utilities_sq3.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(utilities_sq3.o)

duplicate symbol _find_among_b in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/Pods/couchbase-lite-ios/CouchbaseLite.framework/CouchbaseLite(utilities_sq3.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(utilities_sq3.o)

duplicate symbol _replace_s in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/Pods/couchbase-lite-ios/CouchbaseLite.framework/CouchbaseLite(utilities_sq3.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(utilities_sq3.o)

duplicate symbol _slice_from_s in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/Pods/couchbase-lite-ios/CouchbaseLite.framework/CouchbaseLite(utilities_sq3.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(utilities_sq3.o)

duplicate symbol _slice_del in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/Pods/couchbase-lite-ios/CouchbaseLite.framework/CouchbaseLite(utilities_sq3.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(utilities_sq3.o)

duplicate symbol _insert_s in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/Pods/couchbase-lite-ios/CouchbaseLite.framework/CouchbaseLite(utilities_sq3.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(utilities_sq3.o)

duplicate symbol _sqlite3FtsUnicodeIsalnum in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/Pods/couchbase-lite-ios/CouchbaseLite.framework/CouchbaseLite(fts3_unicode2.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(fts3_unicode2.o)

duplicate symbol _sqlite3FtsUnicodeIsdiacritic in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/Pods/couchbase-lite-ios/CouchbaseLite.framework/CouchbaseLite(fts3_unicode2.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(fts3_unicode2.o)

duplicate symbol _sqlite3FtsUnicodeFold in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/Pods/couchbase-lite-ios/CouchbaseLite.framework/CouchbaseLite(fts3_unicode2.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(fts3_unicode2.o)

duplicate symbol _SN_create_env in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/Pods/couchbase-lite-ios/CouchbaseLite.framework/CouchbaseLite(api_sq3.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(api_sq3.o)

duplicate symbol _SN_close_env in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/Pods/couchbase-lite-ios/CouchbaseLite.framework/CouchbaseLite(api_sq3.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(api_sq3.o)

duplicate symbol _SN_set_current in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/Pods/couchbase-lite-ios/CouchbaseLite.framework/CouchbaseLite(api_sq3.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(api_sq3.o)

duplicate symbol __ZN8forestdb10CollatablelsEP11objc_object in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(Collatable-7E85D3B7FDB87C65.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(Collatable.o)

duplicate symbol __ZN8forestdb16CollatableReader12readNSStringEv in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(Collatable-7E85D3B7FDB87C65.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(Collatable.o)

duplicate symbol __ZN8forestdb16CollatableReader12readNSObjectEv in:

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(Collatable-7E85D3B7FDB87C65.o)

    /Users/ahmedibrahim/Documents/Phonidex/Phonidex/libCBLForestDBStorage.a(Collatable.o)

ld: 134 duplicate symbols for architecture armv7

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

```

Jens Alfke

unread,
Jul 4, 2015, 11:35:59 PM7/4/15
to mobile-c...@googlegroups.com

On Jul 4, 2015, at 7:24 PM, Ibrahim <a...@phonidex.com> wrote:

I'm trying to use ForestDB in my iOS project, but got lots of linker errors after adding `libCBLForestDBStorage.a`, i tried separate project and it compiled well, but don't know what could be the reason of those errors

It looks like you’ve added libCBLForestDBStorage.a twice and you’re getting duplicate-symbol errors for every symbol contained in it. Check your target’s linked library list (in the target settings’ Build Phases tab.)

—Jens

Ibrahim

unread,
Jul 5, 2015, 12:26:19 AM7/5/15
to mobile-c...@googlegroups.com
It appears only once

Jens Alfke

unread,
Jul 5, 2015, 1:47:44 AM7/5/15
to mobile-c...@googlegroups.com
Some of the symbols you're getting duplicates of were moved from CouchbaseLite.framework into the ForestDB storage library in 1.1, so my next guess is that your framework isn't 1.1. Looks like you're getting it from CocoaPods, so check the version and pod spec you've configured.

Also, you can use the "nm" tool to dump the list of symbols defined in a binary, which can help track down these sorts of problems.

—Jens 
--
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-couchba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/c4c2742d-769f-49ef-adae-5fdb24cbbf3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ibrahim

unread,
Jul 6, 2015, 7:43:10 AM7/6/15
to mobile-c...@googlegroups.com
I'm using the pod of version 1.1, even i tried the framework without cocoapods (copy it to the project) but still getting the same errors. When i tried `nm CouchbaseLite` and `nm libCBLForestDBStorage.a`, this is part of what i found, i'm not sure if this should cause those errors

```
CouchbaseLite(api_sq3.o):
0000000000001090 s EH_frame0
00000000000001b0 T _SN_close_env
0000000000000000 T _SN_create_env
0000000000000230 T _SN_set_current
                 U _create_s
                 U _lose_s
                 U _memset
                 U _replace_s
                 U _sqlite3_free
                 U _sqlite3_malloc
```

```
libCBLForestDBStorage.a(api_sq3.o):
0000000000001090 s EH_frame0
00000000000001b0 T _SN_close_env
0000000000000000 T _SN_create_env
0000000000000230 T _SN_set_current
                 U _create_s
                 U _lose_s
                 U _memset
                 U _replace_s
                 U _sqlite3_free
                 U _sqlite3_malloc
```


```
CouchbaseLite(sqlite3_unicodesn_tokenizer.o):
0000000000000a08 s EH_frame0
0000000000000841 s L_.str
000000000000085d s L_.str1
0000000000000000 T _register_unicodesn_tokenizer
                 U _sqlite3Fts3UnicodeSnTokenizer
                 U _sqlite3_bind_blob
                 U _sqlite3_bind_text
                 U _sqlite3_finalize
                 U _sqlite3_prepare_v2
                 U _sqlite3_step
```

```
libCBLForestDBStorage.a(sqlite3_unicodesn_tokenizer.o):
0000000000000a08 s EH_frame0
0000000000000841 s L_.str
000000000000085d s L_.str1
0000000000000000 T _register_unicodesn_tokenizer
                 U _sqlite3Fts3UnicodeSnTokenizer
                 U _sqlite3_bind_blob
                 U _sqlite3_bind_text
                 U _sqlite3_finalize
                 U _sqlite3_prepare_v2
                 U _sqlite3_step
```

The entire result of nm is attached
libCBLForestDBStorage.txt
CouchbaseLite.txt

Jens Alfke

unread,
Jul 6, 2015, 12:25:09 PM7/6/15
to mobile-c...@googlegroups.com

On Jul 6, 2015, at 4:43 AM, Ibrahim <a...@phonidex.com> wrote:

this is part of what i found, i'm not sure if this should cause those errors

That output looks correct. You’ll need to read through the man page of ‘nm’ to understand the output. The initial letter shows the type of the symbol/reference — “U” means an external (undefined) reference, i.e. a symbol imported from another library. Symbols with definitions, i.e. function implementations, are usually “T” or “t”.

Look specifically for the symbols that are mentioned in the linker errors as being duplicates.

—Jens

Ibrahim

unread,
Jul 21, 2015, 10:02:28 AM7/21/15
to mobile-c...@googlegroups.com
I managed to get it working by removing the `-all_load` flag from the Pods xcconfig files (Pods.debug.xcconfig, Pods.release.xcconfig).
Reply all
Reply to author
Forward
0 new messages