RE: RE: RE: RE: RE: Linker errors when statically compiled linking libcurl+openssl to my project
Steve Holme wrote: Mmmm very strange. I must admit I don't include SSH or RTMP support (at the moment) when I build libcurl here. I use Visual Studio (and have solution and project files for .NET 2003 (v7.1), 2005 (v8.0), 2008 (v9.0) and 2010 (v10.0)) and have them configured to build against OpenSSL (as a DLL rather than statically) and to include NTLM support. Are you building RTMP yourself, or do you have a pre-built version? I didn't build RTMP, seems that some of libs I included uses it Steve Holme wrote: Visual Studio uses a 2 pass linker. gnu-ld does not. The OP may have to reorder the libs in the link-command. -lws2_32 (missing htonl@4 etc.) should come after all other libs referring to those functions. g++ -DCURL_STATICLIB -DUSE_LIBSSH2 -DHAVE_LIBSSH2 -DCURL_DISABLE_LDAP -DHAVE_LIBSSH2_H -DLIBSSH2_WIN32 -DLIBSSH2_LIBRARY -DUSE_SSLEAY -O0 -g3 -Wall -c -fmessage-length=0 -osrc\CURLDown.o ..\src\CURLDown.cpp g++ -L../lib -oCURLDown.exe src\CURLDown.o -lcurl -lcrypto -lwinmm -lgdi32 -lwldap32 -leay32 -lidn -lrtmp -lssh2 -lz -lssl32 -lssl -lws2_32 Now I get only one error!! ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0xb45): undefined reference to `timeGetTime@0' --- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
RE: RE: RE: RE: RE: Linker errors when statically compiled linking libcurl+openssl to my project
g++ -DCURL_STATICLIB -DUSE_LIBSSH2 -DHAVE_LIBSSH2 -DCURL_DISABLE_LDAP -DHAVE_LIBSSH2_H -DLIBSSH2_WIN32 -DLIBSSH2_LIBRARY -DUSE_SSLEAY -O0 -g3 -Wall -c -fmessage-length=0 -osrc\CURLDown.o ..\src\CURLDown.cpp g++ -L../lib -oCURLDown.exe src\CURLDown.o -lcurl -lcrypto -lgdi32 -lwldap32 -leay32 -lidn -lrtmp -lssh2 -lz -lssl32 -lssl -lws2_32 -lwinmm It built without errors!! But when I ran it's just terminated, just like there - http://curl.haxx.se/mail/lib-2011-08/0161.html And dependency walkers says that IESHIMS.DLL, LIBIDN-11.DLL and LIBSSL32 is missing --- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
RE: Linker errors when statically compiled linking libcurl+openssl to my project
Hi, I am trying to statically link libcurl (with SSL) into my project but I am encountering lots of linker errors: ../lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0xa9c): undefined reference to `CreateDCA@16' ../lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0xaa9): undefined reference to `CreateCompatibleDC@4' ../lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0xaba): undefined reference to `GetDeviceCaps@8' Looking at rand_win.c it uses CreateDCA, CreateCompatiableDC(), GetDeciceCaps() etc... which are defined in gdi32.lib. ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x1b3b): undefined reference to `inet_addr@4' ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x1ba4): undefined reference to `inet_addr@4' ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x5d1e): undefined reference to `htonl@4' ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x5eed): undefined reference to `ntohl@4' These are defined in ws2_32.lib. What libraries is your application linking against? I'm not a MinGW / Eclipse user but it looks like you will need to add gdi32.lib and ws2_32.lib to your project. Kind Regards Steve --- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
RE: RE: Linker errors when statically compiled linking libcurl+openssl to my project
Looking at rand_win.c it uses CreateDCA, CreateCompatiableDC(), GetDeciceCaps() etc... which are defined in gdi32.lib. These are defined in ws2_32.lib. What libraries is your application linking against? I'm not a MinGW / Eclipse user but it looks like you will need to add gdi32.lib and ws2_32.lib to your project. ws2_32.lib was already linked, I added gdi32.lib. Errors decreased. The following remain g++ -DCURL_STATICLIB -DUSE_LIBSSH2 -DHAVE_LIBSSH2 -DCURL_DISABLE_LDAP -DHAVE_LIBSSH2_H -DLIBSSH2_WIN32 -DLIBSSH2_LIBRARY -DUSE_SSLEAY -O0 -g3 -Wall -c -fmessage-length=0 -osrc\CURLDown.o ..\src\CURLDown.cpp ..\src\CURLDown.cpp:18: warning: 'int writer(char*, size_t, size_t, std::string*)' defined but not used g++ -L../lib -oCURLDown.exe src\CURLDown.o -lcurl -lcrypto -lws2_32 -lwldap32 -leay32 -lidn -lrtmp -lssh2 -lz -lssl32 -lssl -lgdi32 ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x1b3b): undefined reference to `inet_addr@4' ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x1ba4): undefined reference to `inet_addr@4' ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x5d1e): undefined reference to `htonl@4' ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x5eed): undefined reference to `ntohl@4' ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x6f9a): undefined reference to `htonl@4' ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x728d): undefined reference to `htonl@4' ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x732c): undefined reference to `htonl@4' ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x757f): undefined reference to `ntohl@4' ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0xb45): undefined reference to `timeGetTime@0' ../lib/librtmp.a(hashswf.o):hashswf.c:(.text+0x164): undefined reference to `inet_addr@4' --- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
RE: RE: Linker errors when statically compiled linking libcurl+openssl to my project
Hiya, ws2_32.lib was already linked, I added gdi32.lib. Errors decreased. The following remain ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x1b3b): undefined reference to `inet_addr@4' ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x732c): undefined reference to `htonl@4' ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x757f): undefined reference to `ntohl@4' Interesting. These are definitely in ws2_32.lib. ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0xb45): undefined reference to `timeGetTime@0' I just had to check MSDN for this one - and it says this function is defined in winmm.lib. I'm not too familiar with librtmp, so I just downloaded the source for it and checked out it's makefile which includes the following when building with mingw: -lws2_32 -lwinmm -lgdi32 Can you add -winmm and see if that decreases the number of errors by 1? If not, then there is something else going wrong (as the unresolved externals for ws2_32 have got me baffled at the minute)! S. --- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
RE: RE: RE: RE: Linker errors when statically compiled linking libcurl+openssl to my project
I just had to check MSDN for this one - and it says this function is defined in winmm.lib. I'm not too familiar with librtmp, so I just downloaded the source for it and checked out it's makefile which includes the following when building with mingw: -lws2_32 -lwinmm -lgdi32 Can you add -winmm and see if that decreases the number of errors by 1? If not, then there is something else going wrong (as the unresolved externals for ws2_32 have got me baffled at the minute)! Looks like this changes nothing :( g++ -DCURL_STATICLIB -DUSE_LIBSSH2 -DHAVE_LIBSSH2 -DCURL_DISABLE_LDAP -DHAVE_LIBSSH2_H -DLIBSSH2_WIN32 -DLIBSSH2_LIBRARY -DUSE_SSLEAY -O0 -g3 -Wall -c -fmessage-length=0 -osrc\CURLDown.o ..\src\CURLDown.cpp ..\src\CURLDown.cpp:18: warning: 'int writer(char*, size_t, size_t, std::string*)' defined but not used g++ -L../lib -oCURLDown.exe src\CURLDown.o -lcurl -lcrypto -lws2_32 -lwinmm -lgdi32 -lwldap32 -leay32 -lidn -lrtmp -lssh2 -lz -lssl32 -lssl ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x1b3b): undefined reference to `inet_addr@4' ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x1ba4): undefined reference to `inet_addr@4' ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x5d1e): undefined reference to `htonl@4' ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x5eed): undefined reference to `ntohl@4' ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x6f9a): undefined reference to `htonl@4' ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x728d): undefined reference to `htonl@4' ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x732c): undefined reference to `htonl@4' ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0x757f): undefined reference to `ntohl@4' ../lib/librtmp.a(rtmp.o):rtmp.c:(.text+0xb45): undefined reference to `timeGetTime@0' ../lib/librtmp.a(hashswf.o):hashswf.c:(.text+0x164): undefined reference to `inet_addr@4' --- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
RE: RE: RE: RE: Linker errors when statically compiled linking libcurl+openssl to my project
Hiya, Can you add -winmm and see if that decreases the number of errors by 1? If not, then there is something else going wrong (as the unresolved externals for ws2_32 have got me baffled at the minute)! Looks like this changes nothing :( Mmmm very strange. I must admit I don't include SSH or RTMP support (at the moment) when I build libcurl here. I use Visual Studio (and have solution and project files for .NET 2003 (v7.1), 2005 (v8.0), 2008 (v9.0) and 2010 (v10.0)) and have them configured to build against OpenSSL (as a DLL rather than statically) and to include NTLM support. Are you building RTMP yourself, or do you have a pre-built version? S. --- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html