smartnode/telebot

Does not compile statically

Closed this issue · 6 comments

When I try to build a static binary for echobot, linker fails with a lot of "undefined reference to symbol (libcurl, libjsonc functions)" errors.

describe your problem more. how are you trying to build echobot ?

gcc -static test/echobot.c -Iinclude libtelebot_static.a

/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: libtelebot_static.a(telebot.c.o): in function `telebot_get_updates':
telebot.c:(.text+0x272): undefined reference to `json_object_new_array'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: telebot.c:(.text+0x2bd): undefined reference to `json_object_new_string'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: telebot.c:(.text+0x2cf): undefined reference to `json_object_array_add'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: telebot.c:(.text+0x2ea): undefined reference to `json_object_to_json_string'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: telebot.c:(.text+0x383): undefined reference to `json_object_put'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: telebot.c:(.text+0x39e): undefined reference to `json_object_put'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: telebot.c:(.text+0x3e0): undefined reference to `json_object_object_get_ex'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: telebot.c:(.text+0x3f0): undefined reference to `json_object_get_boolean'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: telebot.c:(.text+0x41f): undefined reference to `json_object_object_get_ex'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: telebot.c:(.text+0x4d1): undefined reference to `json_object_put'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: libtelebot_static.a(telebot.c.o): in function `telebot_get_me':
telebot.c:(.text+0x738): undefined reference to `json_object_object_get_ex'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: telebot.c:(.text+0x748): undefined reference to `json_object_get_boolean'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: telebot.c:(.text+0x774): undefined reference to `json_object_object_get_ex'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: telebot.c:(.text+0x7bc): undefined reference to `json_object_put'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: libtelebot_static.a(telebot.c.o): in function `telebot_get_webhook_info':
telebot.c:(.text+0xb7c): undefined reference to `json_object_object_get_ex'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: telebot.c:(.text+0xb8c): undefined reference to `json_object_get_boolean'

And there are about 150 such errors

Any updates on this?

You need static versions of libcurl and json-c for that.