Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support cygwin #45

Closed
ashtophet opened this issue Jan 28, 2014 · 14 comments
Closed

Support cygwin #45

ashtophet opened this issue Jan 28, 2014 · 14 comments

Comments

@ashtophet
Copy link

Hi!

Before the unashamed request, thank you very much for developing this program. I enjoy using it daily on GNU/Linux (Gentoo) and, ocassionally, on FreeBSD, so happy user here.

Do you plan to support cygwin at any near/far future?[1]

Cheers

[1] Now build fails at its early stages, due to execinfo.h missing...

@vysheng
Copy link
Owner

vysheng commented Jan 28, 2014

I can try to do anything, but I don't have any windows computers. Libexec is used only for backtrace, so it can be removed in cygwin version.

@ashtophet
Copy link
Author

Let¨s try something, abusing my non-existent habilities:

  • dos2unix -f configure
  • I've get rid of backtrace related code from main.c.
  • This error was given:
$ LC_ALL=C make
gcc -g -O2  -DHAVE_CONFIG_H -Wall -Wextra -Werror -Wno-deprecated -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -I. -I. -c main.c -o main.o
In file included from main.c:48:0:
interface.h:42:6: error: conflicting types for 'iprintf'
 void iprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2)));
      ^
In file included from /usr/include/stdio.h:29:0,
                 from main.c:24:
/usr/include/stdio.h:253:5: note: previous declaration of 'iprintf' was here
 int _EXFUN(iprintf, (const char *, ...)
     ^
Makefile:30: recipe for target 'main.o' failed
make: *** [main.o] Error 1

Solved by:

$ sed -i 's/iprintf/my_iprintf/g' *.c *.h
  • Now if fails with:
$ LC_ALL=C make
gcc -g -O2  -DHAVE_CONFIG_H -Wall -Wextra -Werror -Wno-deprecated -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -I. -I. -c net.c -o net.o
net.c: In function 'create_connection':
net.c:272:34: error: 'POLLRDHUP' undeclared (first use in this function)
   s.events = POLLOUT | POLLERR | POLLRDHUP | POLLHUP;
                                  ^
net.c:272:34: note: each undeclared identifier is reported only once for each function it appears in
net.c: In function 'connections_make_poll_array':
net.c:556:43: error: 'POLLRDHUP' undeclared (first use in this function)
       fds[0].events = POLLERR | POLLHUP | POLLRDHUP | POLLIN;
                                           ^
net.c: In function 'connections_poll_result':
net.c:580:47: error: 'POLLRDHUP' undeclared (first use in this function)
     if (fds[i].revents & (POLLHUP | POLLERR | POLLRDHUP)) {
                                               ^
Makefile:30: recipe for target 'net.o' failed
make: *** [net.o] Error 1

@vysheng
Copy link
Owner

vysheng commented Jan 29, 2014

Maybe I fixed this. Try again?

@ashtophet
Copy link
Author

Same error after commit e12d05b
Have the changes been committed? Since my first try just one commit reached the tree (the last one, regarding to a typo in readme).

@vysheng
Copy link
Owner

vysheng commented Jan 30, 2014

My bad, did not push them to github. No should be ok.

@ashtophet
Copy link
Author

$ LC_ALL=C make
gcc -g -O2 -DNO_BACKTRACE  -DHAVE_CONFIG_H -Wall -Wextra -Werror -Wno-deprecated -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -I. -I. -c main.c -o main.o~~~
main.c:420:2: error: #else without #if
 #else
  ^
main.c:424:2: error: #endif without #if
 #endif
  ^
Makefile:30: recipe for target 'main.o' failed
make: *** [main.o] Error 1

```
$ LC_ALL=C make
gcc -g -O2 -DNO_BACKTRACE  -DHAVE_CONFIG_H -Wall -Wextra -Werror -Wno-deprecated -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -I. -I. -c main.c -o main.o
gcc -g -O2 -DNO_BACKTRACE  -DHAVE_CONFIG_H -Wall -Wextra -Werror -Wno-deprecated -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -I. -I. -c loop.c -o loop.o
gcc -g -O2 -DNO_BACKTRACE  -DHAVE_CONFIG_H -Wall -Wextra -Werror -Wno-deprecated -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -I. -I. -c interface.c -o interface.o
gcc -g -O2 -DNO_BACKTRACE  -DHAVE_CONFIG_H -Wall -Wextra -Werror -Wno-deprecated -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -I. -I. -c net.c -o net.o
gcc -g -O2 -DNO_BACKTRACE  -DHAVE_CONFIG_H -Wall -Wextra -Werror -Wno-deprecated -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -I. -I. -c mtproto-common.c -o mtproto-common.o
gcc -g -O2 -DNO_BACKTRACE  -DHAVE_CONFIG_H -Wall -Wextra -Werror -Wno-deprecated -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -I. -I. -c mtproto-client.c -o mtproto-client.o
mtproto-client.c: In function 'rpc_execute':
mtproto-client.c:1715:35: error: 'TCP_QUICKACK' undeclared (first use in this function)
   setsockopt (c->fd, IPPROTO_TCP, TCP_QUICKACK, (int[]){0}, 4);
                                   ^
mtproto-client.c:1715:35: note: each undeclared identifier is reported only once for each function it appears in
mtproto-client.c: In function 'tc_becomes_ready':
mtproto-client.c:1773:35: error: 'TCP_QUICKACK' undeclared (first use in this function)
   setsockopt (c->fd, IPPROTO_TCP, TCP_QUICKACK, (int[]){0}, 4);
                                   ^
Makefile:30: recipe for target 'mtproto-client.o' failed
make: *** [mtproto-client.o] Error 1
```

@ashtophet
Copy link
Author

Added the following lines at mtproto-client.c

#ifndef TCP_QUICKACK
#define TCP_QUICKACK 0
#endif

and

$ LC_ALL=C make
gcc -g -O2 -DNO_BACKTRACE  -DHAVE_CONFIG_H -Wall -Wextra -Werror -Wno-deprecated -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -I. -I. -c mtproto-client.c -o mtproto-client.o
gcc -g -O2 -DNO_BACKTRACE  -DHAVE_CONFIG_H -Wall -Wextra -Werror -Wno-deprecated -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -I. -I. -c queries.c -o queries.o
gcc -g -O2 -DNO_BACKTRACE  -DHAVE_CONFIG_H -Wall -Wextra -Werror -Wno-deprecated -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -I. -I. -c structures.c -o structures.o
gcc -g -O2 -DNO_BACKTRACE  -DHAVE_CONFIG_H -Wall -Wextra -Werror -Wno-deprecated -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -I. -I. -c binlog.c -o binlog.o
gcc -g -O2 -DNO_BACKTRACE  -DHAVE_CONFIG_H -Wall -Wextra -Werror -Wno-deprecated -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -I. -I. -c tools.c -o tools.o
gcc -g -O2 -DNO_BACKTRACE  -DHAVE_CONFIG_H -Wall -Wextra -Werror -Wno-deprecated -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -I. -I. -c lua-tg.c -o lua-tg.o
gcc main.o loop.o interface.o net.o mtproto-common.o mtproto-client.o queries.o structures.o binlog.o tools.o lua-tg.o  -lm -lcrypto -lz -lssl -rdynamic -ggdb -lreadline -lrt -o telegram

@ashtophet
Copy link
Author

Builds fine, but:

$ ./telegram.exe -k tg.pub
Telegram-client version 0.01-beta, Copyright (C) 2013 Vitaly Valtman
Telegram-client comes with ABSOLUTELY NO WARRANTY; for details type `show_license'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show_license' for details.
[/home/USER/.telegram] created
libconfig not enabled
 *** Connect with 173.240.5.1:443 timeout
 *** Can not create connection to DC. Is network down?

We are behind a proxy here, I have $http_proxy and $https_proxy defined (w3m, wget, etc. work fine).

@vysheng
Copy link
Owner

vysheng commented Jan 30, 2014

quickack fixed.

I do not understand problems in main. Something strange. Maybe it merged bad with your backtrace fix?

At this moment client does not support http proxy, because it doesn't use http protocol. It's support is planned (it is not too hard after all) but I am not sure, when I can do it.

@ashtophet
Copy link
Author

Please, ignore the #else without #if error (maybe I've updated the repository too quick?).

Steps to reproduce it:
1.- dos2unix -f configure.
2.- ./configure --disable-libconfig --disable-liblua
3.- Remove #include <execinfo.h> at main.c
4.- Add the following lines at mtproto-client.c

#ifndef TCP_QUICKACK
#define TCP_QUICKACK 0
#endif

5.- Builds fine.
6.- No net connectivity due to proxy.

@vysheng
Copy link
Owner

vysheng commented Jan 30, 2014

#include <execinfo.h> fixed.

@ashtophet
Copy link
Author

Ok. So the "out-of-the-box" compilation works!
Thank you very much!
Case closed ;)

@vysheng vysheng closed this as completed Jan 30, 2014
@themegabyte
Copy link

@ashtophet Could you please outline the steps required for the compilation on windows. I am a newbie on windows compiling and don't know exactly where to start. Thanks!

@ashtophet
Copy link
Author

Hi,

Unfortunately I didn't writte down the appropriate steps and I don't have
access to a win machine right now. As I recall it:

  1. Install cygwin.
  2. Rerun cygwin setup.exe to install git and the cygwin build tools (
    http://x.cygwin.com/docs/cg/prog-build-prerequisites.html ).
  3. Run ./configure --disable-libconfig and see which library is missing.
    Search for it and install it on cygwin (there shouldn't be many).

Hope that helps in any way.

Cheers

Em terça-feira, 19 de maio de 2015, them3gabyte notifications@github.com
escreveu:

@ashtophet https://github.com/ashtophet Could you please outline the
steps required for the compilation on windows. I am a newbie on windows
compiling and don't know exactly where to start. Thanks!


Reply to this email directly or view it on GitHub
#45 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants