Hi Nick,

On May 14, 2009, at 6:41 PM, Nick Mathewson wrote:

On Thu, May 14, 2009 at 04:58:02PM -0700, Rush Manbert wrote:
Hi,

I have done some searching and have read a couple of posts on this
subject, but nothing that quite answers my questions.

I am writing a Windows port of the Thrift RPC library
(http://incubator.apache.org/thrift/ ) that will build in Visual Studio
with no Cygwin or other *nix/Posix  emulation required. Thrift uses
libevent, so I tried to build the same  sort of version of libevent.

I was surprised to find that libevent would not build out of the box
on Windows using Visual Studio. However, once I found an open source
version of stdint.h for use in Visual Studio, I was able to get the
1.4.10 stable version building fairly easily. Once the library built,
I was able to build and successfully execute the regression test using
the same technique. The other tests weren't so successful due to
missing vcproj files.

I just opened up a WinXP VM, fired up Visual C++ 2008 Express,
checked out the 1.4 branch, and tried to build from the project file
in Svn.  It converted mostly okay.  I ran into a few warnings when I
built it, but no errors.  It seems to have worked fine for me.  (I
fixed the warnings and checked the modified code back in.)

Then I tried it with the distributed version.  Ouch!  Apparently, we
have not been including the event-config.h file that is supposed to be
in WIN32-Code for VC libevent builds... but we _have_ been including
the generated event-config.h that shouldn't actually be distributed;
only installed.  I've cleaned up the code that builds the
distribution.

(It wasn't an absence of stdint.h; Libevent works around the fact that
10 years out, MS still hasn't seen fit to implement C99.  But using
the wrong event-config.h made libevent act as if it had stdint.h when
it didn't, which was the problem.)

This explains so much. I had tried 1.4.8, 1.4.9, 2.0.1, and finally 1.4.10. It was so clearly broken in regard to the config stuff, yet was so easily fixed that it just seemed weird. Distribution of the wrong config makes a lot of sense.



I have two questions:

1) Why doesn't libevent as released just build in Visual Studio if
this was so easy to accomplish for me? Or have I missed something?

Apparently, nobody who knew how Libevent was _supposed_ to build with
Visual Studio had tried building with Visual Studio using a source
distribution for a long time.  We suck at paying attention to Visual
Studio.

The company I work for makes a cross platform product, currently Mac and Windows. (That's why I'm writing the Thrift port for Windows. We need it.) I would turn my back on Windows in a heartbeat otherwise, and I hate worrying about Visual Studio compatibility. Luckily, our software is written in C++, so we get incredible mileage from using Boost to abstract away the platform-specific issues.



[How it's _supposed_ to work is this: on everywhere that has a shell
that can handle autoconf, the autoconf script detects the system
settings and generates a config.h file, which gets post-processed into
a event-config.h automatically.  On anywhere without a shell that can
handle autoconf (this is basically only Visual Studio), we use a
pre-generated event-config.h file that has the right settings for
Windows on Visual Studio's idea of C.]

"this is basically only Visual Studio"

Windows just sucks in so many ways. I could go on. :-)



2) I would be happy to provide a patch that adds this support. Are any
of the developers interested in receiving it?

Give 1.4.11 a try when it comes out some time in the next 24 hours;
let us know if it's any better for you?

I did try it, using VS 2005. The library builds with no errors. The regress projects builds despite warnings and runs without errors.

The other sub-projects don't build, I think because there are no vcproj files, but I'm happy with what I have.

Thank you so much for taking care of this.

Best regards,
Rush
_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkeymail.org/mailman/listinfo/libevent-users

Reply via email to