vysheng / tg

telegram-cli
GNU General Public License v2.0
6.49k stars 1.54k forks source link

"Make" fails on Ubuntu 20.04 #1789

Open lifeboy opened 1 year ago

lifeboy commented 1 year ago

The bottom line seems to be this:

tgl/queries.c: In function ‘_tgl_do_send_photo’:
tgl/queries.c:2091:10: error: cast between incompatible function types from ‘void (*)(struct tgl_state *, void *, int,  struct tgl_message *)’ to ‘void (*)(struct tgl_state *, void *, int)’ [-Werror=cast-function-type]
 2091 |         ((void (*)(struct tgl_state *, void *, int))callback) (TLS, callback_extra, 0);

The full output is:

/opt/telegram/tg# make
cat tgl/scheme.tl tgl/encrypted_scheme.tl tgl/binlog.tl tgl/append.tl tgl/mtproto.tl > auto/scheme.tl
gcc -I. -I. -I./tgl -g -O2  -I/usr/local/include -I/usr/include -I/usr/include -I/usr/include/lua5.2  -DHAVE_CONFIG_H -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC -iquote ./tgl/tl-parser -c -MP -MD -MF dep/tl-parser.d -MQ objs/tl-parser.o -o objs/tl-parser.o tgl/tl-parser/tl-parser.c
gcc -I. -I. -I./tgl -g -O2  -I/usr/local/include -I/usr/include -I/usr/include -I/usr/include/lua5.2  -DHAVE_CONFIG_H -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC -iquote ./tgl/tl-parser -c -MP -MD -MF dep/tlc.d -MQ objs/tlc.o -o objs/tlc.o tgl/tl-parser/tlc.c
gcc objs/tl-parser.o objs/tlc.o -L/usr/local/lib -L/usr/lib -L/usr/lib  -rdynamic -ggdb -levent -ljansson -lconfig -lz -levent   -lreadline -llua5.2  -lm -ldl -lssl -lcrypto -ldl -lpthread -lutil -o bin/tl-parser
bin/tl-parser -e auto/scheme.tlo auto/scheme.tl
gcc -I. -I. -I./tgl -g -O2  -I/usr/local/include -I/usr/include -I/usr/include -I/usr/include/lua5.2  -DHAVE_CONFIG_H -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC -iquote ./tgl -c -MP -MD -MF dep/generate.d -MQ objs/generate.o -o objs/generate.o tgl/generate.c
gcc -I. -I. -I./tgl -g -O2  -I/usr/local/include -I/usr/include -I/usr/include -I/usr/include/lua5.2  -DHAVE_CONFIG_H -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC -iquote ./tgl -c -MP -MD -MF dep/tools.d -MQ objs/tools.o -o objs/tools.o tgl/tools.c
gcc -I. -I. -I./tgl -g -O2  -I/usr/local/include -I/usr/include -I/usr/include -I/usr/include/lua5.2  -DHAVE_CONFIG_H -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC -iquote ./tgl -c -MP -MD -MF dep/crypto/rand_openssl.d -MQ objs/crypto/rand_openssl.o -o objs/crypto/rand_openssl.o tgl/crypto/rand_openssl.c
gcc -I. -I. -I./tgl -g -O2  -I/usr/local/include -I/usr/include -I/usr/include -I/usr/include/lua5.2  -DHAVE_CONFIG_H -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC -iquote ./tgl -c -MP -MD -MF dep/crypto/rand_altern.d -MQ objs/crypto/rand_altern.o -o objs/crypto/rand_altern.o tgl/crypto/rand_altern.c
gcc -I. -I. -I./tgl -g -O2  -I/usr/local/include -I/usr/include -I/usr/include -I/usr/include/lua5.2  -DHAVE_CONFIG_H -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC -iquote ./tgl -c -MP -MD -MF dep/crypto/err_openssl.d -MQ objs/crypto/err_openssl.o -o objs/crypto/err_openssl.o tgl/crypto/err_openssl.c
gcc -I. -I. -I./tgl -g -O2  -I/usr/local/include -I/usr/include -I/usr/include -I/usr/include/lua5.2  -DHAVE_CONFIG_H -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC -iquote ./tgl -c -MP -MD -MF dep/crypto/err_altern.d -MQ objs/crypto/err_altern.o -o objs/crypto/err_altern.o tgl/crypto/err_altern.c
gcc objs/generate.o objs/tools.o objs/crypto/rand_openssl.o objs/crypto/rand_altern.o objs/crypto/err_openssl.o objs/crypto/err_altern.o -L/usr/local/lib -L/usr/lib -L/usr/lib  -rdynamic -ggdb -levent -ljansson -lconfig -lz -levent   -lreadline -llua5.2  -lm -ldl -lssl -lcrypto -ldl -lpthread -lutil -o bin/generate
bin/generate -g skip-header auto/scheme.tlo > auto/auto-skip.h  || ( rm auto/auto-skip.h && false )
bin/generate -g fetch-header auto/scheme.tlo > auto/auto-fetch.h  || ( rm auto/auto-fetch.h && false )
bin/generate -g store-header auto/scheme.tlo > auto/auto-store.h  || ( rm auto/auto-store.h && false )
bin/generate -g autocomplete-header auto/scheme.tlo > auto/auto-autocomplete.h  || ( rm auto/auto-autocomplete.h && false )
bin/generate -g types-header auto/scheme.tlo > auto/auto-types.h  || ( rm auto/auto-types.h && false )
bin/tl-parser -E auto/scheme.tl 2> auto/scheme2.tl  || ( cat auto/scheme2.tl && rm auto/scheme2.tl && false )
awk -f ./tgl/gen_constants_h.awk < auto/scheme2.tl > auto/constants.h
bin/generate -g fetch-ds-header auto/scheme.tlo > auto/auto-fetch-ds.h  || ( rm auto/auto-fetch-ds.h && false )
bin/generate -g free-ds-header auto/scheme.tlo > auto/auto-free-ds.h  || ( rm auto/auto-free-ds.h && false )
bin/generate -g store-ds-header auto/scheme.tlo > auto/auto-store-ds.h  || ( rm auto/auto-store-ds.h && false )
bin/generate -g print-ds-header auto/scheme.tlo > auto/auto-print-ds.h  || ( rm auto/auto-print-ds.h && false )
gcc -I. -I. -I./tgl -g -O2  -I/usr/local/include -I/usr/include -I/usr/include -I/usr/include/lua5.2  -DHAVE_CONFIG_H -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC -c -MP -MD -MF dep/main.d -MQ objs/main.o -o objs/main.o main.c
gcc -I. -I. -I./tgl -g -O2  -I/usr/local/include -I/usr/include -I/usr/include -I/usr/include/lua5.2  -DHAVE_CONFIG_H -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC -c -MP -MD -MF dep/loop.d -MQ objs/loop.o -o objs/loop.o loop.c
gcc -I. -I. -I./tgl -g -O2  -I/usr/local/include -I/usr/include -I/usr/include -I/usr/include/lua5.2  -DHAVE_CONFIG_H -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC -c -MP -MD -MF dep/interface.d -MQ objs/interface.o -o objs/interface.o interface.c
gcc -I. -I. -I./tgl -g -O2  -I/usr/local/include -I/usr/include -I/usr/include -I/usr/include/lua5.2  -DHAVE_CONFIG_H -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC -c -MP -MD -MF dep/lua-tg.d -MQ objs/lua-tg.o -o objs/lua-tg.o lua-tg.c
gcc -I. -I. -I./tgl -g -O2  -I/usr/local/include -I/usr/include -I/usr/include -I/usr/include/lua5.2  -DHAVE_CONFIG_H -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC -c -MP -MD -MF dep/json-tg.d -MQ objs/json-tg.o -o objs/json-tg.o json-tg.c
gcc -I. -I. -I./tgl -g -O2  -I/usr/local/include -I/usr/include -I/usr/include -I/usr/include/lua5.2  -DHAVE_CONFIG_H -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC -c -MP -MD -MF dep/python-tg.d -MQ objs/python-tg.o -o objs/python-tg.o python-tg.c
gcc -I. -I. -I./tgl -g -O2  -I/usr/local/include -I/usr/include -I/usr/include -I/usr/include/lua5.2  -DHAVE_CONFIG_H -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC -c -MP -MD -MF dep/python-types.d -MQ objs/python-types.o -o objs/python-types.o python-types.c
gcc -I. -I. -I./tgl -g -O2  -I/usr/local/include -I/usr/include -I/usr/include -I/usr/include/lua5.2  -DHAVE_CONFIG_H -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC -iquote ./tgl -c -MP -MD -MF dep/mtproto-common.d -MQ objs/mtproto-common.o -o objs/mtproto-common.o tgl/mtproto-common.c
gcc -I. -I. -I./tgl -g -O2  -I/usr/local/include -I/usr/include -I/usr/include -I/usr/include/lua5.2  -DHAVE_CONFIG_H -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC -iquote ./tgl -c -MP -MD -MF dep/mtproto-client.d -MQ objs/mtproto-client.o -o objs/mtproto-client.o tgl/mtproto-client.c
gcc -I. -I. -I./tgl -g -O2  -I/usr/local/include -I/usr/include -I/usr/include -I/usr/include/lua5.2  -DHAVE_CONFIG_H -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC -iquote ./tgl -c -MP -MD -MF dep/mtproto-key.d -MQ objs/mtproto-key.o -o objs/mtproto-key.o tgl/mtproto-key.c
gcc -I. -I. -I./tgl -g -O2  -I/usr/local/include -I/usr/include -I/usr/include -I/usr/include/lua5.2  -DHAVE_CONFIG_H -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC -iquote ./tgl -c -MP -MD -MF dep/queries.d -MQ objs/queries.o -o objs/queries.o tgl/queries.c
tgl/queries.c: In function ‘_tgl_do_send_photo’:
tgl/queries.c:2091:10: error: cast between incompatible function types from ‘void (*)(struct tgl_state *, void *, int,  struct tgl_message *)’ to ‘void (*)(struct tgl_state *, void *, int)’ [-Werror=cast-function-type]
 2091 |         ((void (*)(struct tgl_state *, void *, int))callback) (TLS, callback_extra, 0);
      |          ^
tgl/queries.c:2108:10: error: cast between incompatible function types from ‘void (*)(struct tgl_state *, void *, int,  struct tgl_message *)’ to ‘void (*)(struct tgl_state *, void *, int)’ [-Werror=cast-function-type]
 2108 |         ((void (*)(struct tgl_state *, void *, int))callback) (TLS, callback_extra, 0);
      |          ^
tgl/queries.c:2141:10: error: cast between incompatible function types from ‘void (*)(struct tgl_state *, void *, int,  struct tgl_message *)’ to ‘void (*)(struct tgl_state *, void *, int)’ [-Werror=cast-function-type]
 2141 |         ((void (*)(struct tgl_state *, void *, int))callback) (TLS, callback_extra, 0);
      |          ^
cc1: all warnings being treated as errors
make: *** [Makefile.tgl:20: objs/queries.o] Error 1
sh1nez commented 1 year ago

"cc1: all warnings being treated as errors" Try to del text '-Werror' in Makefile. im not sure but may help

justpeanuts commented 12 months ago

had similar error ; solved after following the instructions given in this comment: https://github.com/vysheng/tg/issues/1633#issuecomment-569247052

LiYunF commented 10 months ago

I'm using a Docker container with Ubuntu 18, and I've successfully installed it inside. You can refer to this link (translation of the webpage may be needed).https://nie11kun.github.io/archives/2310.html