Building YAWS For Windows

Inspired by Yariv’s Blog, where he talks about a framework for building web applications in Erlang, and my so far abortive attempts to get into Erlang, I decided to give it another go with Erlyweb. Erlyweb depends on YAWS (Yet Another Web Server), however, and this proved to be a bit of a pain to install since I’m being difficult and using Windows on my development machine. So, in order to help any other lost souls who try to duplicate this feat in the future, I’m recording the process (tested against YAWS 1.68):

Now, the first trickiness: there is a small error in the YAWS makefile, so open up the yaws-X.XX\src\Makefile and for the mime_types.erl target change the first command to be not $(ERL) but "$(ERL)". The quotes mean that for those of us with Erlang installed in a path with spaces in the name (such as Windows users who put it in Program Files) the erl executable will actually be found. If you don’t follow this step you’ll end up with some error like:

Follow the same process to add quotes around $(ERLC) in www\shopingcart\Makefile and www\code\Makefile (somewhat weirdly, every other uses of $(ERL) and $(ERLC) have been quoted for us, suggesting this is just something they overlooked, rather than that running on Windows is a blasphemy)

Whack open a Bash Cygwin shell and cd into the yaws-X.XX directory

Do the usual "./configure; make" dance

Open up the newly created yaws file in the bin subdirectory and change the last line so that $erl is in quotes, i.e. from this:

${RUN_ERL} "exec $erl $XEC"

To this:

${RUN_ERL} 'exec "$erl" $XEC'

From this point on I’m going to assume you need to do a local install: if you want to do your own thing, you can follow the instructions here, but you may need to adapt them based on what I’m going to talk about below. Anyway, run "make local_install" do to the install if you are following along at home

Now, this is where it can get a bit confusing: although we just built YAWS under Cygwin, since we have a Windows binary of Erlang the paths in yaws.conf (which should have appeared in your home directory) must be Windows paths, but the makefile used Unix ones. Go in and fix all of those (for me, this meant putting "C:/Cygwin" in front of all of them)

Sit back and take a deep breath to cleanse your soul of the accumulated Unix gunk

Erik says:

26 June 2007 23:20 UTC

Nice page. I should have done this also when I installed yaws on Windows last time, but you saved me now. Thanks.There was one additional thing that I needed to do to get it working. Just in case if someone else comes up with the same issue. I needed to fix yawsdir variable from the yaws-X.XX/bin/yaws file to be C:/yawsdir or something that fits your system.

Pete says:

14 June 2007 23:52 UTC

Thanks for a spot on explanation!I'm in the same position as you - just starting to learn Erlang - but most interested ultimately in it being able to run on Windows (for legacy reasons).I followed your instructions and there was only one thing different in my process: since my ~ dir is not under c:\cygwin all the paths in yaws.conf looked like: /cygdrive/c/somewhere/or/otherso instead of being able to simply prepend c:/cygwin instead I had to make some slight changes - drop the leading /cygdrive/ and turn the c/ into c:/Thanks again!