kenorb-contrib / tg

`telegram-cli` for Telegram IM
https://github.com/telegramdesktop/tdesktop
GNU General Public License v2.0
386 stars 53 forks source link

dpkg-buildpackage -3 fails to create telegram in /usr/local/bin (cannot stat) #14

Closed naryfa closed 4 years ago

naryfa commented 4 years ago

Hi, I apologize if I sound too noob, but this is the problem I am having on Mint 19 with all deps satisfied:

a - objs/crypto/err_openssl.o a - objs/crypto/err_altern.o a - objs/auto/auto-skip.o a - objs/auto/auto-fetch.o a - objs/auto/auto-store.o a - objs/auto/auto-autocomplete.o a - objs/auto/auto-types.o a - objs/auto/auto-fetch-ds.o a - objs/auto/auto-free-ds.o a - objs/auto/auto-store-ds.o a - objs/auto/auto-print-ds.o 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 -Wl,-Bsymbolic-functions -Wl,-z,relro -L/usr/local/lib -L/usr/lib -L/usr/lib -rdynamic -ggdb -levent -ljansson -lconfig -lz -lgcrypt -levent -lreadline -llua5.2 -lm -ldl -lpthread -lutil -ldl -o bin/telegram-cli make[1]: Leaving directory '/home/mint/Downloads/tg' dh_auto_test rm server.pub debian/rules binary cp tg-server.pub server.pub dh binary --with autotools-dev dh: The autotools-dev sequence is deprecated and replaced by dh in debhelper (>= 9.20160115) dh: This feature will be removed in compat 12. dh_testroot dh_prep rm -f -- debian/telegram-cli.substvars rm -fr -- debian/.debhelper/generated/telegram-cli/ debian/telegram-cli/ debian/tmp/ dh_auto_install install -d debian/telegram-cli make -j1 install DESTDIR=/home/mint/Downloads/tg/debian/telegram-cli AM_UPDATE_INFO_DIR=no make[1]: Entering directory '/home/mint/Downloads/tg' install telegram /usr/local/bin install: cannot stat 'telegram': No such file or directory Makefile:69: recipe for target 'install' failed make[1]: [install] Error 1 make[1]: Leaving directory '/home/mint/Downloads/tg' dh_auto_install: make -j1 install DESTDIR=/home/mint/Downloads/tg/debian/telegram-cli AM_UPDATE_INFO_DIR=no returned exit code 2 debian/rules:17: recipe for target 'binary' failed make: [binary] Error 2 dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2

any ideas?

karawitan commented 4 years ago

Hi, please look at the 2 following lines:

The build process has compiled a "telegram-cli" binary as you see below with the "-o bin/telegram-cli"

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 -Wl,-Bsymbolic-functions -Wl,-z,relro -L/usr/local/lib -L/usr/lib -L/usr/lib -rdynamic -ggdb -levent -ljansson -lconfig -lz -lgcrypt -levent -lreadline -llua5.2 -lm -ldl -lpthread -lutil -ldl -o bin/telegram-cli

Now the install part looks for a "telegram" binary .. hence the

make[1]: Entering directory '/home/mint/Downloads/tg'
install telegram /usr/local/bin
 

Therefore, you get the error message; "install: cannot stat 'telegram': No such file or directory"

karawitan commented 4 years ago

I hit the same issue when building on debian:buster .. Will try to check what's going on

karawitan commented 4 years ago

Currently working on a personnal branch to fix this issue https://github.com/kenorb-contrib/tg/compare/master...berryamin:update-debian-packaging

naryfa commented 4 years ago

Terrific, thank you for such fast response and effort. Will you upload the updated version to GitHub?

karawitan commented 4 years ago

I might open a Pull Request to fix the debian packaging issue, but more needs to be done on this, so it might take time. Meanwhile, you may do the following to have the updated version:

cd /tmp

# clone the original tg repository (without history)
git clone  --recursive  https://github.com/kenorb-contrib/tg.git --depth 1
cd tg

# define another remote copy of the git repository
git remote add berryamin   https://github.com/berryamin/tg.git

# fetch a specific branch from "berryamin" remote repository
git fetch berryamin update-debian-packaging

# checkout the branch
git checkout  update-debian-packaging

dpkg-buildpackage -b

# see the resulting packages
ls -l /tmp/*deb

# next step is to
sudo dpkg -i /tmp/.deb

I hope everything will work.

naryfa commented 4 years ago

I hate to break it but... no, dpkg-buildpackage -b produces:

make[1]: Leaving directory '/tmp/tg' dh_auto_build make -j1 make[1]: Entering directory '/tmp/tg' make[1]: No rule to make target 'tgl/scheme.tl', needed by 'auto/scheme.tl'. Stop. make[1]: Leaving directory '/tmp/tg' dh_auto_build: make -j1 returned exit code 2 debian/rules:22: recipe for target 'build' failed make: [build] Error 2 dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2

karawitan commented 4 years ago

Hmm my mistake, please use "--recursive" when performing the clone step. I've updated the previous post accordingly.

naryfa commented 4 years ago

OK, this time it progressed more, but it seems to have failed on signing, is that a problem?

make[1]: Leaving directory '/tmp/tg' dh_auto_build make -j1 make[1]: Entering directory '/tmp/tg' make[1]: No rule to make target 'tgl/scheme.tl', needed by 'auto/scheme.tl'. Stop. make[1]: Leaving directory '/tmp/tg' dh_auto_build: make -j1 returned exit code 2 debian/rules:22: recipe for target 'build' failed make: [build] Error 2 dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2

karawitan commented 4 years ago

Signing issue does not seem to be a problem, I hit it also, but packages were built anyway. But it seems that you still don't have the right content below tgl/ Please fix it with cd /tmp/tg git clone https://github.com/vysheng/tgl.git

naryfa commented 4 years ago

I've redone all the steps you mentioned, signing failed but it built the packages:

-rw-r--r-- 1 mint mint 846032 Mar 30 13:40 /tmp/telegram-cli_1.0.6-1_amd64.deb -rw-r--r-- 1 mint mint 1861320 Mar 30 13:40 /tmp/telegram-cli-dbgsym_1.0.6-1_amd64.ddeb

Then I did: sudo dpkg -i /tmp/*.deb

And it installed, but won't send me a code.

PS. I have to see why one of the packages built is .ddeb, as opposed to .deb

OK, I've removed all traces of telegram from my system, re-done your instructions, renamed .ddeb to .deb and upon issuing sudo dpkg -i /tmp/*.deb I get this:

pkg: warning: files list file for package 'telegram-cli' missing; assuming package has no files currently installed dpkg: warning: files list file for package 'telegram-cli-dbgsym' missing; assuming package has no files currently installed (Reading database ... 350977 files and directories currently installed.) Preparing to unpack .../telegram-cli_1.0.6-1_amd64.deb ... The system user `telegramd' already exists. Exiting. Unpacking telegram-cli (1.0.6-1) over (1.0.6-1) ... Preparing to unpack .../telegram-cli-dbgsym_1.0.6-1_amd64.deb ... Unpacking telegram-cli-dbgsym (1.0.6-1) over (1.0.6-1) ... Setting up telegram-cli (1.0.6-1) ... Setting up telegram-cli-dbgsym (1.0.6-1) ... Processing triggers for ureadahead (0.100.0-21) ... Processing triggers for man-db (2.8.3-2ubuntu0.1) ...

The program will launch, ask me for the phone number, I'll enter it the same way I entered in the old telegram-cli build from 6 years ago, but it won' send me the auth code...

karawitan commented 4 years ago

Hmm looks strange, working great here..

naryfa commented 4 years ago

OK, I got it.

Thank you for all the help.

PS. My bad for not realizing the second .deb was for debug symbols, perhaps purposely named .ddeb for the time of need.

karawitan commented 4 years ago

15