vysheng / tg

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

make fails with "multiple definitions" #1692

Open infoparticle opened 3 years ago

infoparticle commented 3 years ago
>./configure --disable-openssl --prefix=/usr CFLAGS="$CFLAGS -w"
...
>make
...
gcc objs/main.o objs/loop.o objs/interface.o objs/lua-tg.o objs/json-tg.o objs/python-tg.o objs/python-types.o libs/libtgl.a -L/usr/local/lib -L/usr/lib -L/usr/lib  -rdynamic -ggdb -levent -ljansson -lconfig -lz -lgcrypt -levent   -lreadline -llua-5.4  -lm -ldl  -ldl -lpthread -lutil -o bin/telegram-cli
/usr/bin/ld: objs/loop.o:/root/admin/tg/loop.c:77: multiple definition of `verbosity'; objs/main.o:/root/admin/tg/main.c:93: first defined here
/usr/bin/ld: objs/loop.o:/root/admin/tg/loop.c:90: multiple definition of `register_mode'; objs/main.o:/root/admin/tg/main.c:508: first defined here
/usr/bin/ld: objs/loop.o:/root/admin/tg/loop.c:392: multiple definition of `wait_dialog_list'; objs/main.o:/root/admin/tg/main.c:510: first defined here
/usr/bin/ld: objs/interface.o:/root/admin/tg/interface.c:120: multiple definition of `disable_auto_accept'; objs/main.o:/root/admin/tg/main.c:509: first defined here
/usr/bin/ld: objs/interface.o:/root/admin/tg/interface.c:121: multiple definition of `msg_num_mode'; objs/main.o:/root/admin/tg/main.c:94: first defined here
/usr/bin/ld: objs/interface.o:/root/admin/tg/interface.c:122: multiple definition of `permanent_msg_id_mode'; objs/main.o:/root/admin/tg/main.c:122: first defined here
/usr/bin/ld: objs/interface.o:/root/admin/tg/interface.c:123: multiple definition of `permanent_peer_id_mode'; objs/main.o:/root/admin/tg/main.c:123: first defined here
/usr/bin/ld: objs/interface.o:/root/admin/tg/interface.c:124: multiple definition of `disable_colors'; objs/main.o:/root/admin/tg/main.c:110: first defined here
/usr/bin/ld: objs/interface.o:/root/admin/tg/interface.c:133: multiple definition of `readline_active'; objs/loop.o:/root/admin/tg/loop.c:390: first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:51: bin/telegram-cli] Error 1

I tried compiling tg in fedora 33 but it fails.

Zambito1 commented 3 years ago

I am having the same issue compiling on Arch Linux.

csurf commented 3 years ago

this seems to be a problem with the makefile / linking process. I'm having the same issue on Fedora 33.

Has this project been abandoned???

Gena00X commented 3 years ago

I did as it is written in this article https://github.com/vysheng/tg/blob/master/README-Cygwin.md Have error «dereferencing pointer to incomplete type ‘RSA {aka struct rsa_st}’» next I apply this path https://github.com/vysheng/tgl/issues/129 have error «multiple definition»:

gcc objs/main.o objs/loop.o objs/interface.o objs/lua-tg.o objs/json-tg.o objs/python-tg.o objs/python-types.o libs/libtgl.a -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -rdynamic -ggdb -levent -ljansson -lconfig -lz -levent -lreadline -llua5.3 -lssl -lcrypto -ldl -lpthread -lutil -o bin/telegram-cli /usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: objs/loop.o:/home/79031/tg/loop.c:77: multiple definition of “verbosity”; objs/main.o:/home/79031/tg/main.c:93: first defined here /usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: objs/loop.o:/home/79031/tg/loop.c:392: multiple definition of “wait_dialog_list”; objs/main.o:/home/79031/tg/main.c:510: first defined here /usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: objs/loop.o:/home/79031/tg/loop.c:90: multiple definition of “register_mode”; objs/main.o:/home/79031/tg/main.c:508: first defined here /usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: objs/interface.o:/home/79031/tg/interface.c:121: multiple definition of “msg_num_mode”; objs/main.o:/home/79031/tg/main.c:94: first defined here /usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: objs/interface.o:/home/79031/tg/interface.c:133: multiple definition of “readline_active”; objs/loop.o:/home/79031/tg/loop.c:390: first defined here /usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: objs/interface.o:/home/79031/tg/interface.c:124: multiple definition of “disable_colors”; objs/main.o:/home/79031/tg/main.c:110: first defined here /usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: objs/interface.o:/home/79031/tg/interface.c:123: multiple definition of “permanent_peer_id_mode”; objs/main.o:/home/79031/tg/main.c:123: first defined here /usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: objs/interface.o:/home/79031/tg/interface.c:120: multiple definition of “disable_auto_accept”; objs/main.o:/home/79031/tg/main.c:509: first defined here /usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: objs/interface.o:/home/79031/tg/interface.c:122: multiple definition of “permanent_msg_id_mode”; objs/main.o:/home/79031/tg/main.c:122: first defined here collect2: error: ld returned 1 exit status make: *** [Makefile:51: bin/telegram-cli] Error 1

MN1ce commented 2 years ago

same issue here on Raspberry Pi 3 B+: Linux version 5.10.63-v7+ (dom@buildbot) (arm-linux-gnueabihf-gcc-8 (Ubuntu/Linaro 8.4.0-3ubuntu1) 8.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) ..1488 SMP Thu Nov 18 16:14:44 GMT 2021

in former time, approx. 4 years ago it works on the same machine, but older os, like described in README

Paulchen232 commented 2 years ago

@infoparticle I found this on https://aur.archlinux.org/packages/telegram-cli-git/?O=0&PP=10 "I got it working by replacing ./configure with ./configure CFLAGS="-w". Might not be the best solution, since this will ignore all compiler warnings"

horamsafaryani commented 1 year ago

@infoparticle I found this on https://aur.archlinux.org/packages/telegram-cli-git/?O=0&PP=10 "I got it working by replacing ./configure with ./configure CFLAGS="-w". Might not be the best solution, since this will ignore all compiler warnings"

i still get this error gcc objs/main.o objs/loop.o objs/interface.o objs/lua-tg.o objs/json-tg.o objs/python-tg.o objs/python-types.o libs/libtgl.a -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/telegram-cli /usr/bin/ld: objs/loop.o:/home/self/tg/loop.c:77: multiple definition of verbosity'; objs/main.o:/home/self/tg/main.c:93: first defined here /usr/bin/ld: objs/loop.o:/home/self/tg/loop.c:90: multiple definition ofregister_mode'; objs/main.o:/home/self/tg/main.c:508: first defined here /usr/bin/ld: objs/loop.o:/home/self/tg/loop.c:392: multiple definition of wait_dialog_list'; objs/main.o:/home/self/tg/main.c:510: first defined here /usr/bin/ld: objs/interface.o:/home/self/tg/interface.c:120: multiple definition ofdisable_auto_accept'; objs/main.o:/home/self/tg/main.c:509: first defined here /usr/bin/ld: objs/interface.o:/home/self/tg/interface.c:121: multiple definition of msg_num_mode'; objs/main.o:/home/self/tg/main.c:94: first defined here /usr/bin/ld: objs/interface.o:/home/self/tg/interface.c:122: multiple definition ofpermanent_msg_id_mode'; objs/main.o:/home/self/tg/main.c:122: first defined here /usr/bin/ld: objs/interface.o:/home/self/tg/interface.c:123: multiple definition of permanent_peer_id_mode'; objs/main.o:/home/self/tg/main.c:123: first defined here /usr/bin/ld: objs/interface.o:/home/self/tg/interface.c:124: multiple definition ofdisable_colors'; objs/main.o:/home/self/tg/main.c:110: first defined here /usr/bin/ld: objs/interface.o:/home/self/tg/interface.c:133: multiple definition of `readline_active'; objs/loop.o:/home/self/tg/loop.c:390: first defined here collect2: error: ld returned 1 exit status make: *** [Makefile:51: bin/telegram-cli] Error 1

can u help? ty

anvial commented 2 months ago

up