Building couchbase-lite-core on iOS

@borrrden

I’m trying to build couchbase-lite-core for all platforms: Mac, Windows, iOS and Android.

My first build attempt command line based, using the build_cmake/scripts/build_ios_fat.sh script. It was successful and I had no pain.

Now that I have built a basic mockup I want to test the portability of the app and lib through all the other systems.

My nest step is iOS but so far no joy! :frowning:

Using the build_cmake/scripts/build_ios_fat.sh script, it builds successfully and the resulting file is libLiteCore.dylib but that’s it, the other dependencies libs are not compiled (FleeceStatic, -lSQLite3_UnicodeSN, BLIPStatic, CivetWeb) and therefore it is not useful at all.

Then you pointed me that scripts are just for reference and I should be looking at Readme so as in the Readme:

  • Select the scheme LiteCore static or LiteCore dylib .
  • Choose Product>Build (for a debug build) or Product>Build For>Profiling (for a release/optimized build).

Besides I can’t find the scheme LiteCore static in the list, the build process fails.

So tried to checkout a stable release such as CBL2.1.3 but it stills fail to build.

Do you have an idea of what possibly could go wrong?

Thank you very much,

With my best regards,

Nuno Santos

Actually this is not possible. You can’t have LiteCore dylib without these, they are just not separate. They are all statically compiled into LiteCore.

Not without showing the actual error. I don’t know why LiteCore static is missing but I never use that target directly from the Xcode project. For iOS you should build LiteCore framework actually. LiteCore dylib will work just fine but then get rejected from the app store.

@borrrden thanks for your reply.

I have this:

git checkout CBL2.1.3
git submodule update --init --recursive

and I was able to build LiteCore.framework successfully.

Should I link with the framework or all the resulting libs separately?

Thanks,

Best regards,

Nuno

Link with the framework just as you would any other framework, but it might not contain any headers so be careful (this target was actually designed for .NET which uses runtime symbol location in place of header files).

Linking with the LiteCore.framework alone results in a lot of undefined symbols. So, I’m trying to add all .a libs. But still… can’t sucessfully link, it is complaining about not finding -lactors but it is there. I’m referencing them from the Products build dir. :frowning:

ld: library not found for -lactors
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I was finally able to link with it. I worked around the last issue and it is now building.

Thanks for your help!

Best regards,

Nuno

You shouldn’t be linking with both. You are going to end up with a lot of hair pulling undefined behavior that way. What are some examples of the undefined symbols. Perhaps you are trying to use API that is not exposed publicly in the framework in which case double dragons for you.