Search code examples
cmakefilecygwintelegram

How to Compile telegram-cli in windows by cygwin?


I have Installed the complete cygwin packages and I have done the steps mentioned in this guide Link The guide is like this:

...

Then, go to tg directory then generate Makefile.

 cd tg
 ./configure

We need to patch Makefile and loop.c to compile in cygwin. Download this patch then untar. Then, patch in tg directory.

 patch -p1 < telegram-cli-cygwin.patch

Then make

After compile is done, telegram-cli.exe will be generated in bin directory.

To run telegram-cli, type

 bin/telegram-cli -k tg-server.pub

Caution: A binary compiled with Cygwin should be run in Cygwin Terminal.

I have done the all the steps successfully but when I patch the make file and the loop.c it says:

$ patch -p1 < telegram-cli-cygwin.patch
patching file Makefile
Hunk #1 succeeded at 4 with fuzz 2.
patching file loop.c
Hunk #1 FAILED at 383.
Hunk #2 succeeded at 739 with fuzz 2 (offset 105 lines).
1 out of 2 hunks FAILED -- saving rejects to file loop.c.rej

And for the next step when it says 'Then make' I have tried using the command "./configure" I dont know if I am doing this right? And after executing the command:

bin/telegram-cli -k tg-server.pub

It says :

$ bin/telegram-cli -k tg-server.pub
-bash: bin/telegram-cli: No such file or directory

And It is right because there is no exe file created to be run. I would appreciate Any help.


Solution

  • I applied the patches manually after configure as @kaylum mentioned. It has to be after the configure command because the make file has to patched too and the configure command affects the make file. after that the make or make all command has to executed and the .exe file is created.