Closed azkadev closed 3 years ago
Try apt install zlib1g-dev
now error change
[ 0%] Building C object td/sqlite/CMakeFiles/tdsqlite.dir/sqlite/sqlite3.c.o/home/azka/telegram-bot-api/td/sqlite/sqlite/sqlite3.c:22572:10: fatal error: 'openssl/opensslv.h' file not found
#include <openssl/opensslv.h>
^~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [td/sqlite/CMakeFiles/tdsqlite.dir/build.make:63: td/sqlite/CMakeFiles/tdsqlite.dir/sqlite/sqlite3.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1301: td/sqlite/CMakeFiles/tdsqlite.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
apt-get install make git zlib1g-dev libssl-dev gperf cmake g++
apt-get install make git zlib1g-dev libssl-dev gperf cmake g++
I have installed it, but still error
https://github.com/tdlib/telegram-bot-api/issues/180#issuecomment-915443826
please help me i am very newbie in cpp language code
Why do you want to build the Bot API server for Android? How do you plan to run it there?
Why do you want to build the Bot API server for Android? How do you plan to run it there?
I want to build for android because I want to run my bot 24 hours on android, I have a pc but it will cost money, I will run the bot via termux, termux can run any code language like pc
I don't recommend you to run bot api server in termux. Try to use any other MTPROTO clients or just use the official one api.telegram.org.
Then the simplest way would be to build the server in the Termux itself.
But you will likely have a lot of issues with the local Bot API server on Termux. api.telegram.org cloud server would be much more suitable for a bot running on a phone.
I got an another error when I cross compile with NDK The error message:
D:/telegram-bot-api/telegram-bot-api/telegram-bot-api/Client.cpp:462:93: error: no member named 'textEntityTypeMediaTimestamp' in namespace 'td::td_api'; did you mean 'textEntityTypeMentionName'?
if (entity_type != td_api::textEntityTypeBankCardNumber::ID && entity_type != td_api::textEntityTypeMediaTimestamp::ID) {
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
textEntityTypeMentionName
D:/telegram-bot-api/telegram-bot-api/td/td/generate/auto\td/telegram/td_api.h:32144:7: note: 'textEntityTypeMentionName' declared here
class textEntityTypeMentionName final : public TextEntityType {
^
D:/telegram-bot-api/telegram-bot-api/telegram-bot-api/Client.cpp:1842:18: error: no member named 'messageChatSetTheme' in namespace 'td::td_api'; did you mean 'messageChatSetTtl'?
case td_api::messageChatSetTheme::ID:
~~~~~~~~^~~~~~~~~~~~~~~~~~~
messageChatSetTtl
D:/telegram-bot-api/telegram-bot-api/td/td/generate/auto\td/telegram/td_api.h:19626:7: note: 'messageChatSetTtl' declared here
class messageChatSetTtl final : public MessageContent {
^
D:/telegram-bot-api/telegram-bot-api/telegram-bot-api/Client.cpp:1842:10: error: duplicate case value 'ID'
case td_api::messageChatSetTheme::ID:
^
D:/telegram-bot-api/telegram-bot-api/telegram-bot-api/Client.cpp:1827:10: note: previous case defined here
case td_api::messageChatSetTtl::ID: {
^
D:/telegram-bot-api/telegram-bot-api/telegram-bot-api/Client.cpp:8926:18: error: no member named 'messageChatSetTheme' in namespace 'td::td_api'; did you mean 'messageChatSetTtl'?
case td_api::messageChatSetTheme::ID:
~~~~~~~~^~~~~~~~~~~~~~~~~~~
messageChatSetTtl
D:/telegram-bot-api/telegram-bot-api/td/td/generate/auto\td/telegram/td_api.h:19626:7: note: 'messageChatSetTtl' declared here
class messageChatSetTtl final : public MessageContent {
^
4 errors generated.
ninja: build stopped: subcommand failed.
I already build a zlib and openssl which works on termux. configuration:
cmake -DCMAKE_TOOLCHAIN_FILE=C:/android-ndk-r23/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=21 -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=E:/android -DCMAKE_INSTALL_PREFIX=E:/android -DCMAKE_FIND_ROOT_PATH=E:/android ../telegram-bot-api
Looks like just missing some generated files.
I remove all CMAKE_CROSSCOMPILING
check in cmake files and copy some tools in native build directory to specify location.
Now I got a working executable.
@lifegpc The errors mean that you updated Bot API source code, but doesn't regenerated autogenerated source files via native build.
I tried to compile telegram bot api to android but after finishing the file is up to 300 mb is this normal?
I tried to compile telegram bot api to android but after finishing the file is up to 300 mb is this normal?
You need strip it because it contains debug symbols.
You need strip it because it contains debug symbols. I tried compiling with this command, but the results are great, is there another trick to make the file
cmake -DCMAKE_TOOLCHAIN_FILE=/home/azkadev/android/ndk/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=29 -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/home/azkadev/android/ndk/build/cmake -DCMAKE_INSTALL_PREFIX=/home/azkadev/android/ndk/build/cmake -DCMAKE_FIND_ROOT_PATH=/home/azkadev/android/ndk/build/cmake ..
@azkadev You can find llvm-strip
in NDK binary directory.
Then call it with:
<path_to_llvm_strip> telegram-bot-api
@azkadev You can find
llvm-strip
in NDK binary directory. Then call it with:<path_to_llvm_strip> telegram-bot-api
Wow you are amazing, thank you very much, now I can build telegram-bot-api for android because of you
I tried to build for android on linux debian 10 intel 64 bit but there is a failure
I have installed all the required packages but when I type this command a log appears
error log