couchbase / couchbase-lite-c Goto Github PK
View Code? Open in Web Editor NEWC language bindings for the Couchbase Lite embedded NoSQL database engine
License: Apache License 2.0
C language bindings for the Couchbase Lite embedded NoSQL database engine
License: Apache License 2.0
When I put the replicator in suspended state I get an activity level with value 5, which is not documented. I'm using an enum in Dart so it's an easy fix, I just tought to let you guys know that it's missing.
I know Android and iOS don't have the setSuspended method, so probably that's why.
I started to build on Debian stretch but with no luck. How can I solve this problem?
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- 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/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for direct.h
-- Looking for direct.h - not found
-- Looking for vasprintf
-- Looking for vasprintf - found
Found ICU libs at /usr/lib/x86_64-linux-gnu/libicuuc.so;/usr/lib/x86_64-linux-gnu/libicui18n.so;/usr/lib/x86_64-linux-gnu/libicudata.so
Using libicu header files in /usr/include
Found libz at /usr/lib/x86_64-linux-gnu/libz.so
Using libz header files in /usr/include
-- Found PythonInterp: /usr/bin/python (found version "2.7.16")
-- Found Perl: /usr/bin/perl (found version "5.28.1")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
CMake Warning (dev) at vendor/couchbase-lite-core/vendor/mbedtls/programs/ssl/CMakeLists.txt:37 (target_sources):
Policy CMP0076 is not set: target_sources() command converts relative paths
to absolute. Run "cmake --help-policy CMP0076" for policy details. Use
the cmake_policy command to set the policy and suppress this warning.
An interface source of target "ssl_client2" has a relative path.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at vendor/couchbase-lite-core/vendor/mbedtls/programs/ssl/CMakeLists.txt:44 (target_sources):
Policy CMP0076 is not set: target_sources() command converts relative paths
to absolute. Run "cmake --help-policy CMP0076" for policy details. Use
the cmake_policy command to set the policy and suppress this warning.
An interface source of target "ssl_server2" has a relative path.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at vendor/couchbase-lite-core/vendor/mbedtls/programs/test/CMakeLists.txt:31 (target_sources):
Policy CMP0076 is not set: target_sources() command converts relative paths
to absolute. Run "cmake --help-policy CMP0076" for policy details. Use
the cmake_policy command to set the policy and suppress this warning.
An interface source of target "query_compile_time_config" has a relative
path.
This warning is for project developers. Use -Wno-dev to suppress it.
get_repo_version.sh: Updated /root/couchbase-lite-C/build_cmake/generated_headers/repo_version.h
Link-time optimization enabled
-- Configuring done
-- Generating done
-- Build files have been written to: /root/couchbase-lite-C/build_cmake
Scanning dependencies of target LiteCoreWebSocket
Scanning dependencies of target BLIPStatic
Scanning dependencies of target SQLite3_UnicodeSN
Scanning dependencies of target mbedcrypto
Scanning dependencies of target Support
Scanning dependencies of target FleeceStatic
Scanning dependencies of target LiteCoreStatic
Scanning dependencies of target CouchbaseLiteCStatic
[ 0%] Building C object vendor/couchbase-lite-core/vendor/sqlite3-unicodesn/CMakeFiles/SQLite3_UnicodeSN.dir/libstemmer_c/src_c/stem_ISO_8859_1_danish.c.o
[ 0%] Building CXX object vendor/couchbase-lite-core/vendor/BLIP-Cpp/CMakeFiles/BLIPStatic.dir/src/blip/Message.cc.o
[ 0%] Building C object vendor/couchbase-lite-core/vendor/sqlite3-unicodesn/CMakeFiles/SQLite3_UnicodeSN.dir/libstemmer_c/src_c/stem_ISO_8859_1_dutch.c.o
[ 0%] Building CXX object vendor/couchbase-lite-core/vendor/BLIP-Cpp/CMakeFiles/BLIPStatic.dir/src/blip/BLIPConnection.cc.o
[ 0%] Building C object vendor/couchbase-lite-core/vendor/sqlite3-unicodesn/CMakeFiles/SQLite3_UnicodeSN.dir/libstemmer_c/src_c/stem_ISO_8859_1_french.c.o
[ 2%] Building C object vendor/couchbase-lite-core/vendor/sqlite3-unicodesn/CMakeFiles/SQLite3_UnicodeSN.dir/libstemmer_c/src_c/stem_ISO_8859_1_english.c.o
[ 2%] Building CXX object vendor/couchbase-lite-core/vendor/BLIP-Cpp/CMakeFiles/BLIPStatic.dir/src/blip/MessageOut.cc.o
[ 2%] Building C object vendor/couchbase-lite-core/vendor/sqlite3-unicodesn/CMakeFiles/SQLite3_UnicodeSN.dir/libstemmer_c/src_c/stem_ISO_8859_1_finnish.c.o
[ 2%] Building CXX object vendor/couchbase-lite-core/vendor/BLIP-Cpp/CMakeFiles/BLIPStatic.dir/src/blip/MessageBuilder.cc.o
[ 2%] Building CXX object vendor/couchbase-lite-core/vendor/BLIP-Cpp/CMakeFiles/BLIPStatic.dir/src/util/Actor.cc.o
[ 2%] Building C object vendor/couchbase-lite-core/vendor/sqlite3-unicodesn/CMakeFiles/SQLite3_UnicodeSN.dir/libstemmer_c/src_c/stem_ISO_8859_1_german.c.o
[ 2%] Building CXX object vendor/couchbase-lite-core/CMakeFiles/Support.dir/LiteCore/Support/c4ExceptionUtils.cc.o
[ 2%] Building CXX object vendor/couchbase-lite-core/vendor/fleece/CMakeFiles/FleeceStatic.dir/Fleece/API_Impl/Fleece.cc.o
[ 2%] Building CXX object CMakeFiles/CouchbaseLiteCStatic.dir/src/CBLBase.cc.o
[ 2%] Building C object vendor/couchbase-lite-core/vendor/mbedtls/crypto/library/CMakeFiles/mbedcrypto.dir/aes.c.o
[ 2%] Building CXX object vendor/couchbase-lite-core/CMakeFiles/LiteCoreWebSocket.dir/Crypto/Certificate.cc.o
[ 2%] Building CXX object vendor/couchbase-lite-core/vendor/BLIP-Cpp/CMakeFiles/BLIPStatic.dir/src/util/ActorProperty.cc.o
[ 2%] Building C object vendor/couchbase-lite-core/vendor/sqlite3-unicodesn/CMakeFiles/SQLite3_UnicodeSN.dir/libstemmer_c/src_c/stem_ISO_8859_1_hungarian.c.o
[ 2%] Building CXX object vendor/couchbase-lite-core/CMakeFiles/LiteCoreWebSocket.dir/Crypto/mbedUtils.cc.o
[ 2%] Building CXX object vendor/couchbase-lite-core/CMakeFiles/LiteCoreWebSocket.dir/Crypto/PublicKey.cc.o
[ 2%] Building C object vendor/couchbase-lite-core/vendor/sqlite3-unicodesn/CMakeFiles/SQLite3_UnicodeSN.dir/libstemmer_c/src_c/stem_ISO_8859_1_italian.c.o
[ 2%] Building CXX object vendor/couchbase-lite-core/CMakeFiles/LiteCoreStatic.dir/C/c4Base.cc.o
[ 2%] Building C object vendor/couchbase-lite-core/vendor/mbedtls/crypto/library/CMakeFiles/mbedcrypto.dir/aesni.c.o
/root/couchbase-lite-C/vendor/couchbase-lite-core/Crypto/Certificate.cc: In constructor 'litecore::crypto::SubjectAltNames::SubjectAltNames(mbedtls_x509_sequence*)':
/root/couchbase-lite-C/vendor/couchbase-lite-core/Crypto/Certificate.cc:130:9: error: 'reverse' was not declared in this scope
reverse(begin(), end()); // subject_alt_names list is in reverse order!
^~~~~~~
I was trying out the Nim bindings and tested the query SELECT * FROM nimtest
where nimtest
was the name of the database. This didn't work, but instead of raising an error it SIGABRT on free(): invalid pointer
. This is the backtrace from GDB:
Program received signal SIGABRT, Aborted.
0x00007ffff7cae355 in raise () from /usr/lib/libc.so.6
(gdb) bt
#0 0x00007ffff7cae355 in raise () from /usr/lib/libc.so.6
#1 0x00007ffff7c97853 in abort () from /usr/lib/libc.so.6
#2 0x00007ffff7cf1878 in __libc_message () from /usr/lib/libc.so.6
#3 0x00007ffff7cf8d3a in malloc_printerr () from /usr/lib/libc.so.6
#4 0x00007ffff7cf9ef4 in _int_free () from /usr/lib/libc.so.6
#5 0x00007ffff78aa19e in std::default_delete<fleece::impl::Dict::key>::operator() (this=0x7fffffffcde8, __ptr=0x7fffffffd039) at /usr/include/c++/10.1.0/bits/unique_ptr.h:78
#6 std::default_delete<fleece::impl::Dict::key>::operator() (__ptr=0x7fffffffd039, this=0x7fffffffcde8) at /usr/include/c++/10.1.0/bits/unique_ptr.h:78
#7 std::unique_ptr<fleece::impl::Dict::key, std::default_delete<fleece::impl::Dict::key> >::~unique_ptr (this=0x7fffffffcde8, __in_chrg=<optimized out>) at /usr/include/c++/10.1.0/bits/unique_ptr.h:360
#8 fleece::impl::Path::Element::~Element (this=0x7fffffffcdd8, __in_chrg=<optimized out>) at /home/peter/Projects/couchbase-lite-C/vendor/couchbase-lite-core/vendor/fleece/Fleece/Core/Path.hh:98
#9 fleece::smallVector<fleece::impl::Path::Element, 4ul>::erase (last=0x7fffffffcdf8, first=0x7fffffffcdd8, this=0x7fffffffcdd0) at /home/peter/Projects/couchbase-lite-C/vendor/couchbase-lite-core/vendor/fleece/Fleece/Support/SmallVector.hh:112
#10 fleece::impl::Path::drop (this=this@entry=0x7fffffffcdd0, startAt=startAt@entry=1) at /home/peter/Projects/couchbase-lite-C/vendor/couchbase-lite-core/vendor/fleece/Fleece/Core/Path.cc:61
#11 0x00007ffff79dbddc in litecore::QueryParser::writePropertyGetter (this=0x7fffffffd5c0, fn=..., property=..., param=0x0) at /home/peter/Projects/couchbase-lite-C/vendor/couchbase-lite-core/LiteCore/Query/QueryParser.cc:1298
#12 0x00007ffff79dc73f in litecore::QueryParser::propertyOp (this=0x7fffffffd5c0, op=..., operands=...) at /home/peter/Projects/couchbase-lite-C/vendor/couchbase-lite-core/LiteCore/Query/QueryParser.cc:963
#13 0x00007ffff79da164 in litecore::QueryParser::handleOperation (this=this@entry=0x7fffffffd5c0, op=<optimized out>, op@entry=0x7ffff7bb7080 <litecore::QueryParser::kOperationList>, actualOperator=..., operands=...) at /home/peter/Projects/couchbase-lite-C/vendor/couchbase-lite-core/LiteCore/Query/QueryParser.cc:634
#14 0x00007ffff79da312 in litecore::QueryParser::parseOpNode (this=0x7fffffffd5c0, node=<optimized out>) at /home/peter/Projects/couchbase-lite-C/vendor/couchbase-lite-core/LiteCore/Query/QueryParser.cc:619
#15 0x00007ffff79de987 in litecore::QueryParser::resultOp (this=0x7fffffffd5c0, op=..., operands=...) at /home/peter/Projects/couchbase-lite-C/vendor/couchbase-lite-core/LiteCore/Query/QueryParser.cc:746
#16 0x00007ffff79da164 in litecore::QueryParser::handleOperation (this=this@entry=0x7fffffffd5c0, op=<optimized out>, op@entry=0x7ffff7bb6fc0 <litecore::QueryParser::kResultListOperation>, actualOperator=..., operands=...) at /home/peter/Projects/couchbase-lite-C/vendor/couchbase-lite-core/LiteCore/Query/QueryParser.cc:634
#17 0x00007ffff79dac43 in litecore::QueryParser::writeSelectListClause (this=this@entry=0x7fffffffd5c0, operands=operands@entry=0x5555555e328e, key=..., sql=0x7fffffffd1e0 "\214\062^UUU", sql@entry=0x7ffff7b0b55e "", aggregatesOK=aggregatesOK@entry=true) at /home/peter/Projects/couchbase-lite-C/vendor/couchbase-lite-core/LiteCore/Query/QueryParser.cc:335
#18 0x00007ffff79e091f in litecore::QueryParser::writeSelect (this=0x7fffffffd5c0, where=0x0, operands=0x5555555e328e) at /home/peter/Projects/couchbase-lite-C/vendor/couchbase-lite-core/LiteCore/Query/QueryParser.cc:259
#19 0x00007ffff79e1658 in litecore::QueryParser::parse (this=0x7fffffffd5c0, expression=0x5555555e328e) at /home/peter/Projects/couchbase-lite-C/vendor/couchbase-lite-core/LiteCore/Query/QueryParser.cc:194
#20 0x00007ffff79e172d in litecore::QueryParser::parseJSON (this=0x7fffffffd5c0, expressionJSON=...) at /home/peter/Projects/couchbase-lite-C/vendor/couchbase-lite-core/vendor/fleece/Fleece/Core/Doc.hh:106
#21 0x00007ffff7a09285 in litecore::SQLiteQuery::SQLiteQuery (this=0x5555556527f0, keyStore=..., queryStr=..., language=<optimized out>) at /home/peter/Projects/couchbase-lite-C/vendor/couchbase-lite-core/vendor/fleece/API/fleece/slice.hh:458
#22 0x00007ffff7a0762e in litecore::SQLiteKeyStore::compileQuery (this=0x5555555cc390, selectorExpression=..., language=litecore::QueryLanguage::kN1QL) at /home/peter/Projects/couchbase-lite-C/vendor/couchbase-lite-core/LiteCore/Query/SQLiteQuery.cc:515
#23 0x00007ffff78ce5fa in c4Query::c4Query (queryExpression=..., language=1, db=<optimized out>, this=0x5555555e51f0) at /home/peter/Projects/couchbase-lite-C/vendor/couchbase-lite-core/vendor/fleece/API/fleece/slice.hh:273
#24 operator() (__closure=<optimized out>) at /home/peter/Projects/couchbase-lite-C/vendor/couchbase-lite-core/C/c4Query.cc:53
#25 fleece::function_ref<c4Query*()>::callback_fn<c4query_new2(C4Database*, C4QueryLanguage, C4Slice, int*, C4Error*)::<lambda()> >(intptr_t) (callable=140737488345616) at /home/peter/Projects/couchbase-lite-C/vendor/couchbase-lite-core/vendor/fleece/Fleece/Support/function_ref.hh:59
#26 0x00007ffff78cfdd9 in fleece::function_ref<c4Query* ()>::operator()() const (this=<synthetic pointer>) at /home/peter/Projects/couchbase-lite-C/vendor/couchbase-lite-core/vendor/fleece/Fleece/Support/function_ref.hh:71
#27 c4Internal::tryCatch<c4Query*>(C4Error*, fleece::function_ref<c4Query* ()>) (outError=0x7fffffffdaf4, fn=...) at /home/peter/Projects/couchbase-lite-C/vendor/couchbase-lite-core/LiteCore/Support/c4ExceptionUtils.hh:60
#28 0x00007ffff78cf404 in c4query_new2 (database=<optimized out>, language=language@entry=1, expression=..., outErrorPos=<optimized out>, outErrorPos@entry=0x7fffffffdaf0, outError=outError@entry=0x7fffffffdaf4) at /home/peter/Projects/couchbase-lite-C/vendor/couchbase-lite-core/vendor/fleece/Fleece/Support/function_ref.hh:65
#29 0x00007ffff7887ef8 in CBLQuery::createC4Query(CBLDatabase const*, unsigned int, fleece::slice, int*, C4Error*)::{lambda(c4Database*)#1}::operator()(c4Database*) const (c4db=<optimized out>, __closure=<synthetic pointer>) at /home/peter/Projects/couchbase-lite-C/vendor/couchbase-lite-core/vendor/fleece/API/fleece/slice.hh:274
#30 litecore::access_lock<c4Database*, std::recursive_mutex>::use<c4Query*, CBLQuery::createC4Query(CBLDatabase const*, unsigned int, fleece::slice, int*, C4Error*)::{lambda(c4Database*)#1}>(CBLQuery::createC4Query(CBLDatabase const*, unsigned int, fleece::slice, int*, C4Error*)::{lambda(c4Database*)#1}) const (callback=..., this=0x5555555e4ae0)
at /home/peter/Projects/couchbase-lite-C/vendor/couchbase-lite-core/LiteCore/Support/access_lock.hh:60
#31 CBLQuery::createC4Query (outError=0x7fffffffdaf4, outErrPos=0x7fffffffdaf0, queryString=..., language=1, db=0x5555555e4ad0) at /home/peter/Projects/couchbase-lite-C/src/CBLQuery_Internal.hh:59
#32 CBLQuery::CBLQuery (outError=0x7fffffffdaf4, outErrPos=0x7fffffffdaf0, queryString=..., language=1, db=0x5555555e4ad0, this=0x5555556501d0) at /home/peter/Projects/couchbase-lite-C/src/CBLQuery_Internal.hh:36
#33 CBLQuery_New_s (db=0x5555555e4ad0, language=1, queryString=..., outErrorPos=0x7fffffffdaf0, outError=0x7fffffffdaf4) at /home/peter/Projects/couchbase-lite-C/src/CBLQuery.cc:57
#34 0x0000555555571a4b in newQuery__OhCPcHLdYW3ucemgk5MuLg (db=0x7ffff7bde050, str=0x555555575ec0 <TM__zZS2NtWhkO9cJEWatgDgDNQ_13>, language=<optimized out>) at /home/peter/Projects/nim/nim/lib/system/sysstr.nim:96
#35 0x0000555555573070 in NimMainModule () at /home/peter/Projects/couchbase-lite-C/bindings/nim/src/example.nim:29
#36 0x0000555555573d9f in NimMainInner () at /home/peter/Projects/nim/nim/lib/system.nim:2149
#37 0x0000555555572ba6 in NimMain () at /home/peter/Projects/nim/nim/lib/system.nim:2157
#38 0x0000555555572bdd in main (argc=<optimized out>, args=<optimized out>, env=<optimized out>) at /home/peter/Projects/nim/nim/lib/system.nim:2164
git submodule update --recursive
fatal: reference is not a tree: 7f02f6080681587c94cf5bc3d3ec2348efc7ae25
Unable to checkout '7f02f6080681587c94cf5bc3d3ec2348efc7ae25' in submodule path 'vendor/couchbase-lite-core'
I think the submodule got rebased, and the equivalent rev would be
9ae2c4fe2e827c006d7e13c6316809e22603e54e
I want to delete a document in a database.
Here is my code.
cbl::Database db("bucket", {"/tmp", kCBLDatabase_Create});
cbl::Document doc2 = db.getDocument("foo");// previously stored document
doc2.deleteDoc();
return 0;
it throws "terminate called after throwing an instance of 'CBLError'"
HTTP authentication to SG is not working; see original thread. Looks like the Authorization:
header isn't being sent at all, even in response to a Www-Authenticate:
response.
I'm writing a wrapper library in Dart using this and Dart's ffi bindings can't lookup the CBLDocument_RevisionID
function.
I know the android and ios libraries don't expose the revision id for some reason, but it would good to have access to it.
Adding it to CBL.def makes it accessible from Dart.
Hello,
Compiling couchbase-lite-C on Windows 10 returns the following error message. According to (https://stackoverflow.com/questions/40159892/using-asprintf-on-windows), it is not built-in in all platforms.
Scanning dependencies of target CouchbaseLiteC
[ 98%] Building CXX object CMakeFiles/CouchbaseLiteC.dir/empty.cpp.obj
empty.cpp
[ 98%] Linking CXX shared library CouchbaseLiteC.dll
LINK : CouchbaseLiteC.dll not found or not built by the last incremental link; performing full link
Creating library CouchbaseLiteC.lib and object CouchbaseLiteC.exp
[ 98%] Built target CouchbaseLiteC
[ 98%] Building CXX object test/CMakeFiles/CBL_C_Tests.dir/BlobTest_Cpp.cc.obj
BlobTest_Cpp.cc
C:\Users\beave\Desktop\couchbase-lite-C\build-couchbase-lite-C-Desktop_Qt_5_12_4_MSVC2017_64bit-Default\include\cbl\cbl_config.h(19): fatal error C1083: Cannot open include file: 'asprintf.h': No such file or directory
In vendors code file :
couchbase-lite-C/vendor/couchbase-lite-core/Crypto/Certificate.cc
#include <algorithm>
is missing
In
couchbase-lite-C/vendor/couchbase-lite-core/Networking/BuiltInWebSocket.
couchbase-lite-C/vendor/couchbase-lite-core/vendor/sockpp/include/sockpp/mbedtls_context.h
#include <functional>
is missing
I have been attempting to compile and build dev branch on Windows 10 and facing some issues. Has anyone been able to successfully compile and build dev branch on Windows 10 if not then which branch compiles successfully with Windows 10?
Thanks
Asim Baig
Query change listeners (CBLQuery_AddChangeListener
, CBLQueryChangeListener
) are not yet implemented. The tricky part will be how to implement the delayed queries in a cross-platform way.
The CBLReplicator needs to retry replication if it fails with a transient error.
It also needs to mange offline support, which mostly consists of detecting if the device is offline (or the server otherwise unreachable), then immediately retrying when the device comes back online. This may not be feasible to do in a cross-platform API.
couchbase-lite-core failed to build because some files were removed from couchbase-lite-core submodule. It seems some cmake files need to be updated in couchbase-lite-core to reflect these changes.
To reproduce:
mkdir build && cd build
cmake ..
-- The C compiler identification is AppleClang 10.0.0.10001145
-- The CXX compiler identification is AppleClang 10.0.0.10001145
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- 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: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for direct.h
-- Looking for direct.h - not found
-- Looking for vasprintf
-- Looking for vasprintf - found
-- Found PythonInterp: /usr/local/bin/python (found version "2.7.15")
-- Found Perl: /usr/bin/perl (found version "5.18.2")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
get_repo_version.sh: Updated /Users/user/playground/couchbase-lite-c/couchbase-lite-C/build/generated_headers/repo_version.h
Link-time optimization enabled
-- Configuring done
CMake Error at vendor/couchbase-lite-core/CMakeLists.txt:165 (add_library):
Cannot find source file:
Replicator/CivetWebSocket.cc
Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
.hpp .hxx .in .txx
CMake Error at vendor/couchbase-lite-core/REST/CMakeLists.txt:76 (add_library):
Cannot find source file:
civetUtils.cc
Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
.hpp .hxx .in .txx
CMake Error at vendor/couchbase-lite-core/C/tests/CMakeLists.txt:45 (add_executable):
Cannot find source file:
/Users/user/playground/couchbase-lite-c/couchbase-lite-C/vendor/couchbase-lite-core/Replicator/CivetWebSocket.cc
Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
.hpp .hxx .in .txx
CMake Error at vendor/couchbase-lite-core/CMakeLists.txt:165 (add_library):
No SOURCES given to target: LiteCoreStatic
CMake Error at vendor/couchbase-lite-core/REST/CMakeLists.txt:76 (add_library):
No SOURCES given to target: LiteCoreREST_Static
CMake Error at vendor/couchbase-lite-core/REST/CMakeLists.txt:31 (add_library):
No SOURCES given to target: CivetWeb
CMake Error at vendor/couchbase-lite-core/C/tests/CMakeLists.txt:45 (add_executable):
No SOURCES given to target: C4Tests
-- Build files have been written to: /Users/user/playground/couchbase-lite-c/couchbase-lite-C/build
CBLDatabase_GetDocumentExpiration
and CBLDatabase_SetDocumentExpiration
are unimplemented.
Building on Ubuntu 19.10
Compiler: gcc (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008
Insured all submodules have been updated recursively.
I just pulled the latest code, and get a build failure:
[ 59%] Building C object vendor/couchbase-lite-core/vendor/mbedtls/library/CMakeFiles/mbedx509.dir/x509_create.c.o
In file included from /tmp/2/couchbase-lite-C/src/CBLDatabase_Internal.hh:24,
from /tmp/2/couchbase-lite-C/src/CBLBlob_Internal.hh:22,
from /tmp/2/couchbase-lite-C/src/CBLBlob.cc:19:
/tmp/2/couchbase-lite-C/src/Listener.hh: In member function ‘void cbl_internal::ListenersBase::clear()’:
/tmp/2/couchbase-lite-C/src/Listener.hh:117:30: error: ‘void CBLListenerToken::removed()’ is protected within this context
117 | tok->removed();
| ^
/tmp/2/couchbase-lite-C/src/Listener.hh:57:10: note: declared protected here
57 | void removed() {
| ^~~~~~~
In file included from /tmp/2/couchbase-lite-C/src/CBLDatabase_Internal.hh:24,
from /tmp/2/couchbase-lite-C/src/CBLDatabase.cc:19:
/tmp/2/couchbase-lite-C/src/Listener.hh: In member function ‘void cbl_internal::ListenersBase::clear()’:
/tmp/2/couchbase-lite-C/src/Listener.hh:117:30: error: ‘void CBLListenerToken::removed()’ is protected within this context
117 | tok->removed();
| ^
/tmp/2/couchbase-lite-C/src/Listener.hh:57:10: note: declared protected here
57 | void removed() {
| ^~~~~~~
[ 59%] Building CXX object CMakeFiles/CouchbaseLiteCStatic.dir/src/ConflictResolver.cc.o
In file included from /tmp/2/couchbase-lite-C/src/CBLDatabase_Internal.hh:24,
from /tmp/2/couchbase-lite-C/src/CBLQuery_Internal.hh:9,
from /tmp/2/couchbase-lite-C/src/CBLQuery.cc:20:
/tmp/2/couchbase-lite-C/src/Listener.hh: In member function ‘void cbl_internal::ListenersBase::clear()’:
/tmp/2/couchbase-lite-C/src/Listener.hh:117:30: error: ‘void CBLListenerToken::removed()’ is protected within this context
117 | tok->removed();
| ^
/tmp/2/couchbase-lite-C/src/Listener.hh:57:10: note: declared protected here
57 | void removed() {
| ^~~~~~~
In file included from /tmp/2/couchbase-lite-C/src/CBLDatabase_Internal.hh:24,
from /tmp/2/couchbase-lite-C/src/CBLDocument_Internal.hh:22,
from /tmp/2/couchbase-lite-C/src/CBLDocument.cc:21:
/tmp/2/couchbase-lite-C/src/Listener.hh: In member function ‘void cbl_internal::ListenersBase::clear()’:
/tmp/2/couchbase-lite-C/src/Listener.hh:117:30: error: ‘void CBLListenerToken::removed()’ is protected within this context
117 | tok->removed();
| ^
/tmp/2/couchbase-lite-C/src/Listener.hh:57:10: note: declared protected here
57 | void removed() {
| ^~~~~~~
In file included from /tmp/2/couchbase-lite-C/src/CBLBase.cc:21:
/tmp/2/couchbase-lite-C/src/Listener.hh: In member function ‘void cbl_internal::ListenersBase::clear()’:
/tmp/2/couchbase-lite-C/src/Listener.hh:117:30: error: ‘void CBLListenerToken::removed()’ is protected within this context
117 | tok->removed();
| ^
/tmp/2/couchbase-lite-C/src/Listener.hh:57:10: note: declared protected here
57 | void removed() {
| ^~~~~~~
[ 62%] Building C object vendor/couchbase-lite-core/vendor/mbedtls/library/CMakeFiles/mbedx509.dir/x509_crl.c.o
make[2]: *** [CMakeFiles/CouchbaseLiteCStatic.dir/build.make:76: CMakeFiles/CouchbaseLiteCStatic.dir/src/CBLBlob.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 62%] Building CXX object vendor/couchbase-lite-core/CMakeFiles/LiteCoreStatic.dir/C/c4BlobStore.cc.o
In file included from /tmp/2/couchbase-lite-C/src/CBLDatabase_Internal.hh:24,
from /tmp/2/couchbase-lite-C/src/CBLReplicatorConfig.hh:22,
from /tmp/2/couchbase-lite-C/src/CBLReplicator_Internal.hh:20,
from /tmp/2/couchbase-lite-C/src/CBLReplicator.cc:20:
/tmp/2/couchbase-lite-C/src/Listener.hh: In member function ‘void cbl_internal::ListenersBase::clear()’:
/tmp/2/couchbase-lite-C/src/Listener.hh:117:30: error: ‘void CBLListenerToken::removed()’ is protected within this context
117 | tok->removed();
| ^
/tmp/2/couchbase-lite-C/src/Listener.hh:57:10: note: declared protected here
57 | void removed() {
| ^~~~~~~
make[2]: *** [CMakeFiles/CouchbaseLiteCStatic.dir/build.make:89: CMakeFiles/CouchbaseLiteCStatic.dir/src/CBLDatabase.cc.o] Error 1
LiteCore submodule seems to be currently pointing to https://github.com/couchbase/couchbase-lite-core/tree/b3c0747d5a76093e2027f60f043b9b4c27692d41 which is 404.
Hello,
I am unable to build with CMake 3.14.5 on MacOSX. I followed the instructions and ran build.sh.
I have encountered 2 problems. I was able to solve the first but have found no solution for the second.
The first problem was a large sequence of errors starting with
In file included from /Users/zbh8jv/Desktop/couchbase-lite-C/src/CBLDatabase.cc:19:
In file included from /Users/zbh8jv/Desktop/couchbase-lite-C/src/CBLDatabase_Internal.hh:23:
In file included from /Users/zbh8jv/Desktop/couchbase-lite-C/src/Listener.hh:22:
/Users/zbh8jv/Desktop/couchbase-lite-C/vendor/couchbase-lite-core/LiteCore/Support/access_lock.hh:66:43: error:
no template named 'remove_reference_t' in namespace 'std'; did you
mean 'remove_reference'?
using LOCK = std::lock_guard<std::remove_reference_t<MUTEX>>;
which I was able to fix by setting CMAKE_CXX_STANDARD to 14.
The second problem generates the following error message:
Scanning dependencies of target CouchbaseLiteCStatic
[ 4%] Built target Support
[ 7%] Built target BLIPStatic
[ 19%] Built target SQLite3_UnicodeSN
[ 24%] Built target LiteCoreWebSocket
[ 43%] Built target mbedcrypto
[ 60%] Built target FleeceStatic
[ 63%] Built target CouchbaseLiteCStatic
[ 65%] Built target mbedx509
[ 92%] Built target LiteCoreStatic
[ 95%] Built target mbedtls
Scanning dependencies of target CouchbaseLiteC
[ 97%] Building CXX object CMakeFiles/CouchbaseLiteC.dir/empty.cpp.o
[ 97%] Linking CXX shared library libCouchbaseLiteC.dylib
undef: __ZN8litecore3net10TLSContextC1ENS1_6role_tE
undef: __ZN8litecore3net10TLSContext12setRootCertsEN6fleece5sliceE
undef: __ZN8litecore3net10TLSContext11setIdentityEN6fleece5sliceES3_
undef: __ZN8litecore3net10TLSContext13allowOnlyCertEN6fleece5sliceE
undef: __ZNK12cbl_internal16ConflictResolver6resultEv
undef: __ZN12cbl_internal16ConflictResolverC1EP11CBLDatabasePFPK11CBLDocumentPvPKcS5_S5_ES6_RK15C4DocumentEnded
undef: _CBLDefaultConflictResolver
undef: __ZN8litecore3net10TLSContext11setIdentityEPNS_6crypto8IdentityE
undef: __ZN12cbl_internal16ConflictResolver8runAsyncENSt3__18functionIFvPS0_EEE
Undefined symbols for architecture x86_64:
"litecore::net::TLSContext::TLSContext(litecore::net::TLSContext::role_t)", referenced from:
litecore::websocket::BuiltInWebSocket::_connectLoop() in libLiteCoreWebSocket.a(BuiltInWebSocket.cc.o)
litecore::net::TCPSocket::wrapTLS(fleece::slice) in libLiteCoreWebSocket.a(TCPSocket.cc.o)
"litecore::net::TLSContext::setRootCerts(fleece::slice)", referenced from:
litecore::websocket::BuiltInWebSocket::_connectLoop() in libLiteCoreWebSocket.a(BuiltInWebSocket.cc.o)
"litecore::net::TLSContext::setIdentity(fleece::slice, fleece::slice)", referenced from:
litecore::websocket::BuiltInWebSocket::configureClientCert(fleece::Dict) in libLiteCoreWebSocket.a(BuiltInWebSocket.cc.o)
"litecore::net::TLSContext::allowOnlyCert(fleece::slice)", referenced from:
litecore::websocket::BuiltInWebSocket::_connectLoop() in libLiteCoreWebSocket.a(BuiltInWebSocket.cc.o)
"cbl_internal::ConflictResolver::result() const", referenced from:
CBLReplicator::_conflictResolverFinished(cbl_internal::ConflictResolver*) in libCouchbaseLiteCStatic.a(CBLReplicator.cc.o)
"cbl_internal::ConflictResolver::ConflictResolver(CBLDatabase*, CBLDocument const* (*)(void*, char const*, CBLDocument const*, CBLDocument const*), void*, C4DocumentEnded const&)", referenced from:
CBLReplicator::_documentsEnded(bool, unsigned long, C4DocumentEnded const**) in libCouchbaseLiteCStatic.a(CBLReplicator.cc.o)
"_CBLDefaultConflictResolver", referenced from:
-exported_symbol[s_list] command line option
"litecore::net::TLSContext::setIdentity(litecore::crypto::Identity*)", referenced from:
litecore::websocket::BuiltInWebSocket::configureClientCert(fleece::Dict) in libLiteCoreWebSocket.a(BuiltInWebSocket.cc.o)
"cbl_internal::ConflictResolver::runAsync(std::__1::function<void (cbl_internal::ConflictResolver*)>)", referenced from:
CBLReplicator::_documentsEnded(bool, unsigned long, C4DocumentEnded const**) in libCouchbaseLiteCStatic.a(CBLReplicator.cc.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libCouchbaseLiteC.dylib] Error 1
make[1]: *** [CMakeFiles/CouchbaseLiteC.dir/all] Error 2
make: *** [all] Error 2
I am aware Xcode can be used (and I was able to), but for my purposes I need to build it through Cmake. Any help will be appreciated. Further info:
CMake version 3.14.5
Mac OSX Mojave 10.14.6
AppleClang 10.0.1.10010046
Thanks in advance
I'd like to be able to compile this into a cross-platform mobile app for iOS and Android using Qt, but it looks like Android isn't supported.
What is needed for this? I'd be glad to help out if I can since I need this for a project I'm working on.
Doing a null check fixes the bug, for example:
for (unsigned i = 0; i < nCols; ++i) { Value val = column(i); if (val) { slice key = _query->columnName(i); dict[key] = val; } }
Would be useful to have a simplified API for getting/setting the document's properties as JSON:
char* cbldoc_getPropertiesJSON(CBLDocument*);
bool cbldoc_setPropertiesJSON(CBLDocument*, char *json, CBLError*);
This would be esp good for bindings to dynamic languages like JS/Python/Ruby that already have a lot of support for JSON, and for which it would get expensive to keep calling back and forth to C code for every single doc property access.
Please fix the bug which i am facing on my windows 10 machine...for your clear understanding i am writing step by step....how i encounter this....
Step-1:
I am using the following command to clone the repo from github:
git clone -b fix/ci_windows_etc https://github.com/couchbaselabs/couchbase-lite-C.git
Step-2:
There is a power shell script to produce sub-module update recursively i am using that script using below:
opening Windows PowerShell as administrative mode
cd into the repository downloaded using step-1
inside my repo there is a folder called jenkins
Step-3:
cd into jenkins using following
cd jenkins_win.ps1
Step-4:
running the powershell script using following:
.\jenkins_win.ps1
i got the following output from the windows power shell terminal:
PS C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\jenkins> .\jenkins_win.ps1 Submodule 'vendor/couchbase-lite-core' (https://github.com/couchbase/couchbase-lite-core.git) registered for path 'vendor/couchbase-lite-core'
Cloning into 'C:/Users/mostain/Desktop/couchbase/newdb/couchbase-lite-C/vendor/couchbase-lite-core'...
remote: Enumerating objects: 33, done.
remote: Counting objects: 100% (33/33), done.
remote: Total 56 (delta 33), reused 33 (delta 33), pack-reused 23
Unpacking objects: 100% (56/56), done.
From https://github.com/couchbase/couchbase-lite-core
Please make sure you have the correct access rights
and the repository exists.
Directory: C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C
Mode LastWriteTime Length Name
d----- 3/10/2020 9:52 PM build
CMake Error at CMakeLists.txt:9 (project):
Generator
Visual Studio 15 2017 Win64
could not find any instance of Visual Studio.
-- Configuring incomplete, errors occurred!
See also "C:/Users/mostain/Desktop/couchbase/newdb/couchbase-lite-C/build/CMakeFiles/CMakeOutput.log".
Failed to run CMake!
so i am trying to generate solution file using cmake following command: (using command line as administrator)
Step-5:
creating a folder build_cmake
mkdir build_cmake
Step-6:
then executing the following command:
cmake -G "Visual Studio 16 2019" -B "C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\build_cmake"
Above command produces all the necessary files to build using visual studio 2019.
then i cd into build_cmake folder and open CouchbaseLite_C.sln with visual studio 2019 and click Build from the Solution Explorer, after few minutes it gives me the following error:
I am getting the following error in the output window on visual studio:
1>------ Build started: Project: ZERO_CHECK, Configuration: Release x64 ------
1>Checking Build System
2>------ Build started: Project: mbedcrypto, Configuration: Release x64 ------
3>------ Build started: Project: BLIPStatic, Configuration: Release x64 ------
4>------ Build started: Project: CouchbaseLiteCStatic, Configuration: Release x64 ------
5>------ Build started: Project: FleeceStatic, Configuration: Release x64 ------
2>Building Custom Rule C:/Users/mostain/Desktop/couchbase/newdb/couchbase-lite-C/vendor/couchbase-lite-core/vendor/mbedtls/crypto/library/CMakeLists.txt
3>Building Custom Rule C:/Users/mostain/Desktop/couchbase/newdb/couchbase-lite-C/vendor/couchbase-lite-core/vendor/BLIP-Cpp/CMakeLists.txt
4>Building Custom Rule C:/Users/mostain/Desktop/couchbase/newdb/couchbase-lite-C/CMakeLists.txt
2>aes.c
5>Building Custom Rule C:/Users/mostain/Desktop/couchbase/newdb/couchbase-lite-C/vendor/couchbase-lite-core/vendor/fleece/CMakeLists.txt
2>aesni.c
2>arc4.c
2>aria.c
4>CBLBase.cc
2>asn1parse.c
2>asn1write.c
2>base64.c
2>bignum.c
2>blowfish.c
2>camellia.c
2>ccm.c
2>chacha20.c
2>chachapoly.c
2>cipher.c
5>Fleece.cc
2>cipher_wrap.c
2>cmac.c
2>ctr_drbg.c
4>CBLBlob.cc
2>des.c
2>dhm.c
2>ecdh.c
2>Generating Code...
3>BLIPConnection.cc
4>CBLDatabase.cc
3>Message.cc
5>FLSlice.cc
5>Array.cc
4>CBLDocument.cc
3>MessageBuilder.cc
5>DeepIterator.cc
4>CBLLog.cc
4>CBLQuery.cc
3>MessageOut.cc
5>Dict.cc
4>CBLReplicator.cc
3>Actor.cc
2>Compiling...
2>ecdsa.c
2>ecjpake.c
5>Doc.cc
2>ecp.c
2>ecp_curves.c
2>entropy.c
2>entropy_poll.c
3>ActorProperty.cc
4>ConflictResolver.cc
2>gcm.c
2>havege.c
2>hkdf.c
2>hmac_drbg.c
2>md.c
2>md2.c
2>md4.c
2>md5.c
5>Encoder.cc
2>memory_buffer_alloc.c
2>nist_kw.c
2>oid.c
3>Async.cc
2>padlock.c
2>pem.c
2>pk.c
2>Generating Code...
3>Channel.cc
5>JSONConverter.cc
2>Compiling...
2>pk_wrap.c
2>pkcs12.c
2>pkcs5.c
2>pkparse.c
2>pkwrite.c
2>platform.c
3>Codec.cc
2>platform_util.c
2>poly1305.c
2>psa_crypto.c
2>psa_crypto_se.c
5>JSONDelta.cc
2>psa_crypto_slot_management.c
2>psa_crypto_storage.c
2>psa_its_file.c
2>ripemd160.c
2>rsa.c
2>rsa_internal.c
2>sha1.c
3>Timer.cc
2>sha256.c
2>sha512.c
2>threading.c
2>Generating Code...
4>Listener.cc
5>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\vendor\fleece\Fleece\Core\JSONDelta.cc(456,37): warning C4267: '+=': conversion from 'size_t' to 'long', possible loss of data
5>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\vendor\fleece\Fleece\Core\JSONDelta.cc(457,37): warning C4267: '+=': conversion from 'size_t' to 'long', possible loss of data
5>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\vendor\fleece\Fleece\Core\JSONDelta.cc(473,41): warning C4267: '+=': conversion from 'size_t' to 'long', possible loss of data
5>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\vendor\fleece\Fleece\Core\JSONDelta.cc(479,41): warning C4267: '+=': conversion from 'size_t' to 'long', possible loss of data
4>Util.cc
4>Generating Code...
3>Headers.cc
5>Path.cc
3>WebSocketImpl.cc
2>Compiling...
2>timing.c
5>Pointer.cc
4>CouchbaseLiteCStatic.vcxproj -> C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\build_cmake\Release\CouchbaseLiteCStatic.lib
6>------ Build started: Project: LiteCoreStatic, Configuration: Release x64 ------
2>xtea.c
5>SharedKeys.cc
2>version.c
2>version_features.c
2>error.c
2>everest.c
5>Value+Dump.cc
2>x25519.c
2>Hacl_Curve25519_joined.c
2>Generating Code...
2>mbedcrypto.vcxproj -> C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\build_cmake\vendor\couchbase-lite-core\vendor\mbedtls\crypto\library\Release\mbedcrypto.lib
7>------ Build started: Project: mbedx509, Configuration: Release x64 ------
7>Building Custom Rule C:/Users/mostain/Desktop/couchbase/newdb/couchbase-lite-C/vendor/couchbase-lite-core/vendor/mbedtls/library/CMakeLists.txt
5>Value.cc
5>MContext.cc
5>HeapArray.cc
7>certs.c
7>pkcs11.c
7>x509.c
7>x509_create.c
7>x509_crl.c
7>x509_crt.c
7>x509_csr.c
7>x509write_crt.c
7>x509write_csr.c
7>Generating Code...
3>WebSocketInterface.cc
3>ThreadedMailbox.cc
6>Building Custom Rule C:/Users/mostain/Desktop/couchbase/newdb/couchbase-lite-C/vendor/couchbase-lite-core/CMakeLists.txt
3>Generating Code...
7>mbedx509.vcxproj -> C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\build_cmake\vendor\couchbase-lite-core\vendor\mbedtls\library\Release\mbedx509.lib
8>------ Build started: Project: LiteCoreWebSocket, Configuration: Release x64 ------
5>HeapDict.cc
6>c4Base.cc
6>c4BlobStore.cc
5>HeapValue.cc
5>ValueSlot.cc
5>Backtrace.cc
6>c4Certificate.cc
6>c4Database.cc
5>Generating Code...
6>c4DocEnumerator.cc
6>c4DocExpiration.cc
5>Compiling...
5>betterassert.cc
6>c4Document.cc
6>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\C\c4Document.cc(218,1): warning C4804: '<=': unsafe use of type 'bool' in operation
6>c4Observer.cc
6>c4PredictiveQuery.cc
6>c4Query.cc
5>Bitmap.cc
5>FileUtils.cc
5>FleeceException.cc
5>InstanceCounted.cc
5>NumConversion.cc
5>JSON5.cc
5>JSONEncoder.cc
5>LibC++Debug.cc
5>ParseDate.cc
6>BlobStore.cc
5>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\vendor\fleece\Fleece\Support\ParseDate.cc(297,29): warning C4996: 'tzset': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _tzset. See online help for details.
5>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\time.h(594): message : see declaration of 'tzset'
5>RefCounted.cc
5>slice.cc
6>Stream.cc
6>BackgroundDB.cc
5>sliceIO.cc
6>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\LiteCore\Database\BackgroundDB.cc(66,39): warning C4101: 'x': unreferenced local variable
5>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\vendor\fleece\Fleece\Support\sliceIO.cc(56,67): warning C4267: 'argument': conversion from 'size_t' to 'unsigned int', possible loss of data
5>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\vendor\fleece\Fleece\Support\sliceIO.cc(67,53): warning C4267: 'argument': conversion from 'size_t' to 'unsigned int', possible loss of data
5>StringTable.cc
6>Document.cc
5>varint.cc
5>Writer.cc
6>Housekeeper.cc
5>HashTree.cc
5>MutableHashTree.cc
6>LeafDocument.cc
5>NodeRef.cc
6>LegacyAttachments.cc
5>SwiftDtoa.cc
5>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\vendor\fleece\vendor\SwiftDtoa\SwiftDtoa.cc(1525,50): warning C4319: '': zero extending 'uint32_t' to 'uint64_t' of greater size': zero extending 'uint32_t' to 'uint64_t' of greater size
5>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\vendor\fleece\vendor\SwiftDtoa\SwiftDtoa.cc(1527,38): warning C4319: '
5>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\vendor\fleece\vendor\SwiftDtoa\SwiftDtoa.cc(1529,38): warning C4319: '': zero extending 'uint32_t' to 'uint64_t' of greater size': zero extending 'uint32_t' to 'uint64_t' of greater size
5>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\vendor\fleece\vendor\SwiftDtoa\SwiftDtoa.cc(1531,44): warning C4319: '
5>Generating Code...
6>LiveQuerier.cc
5>Compiling...
5>memmem.cc
5>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\vendor\fleece\MSVC\memmem.cc(27,11): warning C5033: 'register' is no longer a supported storage class
5>Generating Code...
6>PrebuiltCopier.cc
6>SequenceTracker.cc
5>jsonsl.c
5>cdecode.c
5>cencode.c
5>vasprintf-msvc.c
5>asprintf.c
5>Generating Code...
9>------ Build started: Project: SQLite3_UnicodeSN, Configuration: Release x64 ------
6>Generating Code...
9>Building Custom Rule C:/Users/mostain/Desktop/couchbase/newdb/couchbase-lite-C/vendor/couchbase-lite-core/vendor/sqlite3-unicodesn/CMakeLists.txt
5>FleeceStatic.vcxproj -> C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\build_cmake\vendor\couchbase-lite-core\vendor\fleece\Release\FleeceStatic.lib
5>Done building project "FleeceStatic.vcxproj".
10>------ Build started: Project: Support, Configuration: Release x64 ------
9>stem_ISO_8859_1_danish.c
9>stem_ISO_8859_1_dutch.c
9>stem_ISO_8859_1_english.c
9>stem_ISO_8859_1_finnish.c
9>stem_ISO_8859_1_french.c
9>stem_ISO_8859_1_german.c
9>stem_ISO_8859_1_hungarian.c
9>stem_ISO_8859_1_italian.c
9>stem_ISO_8859_1_norwegian.c
9>stem_ISO_8859_1_porter.c
9>stem_ISO_8859_1_portuguese.c
9>stem_ISO_8859_1_spanish.c
9>stem_ISO_8859_1_swedish.c
9>stem_ISO_8859_2_romanian.c
9>stem_KOI8_R_russian.c
9>stem_UTF_8_danish.c
9>stem_UTF_8_dutch.c
9>stem_UTF_8_english.c
9>stem_UTF_8_finnish.c
9>stem_UTF_8_french.c
9>Generating Code...
9>Compiling...
9>stem_UTF_8_german.c
9>stem_UTF_8_hungarian.c
9>stem_UTF_8_italian.c
9>stem_UTF_8_norwegian.c
9>stem_UTF_8_porter.c
9>stem_UTF_8_portuguese.c
6>Compiling...
6>TreeDocument.cc
9>stem_UTF_8_romanian.c
9>stem_UTF_8_russian.c
9>stem_UTF_8_spanish.c
9>stem_UTF_8_swedish.c
9>stem_UTF_8_turkish.c
9>fts3_unicode2.c
9>fts3_unicodesn.c
9>sqlite3_unicodesn_tokenizer.c
9>libstemmer_utf8.c
9>api_sq3.c
9>utilities_sq3.c
9>Generating Code...
9>stopwordset.cc
6>Upgrader.cc
9>SQLite3_UnicodeSN.vcxproj -> C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\build_cmake\vendor\couchbase-lite-core\vendor\sqlite3-unicodesn\Release\SQLite3_UnicodeSN.lib
11>------ Build started: Project: mbedtls, Configuration: Release x64 ------
6>IndexSpec.cc
11>Building Custom Rule C:/Users/mostain/Desktop/couchbase/newdb/couchbase-lite-C/vendor/couchbase-lite-core/vendor/mbedtls/library/CMakeLists.txt
11>debug.c
11>net_sockets.c
6>PredictiveModel.cc
6>Query.cc
11>ssl_cache.c
11>ssl_ciphersuites.c
11>ssl_cli.c
11>ssl_cookie.c
11>ssl_srv.c
11>ssl_ticket.c
11>ssl_tls.c
11>Generating Code...
6>QueryParser+Prediction.cc
6>QueryParser.cc
6>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\LiteCore\Query\QueryParser.cc(301,57): warning C4267: '+=': conversion from 'size_t' to 'unsigned int', possible loss of data
11>mbedtls.vcxproj -> C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\build_cmake\vendor\couchbase-lite-core\vendor\mbedtls\library\Release\mbedtls.lib
12>------ Build started: Project: zlibstatic, Configuration: Release x64 ------
6>SQLiteDataFile+Indexes.cc
12>Building Custom Rule C:/Users/mostain/Desktop/couchbase/newdb/couchbase-lite-C/vendor/couchbase-lite-core/vendor/BLIP-Cpp/vendor/zlib/CMakeLists.txt
6>SQLiteFleeceEach.cc
12>adler32.c
6>SQLiteFleeceFunctions.cc
12>compress.c
12>crc32.c
12>deflate.c
12>gzclose.c
12>gzlib.c
12>gzread.c
12>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\vendor\BLIP-Cpp\vendor\zlib\gzread.c(319,20): warning C4267: '=': conversion from 'size_t' to 'unsigned int', possible loss of data
12>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\vendor\BLIP-Cpp\vendor\zlib\gzread.c(400,35): warning C4267: '=': conversion from 'size_t' to 'unsigned int', possible loss of data
12>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\vendor\BLIP-Cpp\vendor\zlib\gzread.c(472,33): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
12>gzwrite.c
12>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\vendor\BLIP-Cpp\vendor\zlib\gzwrite.c(212,27): warning C4267: '=': conversion from 'size_t' to 'unsigned int', possible loss of data
12>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\vendor\BLIP-Cpp\vendor\zlib\gzwrite.c(232,24): warning C4267: '=': conversion from 'size_t' to 'unsigned int', possible loss of data
12>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\vendor\BLIP-Cpp\vendor\zlib\gzwrite.c(371,36): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
12>inflate.c
12>infback.c
12>inftrees.c
12>inffast.c
12>trees.c
12>uncompr.c
12>zutil.c
12>Generating Code...
12>zlibstatic.vcxproj -> C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\build_cmake\vendor\couchbase-lite-core\vendor\BLIP-Cpp\vendor\zlib\Release\zlibstatic.lib
12>Done building project "zlibstatic.vcxproj".
6>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\LiteCore\Query\SQLiteFleeceFunctions.cc(83,44): warning C4101: 'x': unreferenced local variable
6>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\LiteCore\Query\SQLiteFleeceFunctions.cc(87,40): warning C4101: 'x': unreferenced local variable
6>SQLiteFleeceUtil.cc
6>SQLiteFTSRankFunction.cc
6>SQLiteKeyStore+ArrayIndexes.cc
6>SQLiteKeyStore+FTSIndexes.cc
6>SQLiteKeyStore+Indexes.cc
6>SQLiteKeyStore+PredictiveIndexes.cc
6>SQLiteN1QLFunctions.cc
6>SQLitePredictionFunction.cc
6>SQLiteQuery.cc
6>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\LiteCore\Query\SQLiteQuery.cc(484,1): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
6>n1ql.cc
6>Generating Code...
6>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\LiteCore\Database\TreeDocument.cc(253): warning C4715: 'c4Internal::TreeDocument::save': not all control paths return a value
6>Compiling...
6>RawRevTree.cc
6>RevID.cc
6>RevTree.cc
6>VersionedDocument.cc
6>DataFile.cc
6>KeyStore.cc
6>Record.cc
6>RecordEnumerator.cc
6>SQLiteDataFile.cc
6>SQLiteEnumerator.cc
6>SQLiteKeyStore.cc
6>UnicodeCollator.cc
6>Certificate.cc
6>mbedUtils.cc
6>PublicKey.cc
6>SecureDigest.cc
6>SecureSymmetricCrypto.cc
6>Address.cc
6>CookieStore.cc
6>Backup.cpp
6>Generating Code...
6>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\Crypto\PublicKey.cc(70): warning C4715: 'litecore::crypto::Key::publicKeyData': not all control paths return a value
6>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\Crypto\PublicKey.cc(123): warning C4715: 'litecore::crypto::PrivateKey::privateKeyData': not all control paths return a value
6>Compiling...
6>Column.cpp
6>Exception.cpp
6>Statement.cpp
6>Transaction.cpp
6>c4Replicator.cc
6>c4Socket.cc
6>Checkpoint.cc
6>Checkpointer.cc
6>DatabaseCookies.cc
6>DBAccess.cc
6>IncomingBlob.cc
6>IncomingRev.cc
6>Inserter.cc
6>Puller.cc
6>Pusher.cc
6>Pusher+DB.cc
6>Replicator.cc
6>ReplicatorTypes.cc
6>RevFinder.cc
6>Worker.cc
6>Generating Code...
6>Compiling...
6>Logging.cc
6>DefaultLogger.cc
6>Error.cc
6>UnicodeCollator_winapi.cc
6>C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\vendor\couchbase-lite-core\LiteCore\Storage\UnicodeCollator_winapi.cc(64,1): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
6>Generating Code...
3>BLIPStatic.vcxproj -> C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\build_cmake\vendor\couchbase-lite-core\vendor\BLIP-Cpp\Release\BLIPStatic.lib
6>Database.cc
6>SQLiteChooser.c
6>Database.cpp
6>LiteCoreStatic.vcxproj -> C:\Users\mostain\Desktop\couchbase\newdb\couchbase-lite-C\build_cmake\vendor\couchbase-lite-core\Release\LiteCoreStatic.lib
6>Done building project "LiteCoreStatic.vcxproj".
13>------ Build started: Project: CouchbaseLiteC, Configuration: Release x64 ------
13>Building Custom Rule C:/Users/mostain/Desktop/couchbase/newdb/couchbase-lite-C/CMakeLists.txt
13>empty.cpp
13>LINK : fatal error LNK1181: cannot open input file 'vendor\couchbase-lite-core\Release\LiteCoreWebSocket.lib'
13>Done building project "CouchbaseLiteC.vcxproj" -- FAILED.
14>------ Build started: Project: CBL_C_Tests, Configuration: Release x64 ------
14>Building Custom Rule C:/Users/mostain/Desktop/couchbase/newdb/couchbase-lite-C/test/CMakeLists.txt
14>BlobTest_Cpp.cc
14>CBLTestsMain.cpp
14>DatabaseTest.cc
14>DatabaseTest_Cpp.cc
14>QueryTest.cc
14>ReplicatorTest.cc
14>LibC++Debug.cc
14>Backtrace.cc
14>Generating Code...
14>CBLTest.c
14>CBLTest.cc
14>LINK : fatal error LNK1181: cannot open input file '..\Release\CouchbaseLiteC.lib'
14>Done building project "CBL_C_Tests.vcxproj" -- FAILED.
15>------ Build started: Project: ALL_BUILD, Configuration: Release x64 ------
15>Building Custom Rule C:/Users/mostain/Desktop/couchbase/newdb/couchbase-lite-C/CMakeLists.txt
========== Build: 12 succeeded, 3 failed, 0 up-to-date, 0 skipped ==========
When I am using the C API, I try to get a MutableDocument I previously saved from the database, modify it and save it back to db. However, When I try to modify the MutableDocument, it "terminate called after throwing an instance of 'fleece::FleeceException'
what(): incorrect use of persistent shared keys: not in transaction
Aborted (core dumped)".
@snej, I asked some questions about couchbase-lite-C + Rust
future direction.
May be you missed or have no time to reply. So I repeat them here to not forget/miss them.
we need one whose API is compatible with our cross-platform API spec
What does it mean "API is compatible with our cross-platform API spec" for Rust bindgins,
That mean Rust bindging should be similar to other language bindings even if Rust features
allow to improve something, prefer worse but uniform API, or you ready to adopt API for each
language?
Do you plan to publish crate in global rust package repository? It is something like conan for c++, but in compare with conan it used by 99% (I suppose) of Rust users.
I ask, because of the current project structure is prevent from doing so.
CBL-C doesn't call c4db_purgeExpiredDocs
, so the document expiration API won't actually cause anything to be purged.
Other existing platforms run a timer to do this, but CBL-C doesn't have access to a standard timer API. So I think I may need to add the expiration timer to LiteCore itself.
When I launch the build.sh script, it runs without problems until it reaches the target CBL_C_Test. (linking for shared library libCouchbaseLiteC doens't fail). I get those errors:
../libCouchbaseLiteC.so: undefined reference for "ucasemap_utf8ToUpper_60"
../libCouchbaseLiteC.so: undefined reference for "ucol_setAttribute_60"
../libCouchbaseLiteC.so: undefined reference for "ucasemap_utf8ToLower_60"
../libCouchbaseLiteC.so: undefined reference for "ucol_open_60"
../libCouchbaseLiteC.so: undefined reference for "ucol_strcollUTF8_60"
../libCouchbaseLiteC.so: undefined reference for "ucol_close_60"
../libCouchbaseLiteC.so: undefined reference for "ucasemap_open_60"
../libCouchbaseLiteC.so: undefined reference for "ucasemap_close_60"
collect2: error: ld returned 1 exit status
make[2]: *** [test/CMakeFiles/CBL_C_Tests.dir/build.make:208: test/CBL_C_Tests] Error 1
make[1]: *** [CMakeFiles/Makefile2:5593: test/CMakeFiles/CBL_C_Tests.dir/all] Error 2
make: *** [Makefile:147: all] Error 2
These very same errors appears when I build my application written in C which links the CouchbaseLiteC library. I resolved adding -licui18n -licuuc -licudata
to gcc command, but I don't know where to add those options for CBL_C_Tests make file. I suppose these line from CMakeLists.txt have something to do with the solution:
target_link_libraries(CBL_C_Tests PUBLIC "pthread" "${LIBCXX_LIB}" "${LIBCXXABI_LIB}" dl)
I'm on RHEL 8.1, and GCC version is gcc (GCC) 8.3.1 20190507 (Red Hat 8.3.1-4)
Building on Windows I get the following error.
CBL.def : error LNK2001: unresolved external symbol CBLEndpoint_NewWithLocalDB [D:\projects\couchbase-lite-C\CouchbaseLiteC.vcxproj]
Removing CBLEndpoint_NewWithLocalDB
from CBL.def
fixes the error and the library is built successfully. CBLEndpoint_NewWithLocalDB being an enterprise feature it probably shouldn't be exported anyway?
See the simple test script below. Updating a document with nested JSON will raise an exception in the _defaultEncodeJSON function, regardless of which part of the doc is being updated.
Additionally, updating a document with a non-empty array will raise an AttributeError exception.
import logging
from CouchbaseLite.Replicator import Replicator, ReplicatorConfiguration
from CouchbaseLite.Database import Database, DatabaseConfiguration
from CouchbaseLite.Document import Document, MutableDocument
from CouchbaseLite.Query import JSONQuery
Database.deleteFile("test_db", "/tmp")
db = Database("test_db", DatabaseConfiguration("/tmp"))
with db:
doc = MutableDocument('doc')
doc['flat'] = 'flat'
doc['empty_obj'] = {} # This will raise a TypeError
doc['nested'] = {'nested': 'nested'} # This will raise a TypeError
doc['empty_array'] = [] # This will raise a TypeError
doc['array'] = ['a'] # This will raise a decodeFleeceArray AttributeError
db.saveDocument(doc)
print('This works')
read_doc = db.getMutableDocument('doc')
db.saveDocument(read_doc)
print('This fails')
update_doc = db.getMutableDocument('doc')
update_doc['a'] = 'b' # UPDATE DOC - WILL LEAD TO ISSUES ABOVE
db.saveDocument(update_doc)
Hi, using the couchbase lite c library, removing a changeListener from a query does not dispose of the query.
My use case is simple, I have a page in my app with one query and set up changeListener, When I dispose the page (navigating away from it) I remove the changeListener and release the query.
If i open the page a couple of time I get dozens of these zombie LiveQuerier and Query objects in my log, one for each time I opened the page.
17:44:08.284768| [Query]: {LiveQuerier#10} Results changed at seq 46 (2.942ms)
17:44:08.290628| [Query]: {LiveQuerier#14} Results changed at seq 46 (8.790ms)
17:44:08.293730| [Query]: {LiveQuerier#41} Results changed at seq 46 (2.483ms)
17:44:08.300004| [Query]: {LiveQuerier#65} Results changed at seq 46 (4.266ms)
17:44:08.305396| [Query]: {LiveQuerier#69} Results changed at seq 46 (4.312ms)
17:44:08.311907| [Query]: {LiveQuerier#22} Results changed at seq 46 (24.931ms)
17:44:08.314983| [Query]: {LiveQuerier#118} Results changed at seq 46 (1.914ms)
17:44:08.351519| [Query]: {LiveQuerier#106} Results changed at seq 46 (39.751ms)
17:44:08.357080| [Query]: {LiveQuerier#134} Results changed at seq 46 (38.868ms)
17:44:08.871045| [Query]: {QueryEnum#165} Created on {Query#19} with 1 rows (230 bytes) in 0.785ms
17:44:08.871470| [Query]: {QueryEnum#165} Deleted
17:44:08.872031| [Query]: {QueryEnum#164} Created on {Query#103} with 1 rows (230 bytes) in 0.516ms
17:44:08.872413| [Query]: {QueryEnum#164} Deleted
17:44:08.872556| [Query]: {QueryEnum#166}==> class litecore::SQLiteQueryEnumerator 000002C1FD3161D0 @000002C1FD3161D0
17:44:08.873082| [Query]: {QueryEnum#167}==> class litecore::SQLiteQueryEnumerator 000002C1FD316470 @000002C1FD316470
17:44:08.873533| [Query]: {QueryEnum#166} Created on {Query#23} with 1 rows (454 bytes) in 0.487ms
17:44:08.873958| [Query]: {QueryEnum#167} Created on {Query#111} with 1 rows (230 bytes) in 0.273ms
17:44:08.874305| [Query]: {QueryEnum#166} Deleted
17:44:08.874467| [Query]: {QueryEnum#167} Deleted
17:44:08.874966| [Query]: {QueryEnum#168}==> class litecore::SQLiteQueryEnumerator 000002C1FD3175F0 @000002C1FD3175F0
17:44:08.875385| [Query]: {QueryEnum#168} Created on {Query#119} with 1 rows (454 bytes) in 0.466ms
17:44:08.875813| [Query]: {QueryEnum#168} Deleted
17:44:08.876299| [Query]: {QueryEnum#169}==> class litecore::SQLiteQueryEnumerator 000002C1FD3175F0 @000002C1FD3175F0
17:44:08.876707| [Query]: {QueryEnum#169} Created on {Query#115} with 1 rows (254 bytes) in 0.365ms
17:44:08.877106| [Query]: {QueryEnum#169} Deleted
17:44:08.877557| [Query]: {QueryEnum#170}==> class litecore::SQLiteQueryEnumerator 000002C1FD3161D0 @000002C1FD3161D0
17:44:08.878032| [Query]: {QueryEnum#170} Created on {Query#123} with 1 rows (230 bytes) in 0.326ms
17:44:08.878442| [Query]: {QueryEnum#170} Deleted
17:44:08.879008| [Query]: {QueryEnum#171}==> class litecore::SQLiteQueryEnumerator 000002C1FD316470 @000002C1FD316470
17:44:08.879380| [Query]: {QueryEnum#171} Created on {Query#107} with 1 rows (454 bytes) in 0.446ms
17:44:08.879790| [Query]: {QueryEnum#171} Deleted
17:44:08.880223| [Query]: {QueryEnum#172}==> class litecore::SQLiteQueryEnumerator 000002C1FD3175F0 @000002C1FD3175F0
17:44:08.880611| [Query]: {QueryEnum#172} Created on {Query#127} with 1 rows (254 bytes) in 0.316ms
17:44:08.881797| [Query]: {QueryEnum#172} Deleted
17:44:08.882263| [Query]: {QueryEnum#173}==> class litecore::SQLiteQueryEnumerator 000002C1FD3175F0 @000002C1FD3175F0
17:44:08.882645| [Query]: {QueryEnum#173} Created on {Query#131} with 1 rows (230 bytes) in 0.358ms
17:44:08.883052| [Query]: {QueryEnum#173} Deleted
17:44:08.883668| [Query]: {QueryEnum#174}==> class litecore::SQLiteQueryEnumerator 000002C1FD3175F0 @000002C1FD3175F0
17:44:08.884056| [Query]: {QueryEnum#174} Created on {Query#135} with 1 rows (454 bytes) in 0.468ms
17:44:08.884455| [Query]: {QueryEnum#174} Deleted
for the following code, what I do was in each transaction , get a document from db, add a key to it, and save it back, then print the num of keys in this doc.
Obviously, it should print 1 2 3. However, in the last transaction, it prints 0, which means all the data in the doc are lost.
#include <iostream>
#include "include/cbl/CouchbaseLite.h"
#include "include/cbl++/CouchbaseLite.hh"
int main() {
cbl::Database db("bucket", {"/tmp", kCBLDatabase_Create});
db.beginBatch();
cbl::MutableDocument doc2 = db.getMutableDocument("foo");
if (!doc2.valid()){
doc2 = cbl::MutableDocument("foo");
}
doc2["var1"]= 1;
cbl::Document saved = db.saveDocument(doc2);
std::cout<<saved.properties().count()<<std::endl;
db.endBatch();
db.beginBatch();
doc2 = db.getMutableDocument("foo");
doc2["var2"]= 2;
saved = db.saveDocument(doc2);
std::cout<<saved.properties().count()<<std::endl;
db.endBatch();
db.beginBatch();
doc2 = db.getMutableDocument("foo");
doc2["var3"]= 3;
saved = db.saveDocument(doc2);
std::cout<<saved.properties().count()<<std::endl;
db.endBatch();
db.deleteDatabase();
return 0;
}
Hello,
I am really happy to discover this couchbases project.
I wonder if it will be possible to compile it for a MIPS architecture
My target is an omega2+ with an openwrt distrib.
https://onion.io/omega2/
best regards
I'm running Fedora 32, Python 3.7.7 (pyenv).
I've followed the instructions, but when I run tests, I'm getting the following error:
$ test/test.sh
Traceback (most recent call last):
File "test.py", line 20, in <module>
from CouchbaseLite.Database import Database, DatabaseConfiguration
File "/home/rominf/dev/couchbase-lite-C/bindings/python/CouchbaseLite/Database.py", line 19, in <module>
from ._PyCBL import ffi, lib
ImportError: /home/rominf/dev/couchbase-lite-C/bindings/python/CouchbaseLite/_PyCBL.cpython-37m-x86_64-linux-gnu.so: undefined symbol: CBLDatabase_PurgeExpiredDocuments
Hi,
I want to use the C api in a CLI program.
The problem is that unless I'm doing something wrong, it spits far too much on stdout so I can't really print results there.
How do I make it print nothing on stdout ?
Currently, the replicator will not support SSL/TLS connections. LiteCore is defaulting to civetweb for WebSocket support. Unfortunately the TLS support in civetweb uses OpenSSL, which is large and has a poor security/quality record.
We'll need to either:
(The work will likely be in LiteCore itself, but it manifests as an issue for CBL-C so I'm posting it here.)
I am really confused by this project.
There is https://github.com/couchbase/couchbase-lite-core with C API.
What for this project?
Recently I make my Rust binding for couchbase-lite-core public
https://github.com/Dushistov/couchbase-lite-rust/ it is "very alpha" though I use it in my project.
Should I switch to couchbase-lite-C?
From the first look couchbase-lite-C API is worse in compare with couchbase-lite-core for Rust.
Rust native work with slices, so to pass null terminated string you have to allocate memory.
While couchbase-lite-core C API works with slices that maps one to one for all fundamental Rust types.
cc @snej
CBLReplicator_AddChangeListener
, CBLReplicator_AddDocumentListener
Here's a code I'm using to create blobs,. The blob is added to the document and the file is created in the attachment folder.
However when I do a compaction (using CBLDatabase_Compact) the file is deleted from the attachment folder.
The document still has the blob dictionary.
I'm working on a Dart binding, but I have this test C code that has the same problem.
CBLBlob* CBLBlob_CreateWithData_c(
CBLDatabase *db _cbl_nonnull,
const char *contentType,
unsigned char *contents,
uint64_t length,
CBLError* outError
) CBLAPI
{
CBLBlob* blob = CBLBlob_CreateWithData(contentType, alloc_slice(contents, length));
CBLDocument* doc = CBLDatabase_GetMutableDocument(db, "testdoc3");
MutableDict props = doc->mutableProperties().mutableCopy();
FLSlot sl = FLMutableDict_Set(props, slice("logo"));
FLSlot_SetBlob(sl, blob);
doc->setProperties(props);
doc->save(db, {kCBLConcurrencyControlLastWriteWins}, internal(outError));
return blob;
}
Another issue I'm having is that alling "FLSlot_SetBlob(sl, blob)" if the document already has the key gives me this error:
FAILED PRECONDITION:
index<_items.size() not true when calling class fleece::impl::ValueSlot &__cdecl fleece::impl::internal::HeapArray::setting(unsigned int) (at HeapArray.cc line 129)
I tried all kinds of ways to get the mutable properties, create a copy, remove the previous key, it always gives me this error. The only workaroudn I could find is delete the whole document and recreate it.
Hi,
I found the following issue when implementing a simple client database replicator in C++: The client was not able to connect to the server apparently because the connection could not be upgraded to websockets.
After debugging, the root of the problem seems to be in the function HTTPLogic::Disposition HTTPLogic::handleUpgrade()
from HTTPLogic.cc, on this comparison: if (_responseHeaders["Connection"_sl] != "Upgrade"_sl ...
. The header comes from the server containing "upgrade"(lowercase capitalisation).
The RFC states that the header should be case insensitive https://tools.ietf.org/html/rfc7230#section-6.1 .
We tried to change the capitalisation on the server, but the response remains the same, maybe because the OS changes it.
The solution in this particular case was to change "Upgrade"_sl -> "upgrade"_sl.
This issue appeared on macOS.
Is this repo still being developed / supported? It looks like there is some divergence between this and the couchbase lite core submodule which is causing the build to fail.
Due to limitations in Dart's ffi not supporting nested structs I could not implement a Dart wrapper to create replicators.
The CBLReplicatorConfiguration struct created on the Dart side would cause all kinds of issues. The CBLReplicator_New() call would fail 9 out 10 times - by just crashing.
I found a workaround by adding a function on the C side to take a flat list of parameters, and it seems to work like a charm.
I see that most functions have two versions (plain C and a "_s" version), so having a "plain" version to create a replicator at least in Dart is indispensable.
Here's the function that seems to work well with Dart. My knowledge of C/C++ is almost non-existent, so probably it's not best C code and I still need to figure out how to get the other config options as C parameters.
Any chance something like this can be added to avoids the structs issues I'm having?
CBLReplicator* CBLReplicator_New_c(
CBLDatabase* db _cbl_nonnull,
const char *url _cbl_nonnull,
CBLAuthenticator *auth,
CBLReplicatorType replicatorType,
bool continuous,
CBLError *outError) CBLAPI {
CBLReplicatorConfiguration _conf = {};
_conf.database = db;
_conf.endpoint = new CBLURLEndpoint(slice(url));
_conf.authenticator = auth;
_conf.continuous = continuous;
_conf.replicatorType = replicatorType;
return validated(new CBLReplicator(&_conf), outError);
}
Trying to build this as per the instructions in the README yields this error:
/tmp/couchbase-lite-C/src/CBLLog.cc: In function ‘void CBLLog_SetCallback(CBLLogCallback)’:
/tmp/couchbase-lite-C/src/CBLLog.cc:86:36: error: operands to ‘?:’ have different types ‘CBLLog_SetCallback(CBLLogCallback)::<lambda(C4LogDomain, C4LogLevel, const char*, __va_list_tag*)>’ and ‘std::nullptr_t’
86 | callback ? c4Callback : nullptr,
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
GCC version: 10.1.0
CMake version: 3.17.3
ICU version: 67.1
Linux version: 5.7.4-arch x86_64
Hello,
I'm facing an issue following the instructions to build the library (f2654c3) in macOS (10.14.6). When I try to checkout the submodules using the command git submodule update --init --recursive
I get the following error:
error: Server does not allow request for unadvertised object a6fa1689d4fa7e723862b14e0a23828bd7da1edb
Fetched in submodule path 'vendor/couchbase-lite-core/vendor/BLIP-Cpp', but it did not contain a6fa1689d4fa7e723862b14e0a23828bd7da1edb. Direct fetching of that commit failed.
Failed to recurse into submodule path 'vendor/couchbase-lite-core'
I had setup and built the project previously and everything executed correctly.
Previous attempt project commits:
couchbase-lite-C: 2b07a0f
couchbase-lite-core: couchbase/couchbase-lite-core@9b3186b
BLIP-Cpp: couchbaselabs/BLIP-Cpp@25068db
Any comment or help on this would be greatly appreciated.
I have tried to compile the couchbase-lite-C for Windows using cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
and then opening the resulting .sln file into Microsoft Visual Studio.
It didn't work out of the box, but I did some modifications mainly on adding function into the CBL.def/exp file and changing a path into the .cmake file.
The couchbase-lite-C project now compiles.
However when I tried to use the library into my project, I encountered more Undefined reference to symbol
errors which I solved by adding the corresponding symbols to the .def file except for an error which I could not manage to solve:Error LNK2019 unresolved external symbol _FLBuf_Release referenced in function "void __cdecl std::_Destroy_in_place<struct cbl::ReplicatorConfiguration>(struct cbl::ReplicatorConfiguration &)" (??$_Destroy_in_place@UReplicatorConfiguration@cbl@@@std@@YAXAEAUReplicatorConfiguration@cbl@@@Z)
Does anyone have any idea where is this error coming from? I tried to put _FLBuf_Release
into the .exp and .def files, I replaced the occurrences of __FLBuf_Release
(with two underscores), but no luck.
Reported by victorberger on the forum:
All of this was found on MacOS, from building Lite-C from source code (dev branch) using CMake, and is easily reproducible:
Sometimes but not always, a given TLS replication will be interrupted in the middle after partially completing, displaying the following error. In these cases, the replication never finishes.
Other times, the same replication with the same exact parameters will finish completely. The DB being transferred is not large and system resources are not being strained.
14:43:27.625480| [DB]: {DB#106}==> litecore::SQLiteDataFile /Users/X/X.cblite2/db.sqlite3 @0x7fd77018b260
14:43:27.625514| [DB]: {DB#106} Opening database
14:43:27.629679| [Sync]: {Inserter#107}==> litecore::repl::Inserter ->wss://X:443/X-qa/_blipsync @0x7fd76dc70908
14:43:27.629706| [Sync]: {Inserter#107} Inserted 10 revs in 4.37ms ( 2287/sec) of which 99.7% was commit
TLS: >>> BIO returning MBEDTLS_ERR_SSL_WANT_READ
TLS: >>> mbedtls_socket returning EWOULDBLOCK
14:43:27.692882| [WS]: {BuiltInWebSocket#108}==> litecore::websocket::BuiltInWebSocket wss://X:443/X-qa/_blipsync @0x7fd76dc6a1a0
14:43:27.692905| [WS] WARNING: {BuiltInWebSocket#108} Unexpected or unclean socket disconnect! (reason=errno, code=0)
14:43:27.692958| [Sync]: {Repl#98} Connection closed with WebSocket status 1006: "" (state=2)
14:43:27.693015| [Sync] ERROR: {Repl#98} Got LiteCore error: WebSocket error 1006 "connection closed abnormally"
14:43:27.713996| [Sync]: {Inserter#107} Inserted 8 revs in 1.63ms ( 4906/sec) of which 99.3% was commit
14:43:27.726504| [Sync] ERROR: {C4Replicator#99} State: busy, progress=72.00%, error=WebSocket error 1006 "connection closed abnormally"
If I try a TLS replication using any replication settings, however, replication does not start and the error is different. Here are examples using username/password authentication or replication for a specific channel. All of the endpoints being used are valid for sure.
Username/password:
14:45:03.302449| [Sync]: {Repl#127} Pull=continuous, Options={{auth:{password:"********", username:"X"}}}
14:45:03.302557| [Sync]: {C4Replicator#128}==> c4Internal::C4RemoteReplicator 0x7fd76fa1f6f0 @0x7fd76fa1f6f0
14:45:03.302574| [Sync]: {C4Replicator#128} Starting Replicator {Repl#127}
14:45:03.306847| [Sync]: {Repl#127} Scanning for pre-existing conflicts...
14:45:03.306888| [Sync]: {Repl#127} Found 0 conflicted docs in 0.004 sec
14:45:03.307861| [Sync]: {Repl#127} No local checkpoint 'cp-nEFf3hlcC8OkYXWTw6aTInjD0BQ='
14:45:03.904799| [WS]: {BuiltInWebSocket#129}==> litecore::websocket::BuiltInWebSocket wss://X:443/X/_blipsync @0x7fd76fa1faa0
14:45:03.904830| [WS] WARNING: {BuiltInWebSocket#129} Unexpected or unclean socket disconnect! (reason=WebSocket status, code=401)
14:45:03.904922| [Sync]: {Repl#127} Connection closed with WebSocket status 401: "(unknown HTTP status)" (state=1)
14:45:03.905021| [Sync] ERROR: {Repl#127} Got LiteCore error: WebSocket error 401 "(unknown HTTP status)"
14:45:03.905049| [Sync] ERROR: {C4Replicator#128} State: connecting, progress=0.00%, error=WebSocket error 401 "(unknown HTTP status)"
Specific channel:
14:47:03.952163| [Sync]: {Repl#137} Pull=continuous, Options={{channels:["X"]}}
14:47:03.952250| [Sync]: {C4Replicator#138}==> c4Internal::C4RemoteReplicator 0x7fd76dcbdff0 @0x7fd76dcbdff0
14:47:03.952264| [Sync]: {C4Replicator#138} Starting Replicator {Repl#137}
14:47:03.952473| [Sync]: {Repl#137} Scanning for pre-existing conflicts...
14:47:03.956809| [Sync]: {Repl#137} Found 0 conflicted docs in 0.004 sec
14:47:03.957219| [Sync]: {Repl#137} No local checkpoint 'cp-GMTjAMBpyDuxd0rl7szz4LWh0vw='
14:47:04.505299| [WS]: {BuiltInWebSocket#139}==> litecore::websocket::BuiltInWebSocket wss://X:443/X/_blipsync @0x7fd76dcd4720
14:47:04.505324| [WS] WARNING: {BuiltInWebSocket#139} Unexpected or unclean socket disconnect! (reason=WebSocket status, code=401)
14:47:04.505369| [Sync]: {Repl#137} Connection closed with WebSocket status 401: "(unknown HTTP status)" (state=1)
14:47:04.505419| [Sync] ERROR: {Repl#137} Got LiteCore error: WebSocket error 401 "(unknown HTTP status)"
14:47:04.505464| [Sync] ERROR: {C4Replicator#138} State: connecting, progress=0.00%, error=WebSocket error 401 "(unknown HTTP status)"
This test for getting a non-existent element in the python test script is causing a crash.
Here is the backtrace from the segfault dump:
#0 0x00007f10457b30d8 in <lambda(C4Database*)>::operator() (__closure=<synthetic pointer>, __closure=<synthetic pointer>, c4db=<optimized out>)
at /home/XXX/Documents/couchbase-lite-C/src/CBLDocument.cc:46
#1 litecore::access_lock<c4Database*, std::recursive_mutex>::use<C4Document*, getC4Doc(CBLDatabase*, const string&, bool)::<lambda(C4Database*)> > (callback=..., this=0x562bd2e2b1b0)
at /home/XXX/Documents/couchbase-lite-C/vendor/couchbase-lite-core/LiteCore/Support/access_lock.hh:45
#2 getC4Doc (allRevisions=false, docID="foo", db=0x562bd2e2b1a0) at /home/XXX/Documents/couchbase-lite-C/src/CBLDocument.cc:40
#3 CBLDocument::CBLDocument (this=0x562bd2d978f0, db=0x562bd2e2b1a0, docID="foo", isMutable=false, allRevisions=<optimized out>) at /home/XXX/Documents/couchbase-lite-C/src/CBLDocument.cc:79
#4 0x00007f10457b3f95 in getDocument (db=0x562bd2e2b1a0, docID=<optimized out>, isMutable=<optimized out>) at /usr/include/c++/9/bits/basic_string.h:263
#5 0x00007f1045b2706d in _cffi_f_CBLDatabase_GetDocument (self=<optimized out>, args=<optimized out>) at _PyCBL.c:2255
#6 0x0000562bd142fe67 in ?? ()
#7 0x0000000000000001 in ?? ()
#8 0x0000000000000002 in ?? ()
#9 0x0000000000000000 in ?? ()
Hi,
I just started a new project to expose couchbase-lite-c as Rust bindings here: https://github.com/jeromebenois/couchbase-lite-c-rs
And I have a segfault (here https://github.com/jeromebenois/couchbase-lite-c-rs/blob/d5c7f444e5982ea59f10043f4b6585433b0d78f3/couchbase-lite-c/src/document.rs#L61) when I call FLSlot_SetString in order to add a new property in existing document loaded from database.
It works when I update existing property from document loaded from database.
And It works also when I add a new property in a new document (here : https://github.com/jeromebenois/couchbase-lite-c-rs/blob/d5c7f444e5982ea59f10043f4b6585433b0d78f3/couchbase-lite-c/src/document.rs#L90)
Can you help me please?
Regards,
Jérôme.
I'm trying to install it on Ubuntu 18.04
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.