td
td copied to clipboard
No such function: sqlcipher_export
Hello! I have golang application with: go-tdlib gorm.io/gorm gorm.io/driver/sqlite
And if I specify tdlibparams: UseMessageDatabase: true, UseFileDatabase: true, UseChatInfoDatabase: true,
Then get errors:
Destroy bad SQLite database because of [Error : 0 : [query:SELECT sqlcipher_export('encrypted')] to database "/go-telegram/accounts-data/89166459517/tdlib-db/db.sqlite" failed: no such function: sqlcipher_export]
If I remove grom from project, then error disappears Or if I change tdlibparams database:false, then also error disappears.
But I need use tdlib databases and I need use gorm in one project please help me =)
SQLCipher, used by TDLib, conflicts with SQLite, used by gorm. They can't be linked in the same executable on Linux. You can move to Windows, or try to build gorm without SQLite support, if this is possible.
As levlam said, you shouldn't linked with gorm and TDLib together.
So your LDFLAGS should be like this or similar
//#cgo linux LDFLAGS: -L/usr/local/lib -ltdjson
As levlam said, you shouldn't linked with gorm and TDLib together. So your LDFLAGS should be like this or similar
//#cgo linux LDFLAGS: -L/usr/local/lib -ltdjson
Thank you for your answer! It's woring on macos (where I develop) But its not working on linux (linux server), after try run app I get a lot of errors:
Error loading shared library libstdc++.so.6: No such file or directory (needed by ./build/linux/dist/go-tg-forwarder) Error relocating ./build/linux/dist/go-tg-forwarder: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9push_backEc: symbol not found Error relocating ./build/linux/dist/go-tg-forwarder: _ZNSi4readEPcl: symbol not found Error relocating ./build/linux/dist/go-tg-forwarder: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6resizeEmc: symbol not found Error relocating ./build/linux/dist/go-tg-forwarder: _ZSt18_Rb_tree_incrementPKSt18_Rb_tree_node_base: symbol not found Error relocating ./build/linux/dist/go-tg-forwarder: ZNSi10_M_extractIdEERSiRT: symbol not found Error relocating ./build/linux/dist/go-tg-forwarder: _ZNSt13random_device7_M_initERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE: symbol not found Error relocating ./build/linux/dist/go-tg-forwarder: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE8_M_eraseEmm: symbol not found Error relocating ./build/linux/dist/go-tg-forwarder: _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6substrEmm: symbol not found
/usr/lib/x86_64-linux-gnu/libstdc++.so.6 exists
Weird, how about //#cgo linux LDFLAGS: -L/usr/local/lib -ltdjson -lstdc++
?
Weird, how about
//#cgo linux LDFLAGS: -L/usr/local/lib -ltdjson -lstdc++
?
I use that in previous attempt. I ran the following command:
RUN go build --ldflags "-extldflags '-L/usr/local/lib -ltdjson -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdactor -ltddb -ltdsqlite -ltdnet -ltdutils -ldl -lm -lssl -lcrypto -lstdc++ -lz'"
There should be no issues with linking of two different SQLite versions since TDLib 1.8.5.