-
-
Notifications
You must be signed in to change notification settings - Fork 266
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
WIP: Add windows build #313
WIP: Add windows build #313
Conversation
@ismaell, please take a look at the code I changed in |
compat-win32.h
Outdated
#ifdef _WIN32_WINNT | ||
#undef _WIN32_WINNT | ||
#endif | ||
#define _WIN32_WINNT 0x0600 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This macro defines Windows system version, 0x0600
for Windwos Vista . Case AI_ADDRCONFIG
was used in tcp_connect
and defined in ws2tcpip.h
, minimum value of _WIN32_WINNT
should be 0x0600
, which is defined to 0x502
in _mingw.h
by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should probably be handled by the configure
script.
Just like it defines _DARWIN_C_SOURCE
for Darwin / Mac OS X, it should define _WIN32_WINNT
for Windows.
E.g.:
case "$host_os" in
...
*-mingw32)
AC_DEFINE([_WIN32_WINNT], [0x0600], [Request NT 6 API to expose AI_ADDRCONFIG in WinSock2])
;;
This is specially important because the definition is conditional, and ultimately depends on the software to request the right API.
The proper way to add support for windows would be to move the OS test to the beginning of the configure script and avoid running the posix-specifc function tests for windows, instead including a compatibility library right away with an drop-in implementation. |
|
According to windows doc, I think they are functionally equivalent. But I'm not sure where should I translate WSA errors to
Ok. I will do the rebase for it.
|
I'm not making changes to correct code just because Windows fails to do the right thing. It's up to the compatibility layer for windows to fix any platform differences, transparently. |
Does the following work? sh configure --with-ssl=/path/to/openssl --host=x86_64-w64-mingw32 That would be better than specifying |
I have read the code in In all, this is not a problem with Axel. However, it might be necessary to add descriptions of pkg-config to the building guide. |
Indeed, I know it's only needed when libssl is in a non-standard path... I thought I had implemented taking a path on that arg before... I'll do that. |
I think documenting all the little options you have to configure a package is a little bit overkill. |
I was considering the condition that you want to build from the master branch instead of the release tarballs, in which case you might have difficulties configuring OpenSSL. But it becomes less necessary that documenting for win32 build if the |
@Jason23347 I've implemented it, but I'm not sure it works on Windows... you still need to install openssl/libressl somewhere, so that the .pc files are found at the right place, but not necessarily in a standard path. |
The code in #325 worked fine if the suffix "/lib/pkg-config" had been removed. The file ./configure --host=x86_64-w64-mingw32 --disable-Werror --with-ssl=/home/jason/openssl-OpenSSL_1_1_1 @ismaell Should I do the rebase to move all my commits afterward current master HEAD? |
Does the |
By default, the |
No, that's always the wrong thing to do, you must install it somewhere, not necessarily a global place... |
Ok, I got it. It works fine while the installation path is configured. |
I'm just going to go ahead and add the |
Request NT 6 API to expose AI_ADDRCONFIG in WinSock2. Ref: #313 Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
I don't know why but the variable |
Tonight I will do the rebase to change |
Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
[ismael@iodev.co.uk: edit commit message]
The issue wasn't completely corrected by commit ec63c39 ("Fix usage of conn->lastbyte, off by one") [ismael@iodev.co.uk: merged commits and edited message] Closes: axel-download-accelerator#322 Fixes: ec63c39 ("Fix usage of conn->lastbyte, off by one") Fixes: 06fa69f ("Fix HTTP request-ranges to be zero-based")
I can't properly support it at the moment.
Signed-off-by: Jason <jason23347@gmail.com>
Signed-off-by: Jason <jason23347@gmail.com>
* functions modified: get_if_ip & get_term_width. Signed-off-by: Jason <jason23347@gmail.com>
Using SOCK_ISINVALID instead of simply comparing of fd and 0, because SOCKET type in unix-like systems is int, but is unsigned in windows. Signed-off-by: Jason <jason23347@gmail.com>
Signed-off-by: Jason <jason23347@gmail.com>
Signed-off-by: Jason <jason23347@gmail.com>
815d913
to
0980e71
Compare
@ismaell It seems all worked fine except the function check of |
Signed-off-by: Jason <jason23347@gmail.com>
Signed-off-by: Jason <jason23347@gmail.com>
Signed-off-by: Jason <jason23347@gmail.com>
0980e71
to
c30e739
Compare
Hmm, because it's a non-POSIX system, it should perhaps be handled before calling # OS-specific issues
AS_CASE(["$host_os"],
[*mingw32], [
AC_LIBOBJ([nanosleep])
]) You can find an implementation in gnulib. |
Request NT 6 API to expose AI_ADDRCONFIG in WinSock2. Ref: axel-download-accelerator#313 Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
Fixes: bd8b313 ("configure: Define _WIN32_WINNT when compiling with MinGW") Ref: axel-download-accelerator#313 Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
Hey @Jason23347 @ismaell any headway on this? It'd be nice to get this in as axel initially used to be windows compatible. Thanks :) |
@avdaredevil in slowmotion... I don't use Windows. It is a good candidate for a bounty. |
How close is this PR to being done, maybe I can sink a Saturday on this? Also what type of tooling is required to build this project? |
@avdaredevil you'll need MinGW, OpenSSL, WinSock and a pthreads implementation for starters. Cross-compiling is probably easier than building on Windows, but you can try either way. |
I'm going to modify |
@avdaredevil BTW; there's a msys2 package you can use as a starting point. |
Yes, this is not about MSYS2 but MinGW, AFAIK mingw-w64 produces fully native binaries; but of course, MSYS2 includes MinGW and the tools you need to actually run the buildsystem. What will not be supported (by me) is an alternative buildsystem specifically for Windows. Also, it might get us halfway to enable building with |
This is not a help forum... |
Is anyone still pursuing this? If not, I'll close the PR. |
Todos
configure.ac
should be modifiedpkg-config
doesn't workKnown problems
Build from this branch
Download and compile mingw
On ubuntu it is easy:
Download and compile openssl against mingw
I chose 1.1.1 release on github
There was an article about building openssl against mingw on linux:
https://marc.xn--wckerlin-0za.ch/computer/cross-compile-openssl-for-windows-on-linux
cd /path/to/openssl ./Configure mingw shared --cross-compile-prefix=x86_64-w64-mingw32-
before making, 3 lines should be added to file
include/openssl/x509v3.h
, just after#define HEADER_X509V3_H
:Build Axel
autoconf -i SSL_CFLAGS=-I/path/to/openssl/include \ SSL_LIBS="-L/path/to/openssl -lssl -lcrypto" \ ./configure --host=x86_64-w64-mingw32 --disable-Werror
This attachment file is an exutable file of windows environment.
Closes #108