First things first
------------------
Don't forget the official documentation, the section on building
under windows in the
`darcs manual `_
Note also that installing this stuff is probably easier as an
administrator (msys, at least)
MinGW and MSYS
--------------
`MSYS/MinGW `_ - a minimal GNU
tools for Windows
1. Download and run MSYS-1.0.10.exe (current) as admin -
installing this will give you the basic tools, like tar.
2. Download and run msysDTK-1.0.1.exe (current) as admin
3. Setup your fstab
``cp /etc/fstab.sample /etc/fstab
# Close your MSYS window
``
4. Create an easy-to-type location for your stuff
``mkdir /tmp/dstuff
cd /tmp/dstuff
mkdir mingw
mkdir msys
``
5. Download a more recent autoconf/automake; put in
``/tmp/dstuff/msys``:
6. msys-automake-1.8.2.tar.bz2
7. msys-autoconf-2.59.tar.bz2
8. Download MinGW using the easy installer. I think I did the full
install. Alternatively, grab these packages and put them in
``/tmp/dstuff/mingw``:
9. mingw-runtime-3.9.tar.gz (current)
10. gcc core 3.4.5 (candidate) - other versions may work
11. binutils-2.16.91-20060119-1.tar.gz (candidate) - has to be this
version
12. w32api-3.6.tar.gz (current)
13. Untar all your packages. In MSYS:
``mkdir /mingw
cd /mingw
for f in /tmp/dstuff/mingw/*.tar.gz; do tar xzf $f; done
cd /
for f in /tmp/dstuff/msys/*.tar.bz2; do tar -x --overwrite -j -f $f; done
``
14. Create some handy directories:
``mkdir /usr/src
mkdir -p /usr/local/bin
``
OpenSSL
-------
1. Visit
`http://www.slproweb.com/products/Win32OpenSSL.html `_
(OpenSSL binaries)
2. Download the OpenSSL installer and run it as an administrator
3. Get expected library names for these:
``cd /c/OpenSSL/lib/MinGW
cp libeay32.a libcrypto.a
cp sslea32.a libssl.a
``
wget
----
1. Visit
`http://www.christopherlewis.com/WGet/WGetFiles.htm `_
and download
2. wget-1.11-beta-1b.zip
3. Extract it with the Windows wizard
4. Put it into
``/usr/local````cp /c/Documents\ and\ Settings/YourUserName/Desktop/wget-1.11-beta-1b/wget.exe /usr/local/bin
``
zlib
----
1. Download zlib-1.2.3-mingwPORT-1.tar.bz2 (from the MSYS site) and
put it in ``/tmp``
2. Extract it and run:
``cd /tmp/dstuff
tar xjf /tmp/zlib-1.2.3-mingwPORT-1.tar.bz2
cd zlib-1.2.3/mingwPORT/
./mingwPORT.sh
``
curl
----
1. Visit
`http://curl.haxx.se/download.html `_
2. Obtain the source tarball
3. Compile curl
``tar xzf curl-7.18.1.tar.gz
cd curl-7.18.1
./configure --with-ssl=/c/OpenSSL
make
make install
``
ghc
---
1. Download and install GHC 6.6 (6.8.2 is fine too),
`http://www.haskell.org/ghc `_ . I
chose the standalone Windows binary
2. Put GHC in your path: {{{ echo "export
PATH=${PATH}:/c/ghc/ghc-6.6/bin" >> ~/.profile }}}
3. Close your MSYS Window
darcs
-----
1. Copy the curl and zlib includes and libraries into the relevant
locations:
``cp /mingw/include/zlib.h /c/ghc/ghc-6.6/gcc-lib/include
cp /mingw/include/zconf.h /c/ghc/ghc-6.6/gcc-lib/include
cp /mingw/lib/libz* /c/ghc/ghc-6.6/gcc-lib
cp /c/OpenSSL/lib/MinGW/* /mingw/lib
cp /c/OpenSSL/lib/MinGW/* /c/ghc/ghc-6.6/gcc-lib
cp -R /usr/local/include/curl /mingw/include
cp -R /usr/local/include/curl /c/ghc/ghc-6.6/gcc-lib/include
cp /usr/local/lib/libcurl* /mingw/lib
cp /usr/local/lib/libcurl* /c/ghc/ghc-6.6/gcc-lib
``
2. Download darcs:
``cd /tmp/dstuff
wget http://www.darcs.net/darcs-2.0.1rc1.tar.gz
tar xzf darcs-2.0.1rc1.tar.gz
``
3. Build it once:
``cd darcs-2.0.1rc1
export GHC=/c/ghc/ghc-6.6/bin/ghc.exe
autoconf
./configure --with-curl-pipelining --with-static-libs
make
make install
``
4. You do not actually *need* ``--with-static-libs``, but I'm
guessing this makes life easier for your friends if you choose to
distribute darcs
5. Make sure libcurl-4.dll and zlib1.dll are on your path: {{{
export PATH=/usr/local/lib:${PATH} }}}
6. Enjoy!
--------------
Troubleshooting
---------------
1. I don't have zlib, but I thought I built it with mingwPORT?
2. Perhaps you were missing something like the w32api, and didn't
notice mingwPORT complaining?
3. Wrong autoconf version
4. Note that when you untar the later version of autoconf, tar
might refuse because there already are files existing. You can pass
the ``--override``flag to force it to untar the file.
5. Can't use ``--with-static-libs``(can't find
``/usr/local/lib/libcurl.a``
6. **Ooops**: there is a slight bug in autoconf.mk; it's adding
the -optl prefix to all LDFLAGS
7. Configure complains about curl-config
8. Build your own curl from source. The ``curl-config``script is
not distributed with the libcurl binary (7.18.1; maybe this has
changed?)
9. Problems linking against libcurl:
``src/URL.o(.text+0x7d8):fake: undefined reference to `curl_request_url'
src/URL.o(.text+0x12b9):fake: undefined reference to `curl_wait_next_url'
src/URL.o(.text+0x132d):fake: undefined reference to `curl_last_url'
collect2: ld returned 1 exit status
make: *** [darcs] Error 1
``
10. You had built darcs without libcurl and then tried to build it
with, but darcs's hscurl.o was not recompiled, so ``make clean``
11. Note that it's possible to reach this error in other ways; for
example, if hscurl.c is not compiled with the CPP flag
-DHAVE\_CURL, but the Haskell sources are, you wind up with the
final binary trying to be linked against an empty hscurl.c file -
which obviously won't work.
12. Cannot actually use libcurl
13. Whoops! Don't forget to copy libeay32.a to libcrypto.a, etc.
See the OpenSSL section
14. Everything goes up to make, and then
``make (e=3): The system cannot find the path specified.
c:\mingw\bin\make.exe: *** [stringify] Error 3
``
15. Your version of make is too sensitive (or the makefile is
wrong). Basically, it's complaining that you're trying to build
targets named "foo", but "foo.exe" comes out instead, so make is
surprised to see that "foo" (the path specified) is not found.
Don't know what the correct fix is. My workaround is just to use
msys's make and be happy. The mingw version complains.
16. Error related to ``darcsman``:
17. Make sure libcurl-4.dll is in your PATH somewhere
when running darcs
~~~~~~~~~~~~~~~~~~
1. Under DOS or Cygwin, it complains about zlib1.dll
2. Copy it from libcurl/bin to some place in your path (say, the
directory where darcs is installed), or
``C:\msys\1.0\usr\local\bin``
3. Or: try ``--with-static-libs``in configure...
4. ::
There is no libcurl
... [self-built libcurl]
5. For some reason, the HAVE\_CURL flag was not passed in when
compiling darcs (this is a hard-coded darcs error). Try a
``make clean``
6. ::
Segmentation fault/Access violation in generated code
7. ::
make clean
seems to help
Questions
---------
--------------
`CategoryWindows `_