W3C home > Mailing lists > Public > www-lib@w3.org > October to December 2001

Compiling libwww for Windows with MinGW32 [patch]

From: Richard Atterer <libwww@list.atterer.net>
Date: Thu, 4 Oct 2001 22:26:37 +0200
To: www-lib@w3.org
Message-ID: <20011004222637.A2912@atterer.net>

is anybody with write access to the CVS reading this list? I'd really
like this patch to go into libwww!

I have been working on getting libwww to compile with mingw
<http://www.mingw.org/> for the last days. The resulting patch
(against Sep 28 CVS) is attached. The advantage of using mingw rather
than Cygwin is that the resulting programs do not need the Cygwin DLL
(which is quite large!) to run.

I have compiled static libwww libraries both by cross-compiling from
Linux, and native under Cygwin. To do the latter, the following steps
are needed:

- Get Cygwin from <http://sources.redhat.com/cygwin/>. Apart from the
  usual packages, don't forget to install the packages mingw, mingw
  runtime, w32api, perl, m4, auto*.
- (For those who need it: Compile and install SSL and zlib for MinGW. 
  You can't use the Cygwin versions. I haven't tried this.)
- Get the latest libwww CVS version - see
  <http://www.w3.org/Library/Distribution.html#Snapshot> or
- The following files in libwww/config need to be added/updated,
  otherwise libtool will choke on the mingw target: config.guess
  config.sub depcomp install-sh ltmain.sh missing mkinstalldirs. 
  Libtool doesn't come with Cygwin, so get it from
  <http://www.gnu.org/software/libtool/>. Make sure to configure and
  install it with --prefix=/usr, or aclocal won't work. The files are
  in /usr/share/automake and /usr/share/libtool.
- "cd libwww"
- "sh libwww-mingw.diff" to apply the patch
- "export CC='gcc -mno-cygwin -fnative-struct'" to instruct Cygwin to
  produce MinGW32 binaries. The -fnative-struct may not be needed,
  depending on whether you also use it for the rest of your
- Go through the usual CVS bootstrap procedure
- "./configure --target=i586-pc-mingw32 ..." and compile/install

Using the resulting libwww, I have successfully compiled and used the
LoadToFile example.

This patch explicitly *disables* generation of DLLs in configure.in,
because the only effect of enabling it is that all files are compiled
twice. Some further work would be necessary to get DLLs:

- Read libtool docs :-)
- Remove my AC_DISABLE_SHARED in configure.in
- Add LIBS="$LIBS -no-unused" in configure.in for mingw
- In libwww/Library/src/Makefile.am, add lines like:
      libwwwcore_la_LIBADD = -L.libs -lwwwutils
  to indicate dependencies between the libraries.
- Order the libs in lib_LTLIBRARIES so that depended-on libs come
- Prepend "__declspec(dllimport)" or "__declspec(dllexport)" to
  certain symbols in the source (e.g. WWW_TraceFlag)
- Provide a ws2_32.dll (WinSock 2) - libtool demands this, but doesn't
  like the native M$ DLL. I don't know how to fix this.

All the best,



Legal part: (from <http://www.w3.org/PATCHES.html>)

W3C (MIT, INRIA, Keio) is hereby permitted to distribute these
materials under W3C Software and Document licenses. Furthermore:

  1. I vouch that I have all rights necessary to contribute the
     materials in a way that does not violate copyright, patent, and
     trademark rights; contractual obligations, or libel and export
     control regulations.
  2. I agree that all contributed materials will be governed by the
     W3C Software or Document licenses.
  3. W3C will retain attribution of authorship. The W3C makes no
     a-priori commitment to support contributions.

I the undersigned represent that I own the copyright.
(My PGP signature will have to do!-)
  __   _
  |_) /|  Richard Atterer     |  CS student at the Technische  |  GnuPG key:
  | \/¯|  http://atterer.net  |  Universität München, Germany  |  0x888354F7
  ¯ ´` ¯

Received on Thursday, 4 October 2001 19:14:32 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:54 UTC