This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problems linking against libcurl under cygwin


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jason Riffel wrote:
| Hi - New to Cygwin for development, not new to development.
|
| Have a project that uses libcurl which will not link under Cygwin.
All of the
| basic libcurl APIs show up as unresolved in the link process.
|
| Example:
|
| gcc -L/usr/local/lib -lcurl -shared ../../shared/htmlparse/htmlparse.o
../../sha
| red/wwwfetch/wwwfetch.o ../shared/free.o key.o -o key.so
| key.o(.text+0x3ae):key.c: undefined reference to `_curl_global_init'
| key.o(.text+0x3b3):key.c: undefined reference to `_curl_easy_init'
| key.o(.text+0x420):key.c: undefined reference to `_curl_easy_setopt'
| key.o(.text+0x42b):key.c: undefined reference to `_curl_easy_perform'
| key.o(.text+0x436):key.c: undefined reference to `_curl_easy_cleanup'
| collect2: ld returned 1 exit status
| make: *** [key.so] Error 1
|
[SNIP]
|
| Are there special linking requirements under Cygwin or something
obvious I'm
| missing?

Link libraries must be listed *AFTER* all object files and static
libraries.  So the following should work instead:

gcc -L/usr/local/lib -shared ../../shared/htmlparse/htmlparse.o
../../shared/wwwfetch/wwwfetch.o ../shared/free.o key.o -o key.so
`curl-config --libs`

Note that -lcurl isn't enough here, since curl depends on other
libraries (namely, from openssl-devel and zlib).

BTW, the Cygwin convention is to use the extenstion .dll for shared
libraries (except for Ruby modules, for reasons unknown to me).


Yaakov -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBjmU7piWmPGlmQSMRAqqfAJ98UCDaMBHVxYkAdu12iC8vr3snsgCfdJMf
JLOlydNDvEjob7E6nSl41ps=
=cNCe
-----END PGP SIGNATURE-----


-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]