Using Couchbase Lite library on Ubuntu 18.04

Hi,
We facing with difficult problem when develop application on IOT device(ARM64 architecture) that run Ubuntu 18.04(We can not update to 20.04 because it have too many issue).
I known that requirement for platform is 20.04 but i would like to ask for method build library on 18.04 or this is impossible?

What is “method build library” ? If you are asking whether it is possible to build for Ubuntu 18.04 then the answer is most likely yes (if the compiler is too old you will need to build a newer one though). We just are not planning on doing it officially at the time.

yes, i mean that i want to couchbase lite library for ubuntu 18.04 + arm64 platform. Could you please share to me or guide me for building?

I imagine the instructions won’t be much different than the existing cross compile instructions.

I try to build follow your shared link but error happen.
Run Build Command:"/usr/bin/make" “cmTC_43f86/fast”
/usr/bin/make -f CMakeFiles/cmTC_43f86.dir/build.make CMakeFiles/cmTC_43f86.dir/build
make[1]: Entering directory ‘/home/thang/Projects/SmartParking/LibraryForCouchbase/buildCmake/CMakeFiles/CMakeTmp’
Building C object CMakeFiles/cmTC_43f86.dir/CheckIncludeFile.c.o
/usr/bin/aarch64-linux-gnu-gcc --sysroot=/home/thang/Projects/SmartParking/LibraryForCouchbase/couchbase-lite-C -fPIE -o CMakeFiles/cmTC_43f86.dir/CheckIncludeFile.c.o -c /home/thang/Projects/SmartParking/LibraryForCouchbase/buildCmake/CMakeFiles/CMakeTmp/CheckIncludeFile.c
/home/thang/Projects/SmartParking/LibraryForCouchbase/buildCmake/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: direct.h: No such file or directory
#include <direct.h>
^~~~~~~~~~
compilation terminated.
CMakeFiles/cmTC_43f86.dir/build.make:65: recipe for target ‘CMakeFiles/cmTC_43f86.dir/CheckIncludeFile.c.o’ failed
make[1]: *** [CMakeFiles/cmTC_43f86.dir/CheckIncludeFile.c.o] Error 1
make[1]: Leaving directory ‘/home/thang/Projects/SmartParking/LibraryForCouchbase/buildCmake/CMakeFiles/CMakeTmp’
Makefile:126: recipe for target ‘cmTC_43f86/fast’ failed
make: *** [cmTC_43f86/fast] Error 2

Do you know reason for this error?

I would like share my toolchain file as below:
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm64)

set(CMAKE_SYSROOT /home/thang/Projects/SmartParking/LibraryForCouchbase/couchbase-lite-C)

set(tools /usr)
set(CMAKE_C_COMPILER ${tools}/bin/aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER ${tools}/bin/aarch64-linux-gnu-g++)

That error doesn’t look related to a build failure. It looks like the output of CMake logs while searching to see if a direct.h header is available to create defines.

yes, It is CMakeError.log output.
All log build as below:
thang@thang-G3-3579:~/Projects/SmartParking/LibraryForCouchbase/buildCmake$ cmake -DCMAKE_TOOLCHAIN_FILE=/home/thang/Projects/SmartParking/LibraryForCouchbase/buildCmake/Makefile.cmake /home/thang/Projects/SmartParking/LibraryForCouchbase/couchbase-lite-C/vendor/couchbase-lite-core
– The C compiler identification is GNU 7.5.0
– The CXX compiler identification is GNU 7.5.0
– Check for working C compiler: /usr/bin/arm-linux-gnueabihf-gcc
– Check for working C compiler: /usr/bin/arm-linux-gnueabihf-gcc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Detecting C compile features
– Detecting C compile features - done
– Check for working CXX compiler: /usr/bin/arm-linux-gnueabihf-g++
– Check for working CXX compiler: /usr/bin/arm-linux-gnueabihf-g++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
– Looking for pthread.h
– Looking for pthread.h - found
– Looking for pthread_create
– Looking for pthread_create - not found
– Check if compiler accepts -pthread
– Check if compiler accepts -pthread - yes
– Found Threads: TRUE
– Looking for pthread_getname_np in pthread
– Looking for pthread_getname_np in pthread - found
– Looking for pthread_threadid_np in pthread
– Looking for pthread_threadid_np in pthread - not found
– Looking for sys/prctl.h
– Looking for sys/prctl.h - found
– Looking for prctl
– Looking for prctl - found
– Looking for sys/syscall.h
– Looking for sys/syscall.h - found
– Looking for SYS_gettid
– Looking for SYS_gettid - found
– Looking for linux/unistd.h
– Looking for linux/unistd.h - found
– Looking for __NR_gettid
– Looking for __NR_gettid - found
CMake Error at cmake/platform_linux_desktop.cmake:19 (message):
icuuc not found
Call Stack (most recent call first):
CMakeLists.txt:125 (setup_globals)

– Configuring incomplete, errors occurred!
See also “/home/thang/Projects/SmartParking/LibraryForCouchbase/buildCmake/CMakeFiles/CMakeOutput.log”.
See also “/home/thang/Projects/SmartParking/LibraryForCouchbase/buildCmake/CMakeFiles/CMakeError.log”.
thang@thang-G3-3579:~/Projects/SmartParking/LibraryForCouchbase/buildCmake$ make cblite
make: *** No rule to make target ‘cblite’. Stop.

The error says you are missing the ICU development libraries inside of your sysroot. This was indicated as a dependency in the instructions I sent.

How can I get ICU development libraries and ZLIB development libraries?

The technique I use is running the target system on either an emulator or a device, using the OS package manager to install the correct packages, and then copying out the relevant underlying system libraries (i.e. making a sysroot). This is an essential part of creating a cross compilation toolchain. It’s not an easy process and you likely need to do a lot of tweaking but the repo wiki for C has some of my notes.

2 Likes

Thank you for your support.