Building Tor with libevent 1.2 (or higher) on Windows fails

Karsten Loesing karsten.loesing at gmx.net
Thu Feb 22 11:45:35 UTC 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi again,

thanks for your replies, Christopher and Nick! I had problems with both
suggestions, but a (quite weird) combination of both works. :)

> Libevent 1.3 should work fine under mingw; the sample application
> doesn't build, but that's safe to ignore.

So, I removed the sample application from the build and libevent
compiled fine.

However, the problem only has moved: Tor does not compile any
more---with a similar error message when compiling log.c. I attached it
below (see 1).

> libevent should probably be using uint8_t, etc. here. These
> are all BSD typesdefs.

I tried this, too. I edited event.h and replaced all "u_int*_t" by
"uint*_t".

But then, compilation of libevent lead to a similar error with event.c
(see 2).


The combination of both solutions looks like this: I compiled libevent
without samples, but did not install it. Then, I edited event.h and
installed libevent. Fortunately, this change does not require
recompilation. Afterwards, I was able to compile and run Tor successfully.

However, I am not so sure if it is advisable to change a header file and
not clean up and recompile the sources. (Did I mention, that C is still
a foreign language for me?) Maybe someone knows a better solution?

I also attached the modified section from tor-win32-mingw-creation.txt,
so that you can better understand what I did.

Kind regards,
Karsten

- ---

Log (1)

$ make
make  all-recursive
make[1]: Entering directory `/t/tor-mingw/trunk'
Making all in src
make[2]: Entering directory `/t/tor-mingw/trunk/src'
Making all in common
make[3]: Entering directory `/t/tor-mingw/trunk/src/common'
if gcc -DHAVE_CONFIG_H -I. -I. -I../..   -I/usr/local/ssl/include
- -I/usr/local/include   -g -O2 -Wall -g -O2 -MT log.o -MD -MP -MF
".deps/log.Tpo" \
  -c -o log.o `test -f 'log.c' || echo './'`log.c; \
then mv ".deps/log.Tpo" ".deps/log.Po"; \
else rm -f ".deps/log.Tpo"; exit 1; \
fi
In file included from log.c:29:
C:/msys/1.0/local/include/event.h:302: error: syntax error before "u_int8_t"
C:/msys/1.0/local/include/event.h:305: error: syntax error before
"u_int32_t"
C:/msys/1.0/local/include/event.h:307: error: syntax error before "u_int8_t"
C:/msys/1.0/local/include/event.h:310: error: syntax error before "u_int8_t"
C:/msys/1.0/local/include/event.h:313: error: syntax error before "u_int8_t"
C:/msys/1.0/local/include/event.h:318: error: syntax error before "u_int8_t"
C:/msys/1.0/local/include/event.h:320: error: syntax error before "u_int8_t"
C:/msys/1.0/local/include/event.h:321: error: syntax error before
"u_int32_t"
C:/msys/1.0/local/include/event.h:322: error: syntax error before
"u_int32_t"
C:/msys/1.0/local/include/event.h:325: error: syntax error before "u_int8_t"
C:/msys/1.0/local/include/event.h:328: error: syntax error before "u_int8_t"
C:/msys/1.0/local/include/event.h:331: error: syntax error before "u_int8_t"
C:/msys/1.0/local/include/event.h:334: error: syntax error before "u_int8_t"
make[3]: *** [log.o] Error 1
make[3]: Leaving directory `/t/tor-mingw/trunk/src/common'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/t/tor-mingw/trunk/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/t/tor-mingw/trunk'
make: *** [all] Error 2

- ---

Log (2)

$ make
make  all-recursive
make[1]: Entering directory `/t/tor-mingw/libevent-1.3a'
Making all in .
make[2]: Entering directory `/t/tor-mingw/libevent-1.3a'
/bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.
- -Icompat -IWIN32-Code    -g -O2 -Wall -c -o event.lo `test -f 'event.c'
|| echo './'`event.c
 gcc -DHAVE_CONFIG_H -I. -I. -I. -Icompat -IWIN32-Code -g -O2 -Wall -c
event.c -o event.o
In file included from event.c:55:
event.h:302: error: syntax error before "uint8_t"
event.h:305: error: syntax error before "uint32_t"
event.h:307: error: syntax error before "uint8_t"
event.h:310: error: syntax error before "uint8_t"
event.h:313: error: syntax error before "uint8_t"
event.h:318: error: syntax error before "uint8_t"
event.h:320: error: syntax error before "uint8_t"
event.h:321: error: syntax error before "uint32_t"
event.h:322: error: syntax error before "uint32_t"
event.h:325: error: syntax error before "uint8_t"
event.h:328: error: syntax error before "uint8_t"
event.h:331: error: syntax error before "uint8_t"
event.h:334: error: syntax error before "uint8_t"
make[2]: *** [event.lo] Error 1
make[2]: Leaving directory `/t/tor-mingw/libevent-1.3a'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/t/tor-mingw/libevent-1.3a'
make: *** [all] Error 2

- ---

Modified section from tor-win32-mingw-creation.txt:

Stage Four: Download, extract, and patch libevent-1.3a.
- -------------------------------------------------------

Download libevent-1.3a:
http://www.monkey.org/~provos/libevent/

Copy the libevent tarball into the "tor-mingw" directory.
Type "cd tor-mingw"

Extract libevent:
Type "tar zxf libevent-1.3a.tar.gz"

Patch #1: Remove samples from build
Type "cd tor-mingw/libevent-1.3a/"
Remove all occurrences of "sample" from Makefile.am: 5 x in EXTRA_DIST
and 2 x in SUBDIRS
(if and else).
Remove all occurrences of "sample" from Makefile.in: 1 x DIST_SUBDIRS, 5
x in EXTRA_DIST,
1 x in @BUILD_WIN32_FALSE at SUBDIRS, 1 x in @BUILD_WIN32_TRUE at SUBDIRS, 1 x
in distdir
Remove subfolder "tor-mingw/libevent-1.3a/sample/"

Build libevent:
Type "aclocal && autoheader && automake && autoconf".
There may be WARNING messages.  There will be no output if all runs
successfuly.

Type "./configure --enable-static --disable-shared"
Type "make"
Don't type "make install" yet!

Patch #2: Make u_int*_t typedefs Windows-compatible
Edit "tor-mingw/libevent-1.3a/event.h" and replace all occurences of
"u_int" by
"uint", e.g. by using the following vi command (without quotes):
":%s/u_int/uint/g"

Type "make"
Type "make install"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF3YJfq8q8gkGfGakRAssLAKCf5pWtVI+0k11BChFfihpPY3jfawCdEYN5
0j9nzb2xRDaTb9/nvXfdiBA=
=1gQx
-----END PGP SIGNATURE-----



More information about the tor-dev mailing list