Discussion:
[bug-wget] Compiling Wget on Windows
Darshit Shah
2013-06-11 20:08:08 UTC
Permalink
I wished to compile the latest git revision of Wget on Windows in order to
run some tests.
However, I have failed miserably in my attempts to understand how to
compile Wget on Windows.

I set up a virtual system with MingW installed (I do not wish to create a
CygWin executable if possible.)
Alongwith MingW, I installed Perl and Visual Studio Express 2008.

Similar to how one would proceed on a UNIX system, I ran:
$ ./bootstrap --gnulib-srcdir=../gnulib
in the MingW shell.

This command however fails with the following error:
configure.ac:1: error: possibly undefined macro: dnl
If this token and others are legitimate, please use
m4_pattern_allow.
See the Autoconf documentation.
configure.ac:41: error: possibly undefined macro: AC_MSG_NOTICE
configure.ac:74: error: possibly undefined macro: AC_DEFINE
configure.ac:253: error: possibly undefined macro: AC_CHECK_LIB
configure.ac:283: error: possibly undefined macro: AC_MSG_ERROR
autoreconf-2.68: /mingw/bin/autoconf-2.68 failed with exit status: 1

How am I supposed to solve this?
--
Thanking You,
Darshit Shah
Ray Satiro
2013-06-12 00:54:19 UTC
Permalink
Sent: Tuesday, June 11, 2013 4:08 PM
Subject: [Bug-wget] [bug-wget] Compiling Wget on Windows
I wished to compile the latest git revision of Wget on Windows in order to
run some tests.
However, I have failed miserably in my attempts to understand how to
compile Wget on Windows.
I set up a virtual system with MingW installed (I do not wish to create a
CygWin executable if possible.)
Alongwith MingW, I installed Perl and Visual Studio Express 2008.
Wget
can no longer be compiled using visual studio. From what I remember the
main problem was because visual studio is not fully c99 compatible
therefore when you compile c all variable declarations have to be at the
beginning of a block. I submitted some patches a while back to fix that
but I'm not sure what happened, whether it was decided it wasn't worth
it for vs anymore or what. Also there is dependence on gnulib now. I
would stick with mingw like you're trying to do and if you need debug
add gdb3 switch.


You bring up a good point re bootstrap/ac.
It does not work properly in windows. I don't recall that being any
fault of wget. When I was working with the nightlies I'd build the
configure scripts in linux using ./bootstrap --copy , then switch to
windows to run the configure. It usually ran fine although sometimes a
few bumps. Processes are expensive in windows and you will notice
running a configure script and build take a long time, so you may want
to consider cross compiling everything for windows in linux depending on
the type of work you are doing. I think Giuseppe had some sort of
special procedure for that rather than just the toolchain; or maybe I'm
thinking of another project?

Maybe Giuseppe can weigh in here on
what OS he uses to build the configure scripts for alphas and the exact
steps he takes so that you can do that and have a solid configure script
that will work well to build in mingw. Also you should be aware some of
the current wget tests from the test script fail incorrectly on
windows. This has also been discussed but I don't remember what happened
with it. I've searched for this and everything I've mentioned above via
google but I'm not finding much, sorry.
Bykov Aleksey
2013-06-12 18:54:29 UTC
Permalink
Greeting, Darshit Shah

By some reason during bootstrap You does not acquire "aclocal.m4". Please
try to create it manually by "aclocal" command. What error it give?
Is folder "m4" exist? Is "build-aux" contain more than 2 files? What MinGW
version You had installed? How did You install it?

Last time i had recieved error with wget bootstrap or configure (basic) in
mingw long time ago...

I use mingw-get-inst-20120426.exe and choose "download lastest repository
packages". Components - "C compiler", "C++ compiler", "MSYS Basic System"
and "MinGW Developer Toolkit". Install it to some new dir. Add folder
"Source" with "wget" and "gnulib". Replace "_PC_NAME_MAX" with "256" in
url.c:1620.
Then run
./bootstrap --no-git --gnulib-srcdir=../gnulib 2>&1 | tee bootstrap.log
(./configure --disable-nls --without-ssl --disable-iri 2>&1 && make 2>&1)|
tee configmake.log

My logs - http://db.tt/mmYvI2D0
--
Best regars, Alex
Ray Satiro
2013-06-14 04:53:08 UTC
Permalink
[...]
Post by Bykov Aleksey
Last time i had recieved error with wget bootstrap or configure (basic) in
mingw long time ago...
I use mingw-get-inst-20120426.exe and choose "download lastest repository
packages". Components - "C compiler", "C++ compiler", "MSYS Basic System"
and "MinGW Developer Toolkit". Install it to some new dir. Add folder
"Source" with "wget" and "gnulib". Replace "_PC_NAME_MAX" with "256" in 
url.c:1620.
Also there's a patch for that on the parallel-wget branch, "MinGW compatibility fixes".
Post by Bykov Aleksey
Then run
./bootstrap --no-git --gnulib-srcdir=../gnulib 2>&1 | tee bootstrap.log
(./configure --disable-nls --without-ssl --disable-iri 2>&1 && make 2>&1)|
tee configmake.log
I stand corrected, the bootstrapping process appears to work properly with mingw now. I tested in a clean XP VM but I couldn't reproduce a build using your commands. Can you up your config.log? When I ran configure threads were enabled. Did you explicitly disable threads? Yours has:
checking for multithread API to use... none

but mine has:
checking whether imported symbols can be declared weak... no
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking for pthread_kill in -lpthread... yes
checking for multithread API to use... posix


Otherwise the configure output is almost identical. Then I ran make and it failed because -lpthread wasn't added. saw a lot of this:

../lib/libgnu.a(regex.o):regex.c:(.text+0xa4e5): undefined reference to `_imp__pthread_mutex_init'

compiles once added:
gcc  -O2 -Wall   -o wget.exe cmpt.o connect.o convert.o cookies.o ftp.o css_.o css-url.o ftp-basic.o ftp-ls.o hash.o host.o html-parse.o html-url.o http.o init.o log.o main.o netrc.o progress.o ptimer.o recur.o res.o retr.o spider.o url.o warc.o utils.o exits.o build_info.o  version.o ftp-opie.o mswindows.o ../lib/libgnu.a -lws2_32 -lpthread

I can do --enable-threads=windows or --disable-threads but if I don't do either or I do --enable-threads=posix then posix is enabled and the build fails due to missing pthread lib.
Bykov Aleksey
2013-06-14 08:35:03 UTC
Permalink
Greetings, Ray Satiro.
Post by Ray Satiro
I can do --enable-threads=windows or --disable-threads but if I don't do
either or I do --enable-threads=posix then posix is enabled and the
build fails due to missing pthread lib.
Sorry, my mistake (I'm type command's to promt manually, not by
copy-paste. And forgot to correct copied to mail script that work with old
GNULib (behaviour was changed by GNULib git commits 9ceceed, 55ba71f,
96a263f from 20,29,30 May 2013)).

Yes, i'm use "--disable-threads". Without "--disable-threads" or
"--enable-threads=windows" regexp give error.

File with logs updated (added config.log and config.status).

Thanks for correcting.
--
Best regars, Alex
Giuseppe Scrivano
2013-06-12 19:29:36 UTC
Permalink
Post by Darshit Shah
I wished to compile the latest git revision of Wget on Windows in order to
run some tests.
However, I have failed miserably in my attempts to understand how to
compile Wget on Windows.
I set up a virtual system with MingW installed (I do not wish to create a
CygWin executable if possible.)
Alongwith MingW, I installed Perl and Visual Studio Express 2008.
$ ./bootstrap --gnulib-srcdir=../gnulib
in the MingW shell.
configure.ac:1: error: possibly undefined macro: dnl
If this token and others are legitimate, please use
m4_pattern_allow.
See the Autoconf documentation.
configure.ac:41: error: possibly undefined macro: AC_MSG_NOTICE
configure.ac:74: error: possibly undefined macro: AC_DEFINE
configure.ac:253: error: possibly undefined macro: AC_CHECK_LIB
configure.ac:283: error: possibly undefined macro: AC_MSG_ERROR
autoreconf-2.68: /mingw/bin/autoconf-2.68 failed with exit status: 1
How am I supposed to solve this?
I haven't tried myself as I have no access to a Windows machine, but
it should just work, have you tried with a newer autoconf version?

In any case, it is not our goal to be able to regenerate configure
scripts under MingW, it is enough that you are able to build wget,
i.e. ./configure && make.

If you still have problems, what about generate these files on a
GNU/Linux machine and use the generated dist files under Windows?
--
Giuseppe
Loading...