cURL / Mailing Lists / curl-library / Single Mail

curl-library

cygwin and libcurl - problem with linking statically for linux - undefined symbols

From: Patryk - <nontoxic_1_at_hotmail.com>
Date: Sun, 15 Apr 2012 23:55:44 +0200

Hey,
I'm developing a .so library which uses libcurl. I need it to be linked
statically, and so far, libcurl does not want to be linked properly.

Anyway, here's my command line:

gcc-linux -DCURL_STATICLIB -Wl,-M,-t,-y,--verbose,-static -g -I. -I/usr/local/include
 -L/usr/local/lib -static-libgcc -Bstatic -shared -static main.c game.c
curl.c syscalls.c common.c detours.c admin.c pcon.c dc.c g_gdc.c qvm.c
qvm_detours.c game_dd.c -O0 qvm_calls.c -lc -lm -lcurl -o
out/jk2mpgamei386.so &> gcc.log

After checking on a real Unix system (debian lenny) with ldd, the library
has unresolved externals even though I linked it with -lcurl:

xxx_at_xxx:~/jk2$ ldd -r x/jk2mpgamei386.so
        statically linked
undefined symbol: curl_global_init (x/jk2mpgamei386.so)
undefined symbol: curl_global_cleanup (x/jk2mpgamei386.so)

I've installed libcurl in cygwin and all required files are in the
directories where they should be.

Could it be that there is something wrong with libcurl.a?
When I try to use -Wl,--whole-archive for -lcurl, it gives this error:

/usr/local/lib/libcurl.a: member /usr/local/lib/libcurl.a(file.o) in archive
is not an object

How is it possible that file.o is not an object file?!

Regards,
NTxC

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-04-15