Phew! I finally got both my app using SQLCipher and CBL using it from the
same shared libsqcipher.dylib.
In the end this is everything I did:
In SQLCipher's Xcode project on the sqlcipher target:
1. Change Mach-O Type to "Dynamic Library"
2. Set Dynamic Library Install Name to "@rpath/libsqlcipher.dylib"
3. Set Dynamic Library Install Name Base to "@rpath"
4. Change Executable Extension to "dylib"
5. Build project
In Couchbase Lite's CBL Mac target:
1. Delete reference to libsqlite.dylib in the Link Binary with Libraries
Build Phase
2. Create an sqlcipher folder within the vendors folder
3. Copy the libsqlcipher.dylib file from the SQLCipher's build folder
into the sqcipher folder in CBL.
4. Copy the sqlite3.h file into the same folder.
5. Add the following to the Other C Flags setting:
-DSQLITE_HAS_CODEC -DSQLITE_ENABLE_FTS3=1
-DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4_UNICODE61
Now, not all of those may be required, but that's just what I have
always had in my project, so I stuck it there.
6. Add the libsqlcipher.dylib to the Link Binary with Libraries Build
Phase.
7. Clean and build the CBL Listener target (or just the CBL Mac target
if that's all you need).
In your Mac app's target:
1. Copy the CouchbaseLite.framework and CouchbaseLiteListener.framework
to my app's Xcode project.
2. Create an sqlcipher folder in my app's project and copy the
libsqlcipher.dylib and sqlite3.h file into it.
3. Add libsqlcipher.dylib to the Copy Frameworks Build Phase.
4. Since I'm using cocoa pods to import FMDB in my app, you need to add
this to your Podfile:
post_install do |installer_representation|
installer_representation.pods_project.targets.each do |target|
if target.name == 'FMDB'
target.build_configurations.each do |config|
config.build_settings['OTHER_CFLAGS'] ||= ['$(inherited)']
config.build_settings['OTHER_CFLAGS'] << '-DSQLITE_HAS_CODEC
-DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS3_PARENTHESIS
-DSQLITE_ENABLE_FTS4_UNICODE61'
end
end
end
end
5. Build and run your app.
Hopefully I didn't miss anything and that this helps someone else get this
working without too much trouble.
Thanks Jens for all your help!
Brendan
On Monday, October 5, 2015 at 3:06:24 PM UTC-6, Jens Alfke wrote:
>
>
> On Oct 5, 2015, at 1:44 PM, Brendan Duddridge <[email protected]
> <javascript:>> wrote:
>
> One of the differences I see in your copy of FMDB is you reference sqlite
> via #import <sqlite3.h> rather than the cocoa pod's version of #import
> "sqlite3.h". Quotes instead of angled brackets. But I'm not entirely sure
> if that makes a difference.
>
>
> It’s only a compile-time difference; wouldn’t affect what happens during
> linking or loading. The angle-bracket include just means to look for the
> header file in the system include paths first.
>
> —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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/mobile-couchbase/4b6b4a3e-7203-4f8e-81e9-a49a71913fd6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.