Building YAWS For Windows
April 21, 2007
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):
- Install Erlang (obviously), and make sure it is in your PATH
- Install Cygwin with the Perl and GNU Make packages at minimum
- Unpack the latest YAWS release into your home directory
- 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:
/cygdrive/c/Program Files/Erlang/5.5.4/bin/erl -noshell -pa ../ebin -s mime_type_c compile
make[1]: /cygdrive/c/Program: Command not found - 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)
- Point your web browser at localhost HTTPS on port 4443 to see what you have wrought
- Sit back and take a deep breath to cleanse your soul of the accumulated Unix gunk

June 14, 2007 at 11:52 pm
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/other
so 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!
June 26, 2007 at 11:20 pm
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.
August 19, 2007 at 11:57 pm
[...] Building Yaws on Windows - How to do it. digg_bgcolor = ‘transparent’; digg_skin = ‘compact’; [...]
September 21, 2007 at 11:50 am
Encouraging Page.
I replaced ‘/tmp’ to ‘C:/WINDOWS/Temp’ and ‘/’ to c:/’.
I’m afraid to they raise some problems somehow.
Anyway Yaws work now!
You saved my pain and time, and encouraged me.
Thank you.
February 2, 2008 at 7:36 pm
I’m using R12B-0 under Windows Vista x64 and tried to install yaws 1.74. This is the result:
$ ./bin/yaws
Eshell V5.6 (abort with ^G)
1>
=INFO REPORT==== 2-Feb-2008::14:59:13 ===
Yaws: Using config file c:/cygwin/home/Orlando/yaws.conf
1>
=INFO REPORT==== 2-Feb-2008::14:59:14 ===
Yaws: Listening to 0.0.0.0:8000 for servers
- http://Orlando-PC:8000 under c:/Cygwin/home/Orlando/yaws-1.74/scripts/../www
- http://localhost:8000 under c:/Cygwin/tmp
1>
=ERROR REPORT==== 2-Feb-2008::14:59:14 ===
FATAL: {badmatch,{error,no_ssl_server}}
1>
=ERROR REPORT==== 2-Feb-2008::14:59:14 ===
Top proc died, terminate gserv1>
=INFO REPORT==== 2-Feb-2008::14:59:14 ===
application: yaws
exited: {shutdown,{yaws_app,start,[normal,[]]}}
type: permanent
1> {”Kernel pid terminated”,application_controller,”{application_start_failure,y
aws,{shutdown,{yaws_app,start,[normal,[]]}}}”}
Crash dump was written to: erl_crash.dump
Kernel pid terminated (application_controller) ({application_start_failure,yaws,
{shutdown,{yaws_app,start,[normal,[]]}}})
Orlando@Orlando-PC ~
$
A Windows installer is very much needed.
February 6, 2008 at 11:13 pm
It worked!!
Bad configuration file. Just follow the instructions and then delete the servers that appear at the end of yaws.conf, then start yaws with yaws -i. I got to run ErlyWeb!
Again, a Windows installer is very much needed.
March 5, 2008 at 11:12 am
There is a way to install yaws without cygwin on windows.
http://groups.google.com/group/erlyweb/web/erlyweb-erlang-windows-installation
I had to compile some src/*.erl files by hands but after 2 hours of tryings I managed to start it.
May 6, 2008 at 9:28 pm
i tried the same thing and this is what i am getting
bash-3.2$ ./configure;make
checking build system type… i686-pc-cygwin
checking host system type… i686-pc-cygwin
checking target system type… i686-pc-cygwin
checking for erl… /cygdrive/c/work/ardorbytes/erlang/erl5.6.2/bin/erl
checking for erlc… /cygdrive/c/work/ardorbytes/erlang/erl5.6.2/bin/erlc
checking for gcc… gcc
checking for C compiler default output file name… a.exe
checking whether the C compiler works… yes
checking whether we are cross compiling… no
checking for suffix of executables… .exe
checking for suffix of object files… o
checking whether we are using the GNU C compiler… yes
checking whether gcc accepts -g… yes
checking for gcc option to accept ISO C89… none needed
checking how to run the C preprocessor… gcc -E
checking for grep that handles long lines and -e… /usr/bin/grep
checking for egrep… /usr/bin/grep -E
checking whether gcc needs -traditional… no
checking whether make sets $(MAKE)… yes
checking for a BSD-compatible install… /usr/bin/install -c
checking for werl… /cygdrive/c/work/ardorbytes/erlang/erl5.6.2/bin/werl
configure: creating ./config.status
config.status: creating include.mk
make[1]: Entering directory `c:/work/ardorbytes/yaws/server/yaws-1.68/c_src’
make[1]: Nothing to be done for `all’.
make[1]: Leaving directory `c:/work/ardorbytes/yaws/server/yaws-1.68/c_src’
make[1]: Entering directory `c:/work/ardorbytes/yaws/server/yaws-1.68/src’
make[1]: Nothing to be done for `all’.
make[1]: Leaving directory `c:/work/ardorbytes/yaws/server/yaws-1.68/src’
make[1]: Entering directory `c:/work/ardorbytes/yaws/server/yaws-1.68/man’
make[1]: Nothing to be done for `all’.
make[1]: Leaving directory `c:/work/ardorbytes/yaws/server/yaws-1.68/man’
make[1]: Entering directory `c:/work/ardorbytes/yaws/server/yaws-1.68/www/shopingcart’
cp shopcart.beam ../../examples/ebin
make[1]: Leaving directory `c:/work/ardorbytes/yaws/server/yaws-1.68/www/shopingcart’
make[1]: Entering directory `c:/work/ardorbytes/yaws/server/yaws-1.68/www/code’
cp myappmod.beam ../../examples/ebin
make[1]: Leaving directory `c:/work/ardorbytes/yaws/server/yaws-1.68/www/code’
make[1]: Entering directory `c:/work/ardorbytes/yaws/server/yaws-1.68/doc’
echo “To build the docs, please use make docs before doing make install”
To build the docs, please use make docs before doing make install
make[1]: Leaving directory `c:/work/ardorbytes/yaws/server/yaws-1.68/doc’
make[1]: Entering directory `c:/work/ardorbytes/yaws/server/yaws-1.68/scripts’
make[1]: Nothing to be done for `all’.
make[1]: Leaving directory `c:/work/ardorbytes/yaws/server/yaws-1.68/scripts’
bash-3.2$
finally my bin/yaws file is 0KB
please help.