[Haskell-cafe] Success (was: cURL under Windows again)

Iliya Kuznetsov iliya.kuznetsov at gmail.com
Thu Feb 5 15:13:56 EST 2009

The problem has solved. Solution, given by http://awson.livejournal.com/,
1. Copy libcurl-4.dll to libcurl.dll beause of namescheme
2. Before building haskell curl-1.3.4 _under windows_ you have to change

#define CURL_EXTERN __declspec(dllimport)
#define CURL_EXTERN.

After that, curl-7.19.3 and curl-1.3.4 work fine.
---------- Forwarded message ----------
From: Iliya Kuznetsov <iliya.kuznetsov at gmail.com>
Date: 2009/2/2
Subject: cURL under Windows again
To: haskell-cafe at haskell.org

Hello cafe-subscribers,

I saw some issues about installing haskell bindings for cURL under Windows,
and now I'm trapped too.
So, here is actions' log for everything (very detail; you can PgDn to the
end with questions):

1. Windows Vista without UAC
2. ghc-6.10.1-i386-windows.exe is installed to C:\Program Files\Haskell
    "C:\Program Files\Haskell\package.conf" wasn't touched after
installation (Cabal nor manually)
3. MinGW-5.1.4 installed to C:\temp\MinGW
4. MSys-1.0 installed to C:\temp\msys\1.0\
5. curl-7.19.3.tar.bz2 had taken from
6. Under msys, curl-7.19.3.tar.bz2 is untared into
7. cURL is made as:
  cd curl-7.19.3
$  ./configure
configure: Configured to build curl/libcurl:
  curl version:    7.19.3
  Host setup:      i686-pc-mingw32
  Install prefix:  /usr/local
  Compiler:        gcc
  SSL support:     no      (--with-ssl / --with-gnutls)
  SSH support:     no      (--with-libssh2)
  zlib support:    no      (--with-zlib)
  krb4 support:    no      (--with-krb4*)
  GSSAPI support:  no      (--with-gssapi)
  SPNEGO support:  no      (--with-spnego)
  c-ares support:  no      (--enable-ares)
  ipv6 support:    no      (--enable-ipv6)
  IDN support:     no      (--with-libidn)
  Build libcurl:   Shared=yes, Static=yes
  Built-in manual: no      (--enable-manual)
  Verbose errors:  enabled (--disable-verbose)
  SSPI support:    no      (--enable-sspi)
  ca cert bundle:  no
  ca cert path:    no
  LDAP support:    enabled (winldap)
  LDAPS support:   no      (--enable-ldaps)

$  make
make[2]: Leaving directory `/home/Kuznetsov/curl-7.19.3/src'
make[1]: Leaving directory `/home/Kuznetsov/curl-7.19.3/src'
make[1]: Entering directory `/home/Kuznetsov/curl-7.19.3'
make[1]: Nothing to be done for `all-am'.
make[1]: Leaving directory `/home/Kuznetsov/curl-7.19.3'

$  make install
libtool: install: /bin/install -c .libs/libcurl.dll.a
libtool: install: base_file=`basename libcurl.la`
libtool: install:  dlpath=`/bin/sh 2>&1 -c '. .libs/'libcurl.la'i; echo
libtool: install:  dldir=/usr/local/lib/`dirname ../bin/libcurl-4.dll`
libtool: install:  test -d /usr/local/lib/../bin || mkdir -p
libtool: install:  /bin/install -c .libs/libcurl-4.dll
libtool: install:  chmod a+x /usr/local/lib/../bin/libcurl-4.dll
libtool: install:  if test -n '' && test -n 'strip --strip-unneeded'; then
eval 'strip --strip-unneeded /usr/local/lib/../bin/libcurl-4.dll' || exit 0;
libtool: install: /bin/install -c .libs/libcurl.lai /usr/local/lib/
libtool: install: /bin/install -c .libs/libcurl.a /usr/local/lib/libcurl.a
libtool: install: chmod 644 /usr/local/lib/libcurl.a
libtool: install: ranlib /usr/local/lib/libcurl.a
Libraries have been installed in:

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-LLIBDIR' linker flag
 /bin/install -c -m 644 'curl.h' '/usr/local/include/curl/curl.h'
 /bin/install -c -m 644 'curlver.h' '/usr/local/include/curl/curlver.h'
 /bin/install -c -m 644 'easy.h' '/usr/local/include/curl/easy.h'
 /bin/install -c -m 644 'mprintf.h' '/usr/local/include/curl/mprintf.h'
 /bin/install -c -m 644 'stdcheaders.h'
 /bin/install -c -m 644 'types.h' '/usr/local/include/curl/types.h'
 /bin/install -c -m 644 'multi.h' '/usr/local/include/curl/multi.h'
 /bin/install -c -m 644 'typecheck-gcc.h'
 /bin/install -c -m 644 'curlbuild.h' '/usr/local/include/curl/curlbuild.h'
 /bin/install -c -m 644 'curlrules.h' '/usr/local/include/curl/curlrules.h'

8. $ which curl && curl
curl: try 'curl --help' for more information

I have following files in C:\temp\msys\1.0\local\bin\  (/usr/local/bin in

02.02.2009  15:10             4 029 curl-config
02.02.2009  15:10            98 591 curl.exe
02.02.2009  15:09           262 934 libcurl-4.dll

In /usr/local/include/curl ten includes:
02.02.2009  15:10            67 183 curl.h
02.02.2009  15:10             5 865 curlbuild.h
02.02.2009  15:10             7 478 curlrules.h
02.02.2009  15:10             2 799 curlver.h
02.02.2009  15:10             3 526 easy.h
02.02.2009  15:10             2 850 mprintf.h
02.02.2009  15:10            13 039 multi.h
02.02.2009  15:10             1 383 stdcheaders.h
02.02.2009  15:10            33 337 typecheck-gcc.h
02.02.2009  15:10                15 types.h

Sorry for many details, but now I can show the wrong behaviour of the
haskell bindings for cURL under windows:

9. curl-1.3.4 is taken from hackage and unzipped to /home/Kuznetsov
$ cd ~/curl-1.3.4

$ runhaskell Setup.hs configure --extra-include-dirs=/usr/local/include
Configuring curl-1.3.4...

$ runhaskell Setup.hs build
Preprocessing library curl-1.3.4...
Building curl-1.3.4...
[1 of 8] Compiling Network.Curl.Debug ( Network\Curl\Debug.hs,
dist\build\Network\Curl\Debug.o )
[2 of 8] Compiling Network.Curl.Types ( Network\Curl\Types.hs,
dist\build\Network\Curl\Types.o )
[3 of 8] Compiling Network.Curl.Post ( Network\Curl\Post.hs,
dist\build\Network\Curl\Post.o )
[4 of 8] Compiling Network.Curl.Opts ( Network\Curl\Opts.hs,
dist\build\Network\Curl\Opts.o )
[5 of 8] Compiling Network.Curl.Code ( Network\Curl\Code.hs,
dist\build\Network\Curl\Code.o )
[6 of 8] Compiling Network.Curl.Info <http://network.curl.info/> (
Network\Curl\Info.hs, dist\build\Network\Curl\Info.o )

    Warning: Defined but not used: `stringTag'

Network\Curl\Info.hs:83:0: Warning: Defined but not used: `longTag'

    Warning: Defined but not used: `doubleTag'

    Warning: Defined but not used: `slistTag'
[7 of 8] Compiling Network.Curl.Easy ( Network\Curl\Easy.hs,
dist\build\Network\Curl\Easy.o )
[8 of 8] Compiling Network.Curl     ( Network\Curl.hs,
dist\build\Network\Curl.o )
C:\Program Files\Haskell\bin\ar.exe: creating dist\build\libHScurl-1.3.4.a

$ runhaskell Setup.hs install
Installing library in C:\Program Files\Haskell\curl-1.3.4\ghc-6.10.1
Registering curl-1.3.4...
Reading package info from "dist\\installed-pkg-config" ... done.
Writing new package config file... done.

 In package.conf I have seen:
 InstalledPackageInfo {package = PackageIdentifier {pkgName = PackageName
"curl", pkgVersion = Version {versionBranch = [1,3,4], versionTags = []}},
license = BSD3, copyright = "", maintainer = "Sigbjorn Finne <
sigbjorn.finne at gmail.com>", author = "Sigbjorn Finne", stability = "",
homepage = "", pkgUrl = "", description = "libcurl is a client-side URL
transfer library, supporting FTP, FTPS, HTTP,\nHTTPS, SCP, SFTP, TFTP,
TELNET, DICT, LDAP, LDAPS and FILE.\nlibcurl supports SSL certificates, HTTP
POST, HTTP PUT, FTP uploading,\nHTTP form based upload, proxies, cookies,
user+password authentication\n(Basic, Digest, NTLM, Negotiate, Kerberos4),
file transfer resume,\nhttp proxy tunneling and more!\n\nThis package
provides a Haskell binding to libcurl.", category = "Network", exposed =
True, exposedModules = ["Network.Curl","Network.Curl.Code","
hiddenModules = [], importDirs = ["C:\\Program
Files\\Haskell\\curl-1.3.4\\ghc-6.10.1"], libraryDirs = ["C:\\Program
hsLibraries = ["HScurl-1.3.4"], extraLibraries = ["curl"],
extraGHCiLibraries = [], includeDirs = ["C:/temp/msys/1.0/local/include"],
includes = [], depends = [PackageIdentifier {pkgName = PackageName "base",
pkgVersion = Version {versionBranch = [3,0,3,0], versionTags =
[]}},PackageIdentifier {pkgName = PackageName "bytestring", pkgVersion =
Version {versionBranch = [0,9,1,4], versionTags = []}},PackageIdentifier
{pkgName = PackageName "containers", pkgVersion = Version {versionBranch =
[0,2,0,0], versionTags = []}}], hugsOptions = [], ccOptions = [], ldOptions
= [], frameworkDirs = [], frameworks = [], haddockInterfaces = ["C:\\Program
Files\\Haskell\\doc\\curl-1.3.4\\html\\curl.haddock"], haddockHTMLs =
["C:\\Program Files\\Haskell\\doc\\curl-1.3.4\\html"]}

In "C:\Program Files\Haskell\curl-1.3.4\ghc-6.10.1\" I have seen
HScurl-1.3.4.o , libHScurl-1.3.4.a  and other Curl files.

11. Final tests:
  under msys:
$ ghci
Prelude> :m Network.Curl
module `Network.Curl' is not loaded

Bad, but not a disaster.

under windows:
C:\> ghci
GHCi, version 6.10.1: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Prelude> :m Network.Curl

Prelude Network.Curl> let a = curlGet
Loading package syb ... linking ... done.
Loading package base- ... linking ... done.
Loading package array- ... linking ... done.
Loading package containers- ... linking ... done.
Loading package bytestring- ... linking ... done.
Loading package curl-1.3.4 ... <interactive>: curl: Не найден указанный
модуль. (text in russian here because of localized Vista. The message is
near "Can't load specified module")
can't load .so/.DLL for: curl (addDLL: could not load DLL)
Prelude Network.Curl>

So, the question is why curl doesn't work? I tried to use Cabal but it
failed with building too.
How can I test the fact that C:\temp\msys\1.0\local\bin\libcurl-4.dll is
used in curl-1.3.4 ?

Iliya Kuznetsov

Iliya Kuznetsov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090205/25caee52/attachment.htm

More information about the Haskell-Cafe mailing list