cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Curl, Openssl and Makefile.m32

From: Niall Twomey <twomers_at_gmail.com>
Date: Sun, 9 Sep 2007 16:41:12 +0100

Thanks again for your reply, Guenter.

I've got some good news and bad news ... The good news is that it
built and everything so I thought I'd get the latest daily and build
it ... the method should be the same:

1) cmd prompt
2) run the bat file defining the roots to both the zlib and openssl libraries
3) mingw32

First thing works :) But the mingw32-make mingw32-ssl didn't so I wen
to the lib directory and tried mingw32-make -f Makefile.m32 SSL=1
ZLIB=1. They're essentially the same thing, right? I was also getting
an error from urldata.h (line 97), in the makefile so I changed the
line (previously: #include </zlib.h>), to #include
<../../zlib-1.2.3/include/zlib.h>, and that fixed that, but I'm
confused as to why it didn't work this time when it did before ...

Anyway all the .o files are made fine now :) But I got one more error:

> C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot find -lz
> collect2: ld returned 1 exit status
> mingw32-make: *** [libcurl.dll] Error 1

which comes after:

> gcc -s -shared -Wl,--out-implib,libcurldll.a \
          -o libcurl.dll /* .o files */ libcurl.res
-Lc:/projects/mingw32/openssl-0.9.8e/out -leay32 -lssl32
-LC:/projects/mingw32/zlib-1.2.3 -lz -lwldap32 -lws2_32
-lwinmm

At a guess though I changed the -lz parameter in the makefile to
-lzip1 and it completed OK. It needed a bit of twinkering to work
fully though which made me unsure if I did it right.

Did I?

Anyway I tested it in a program and I'm getting linker errors: "error
LNK2019: unresolved external symbol __imp__curl_easy_cleanup
referenced in function _main". To remind ye I'm using MSVC 03 .NET on
XP SP2. I pointed the compiler to the directories OK (it compiles
fine, just doesn't build or run).

I'm making this simple https program:

#include <curl/curl.h>

int main(void) {
  CURL *curl;
  CURLcode res;

  curl = curl_easy_init();
  if(curl) {
    curl_easy_setopt(curl, CURLOPT_URL, "https://sourceforge.net/");

#ifdef SKIP_PEER_VERIFICATION
    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
#endif

#ifdef SKIP_HOSTNAME_VERFICATION
    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
#endif

    res = curl_easy_perform(curl);

    curl_easy_cleanup(curl);
  }
  return 0;
}

I just noticed it didn't make me a .lib file ... is that a problem? I
really haven't much/any experience in building libraries so please
bear with me.

Thanks for all the help so far! Niall
Received on 2007-09-09