cURL / Mailing Lists / curl-library / Single Mail

curl-library

libcurl.lib linking issues in MSVC 2005/ver 8

From: Kevin Lawler <kevin.lawler_at_gmail.com>
Date: Wed, 5 Dec 2007 14:52:38 -0500

Hello,

I'm trying to create a version of libcurl.lib that I can include statically
in a Windows program I'm writing. My end goal is to have all the
libcurl+ssl+zlib functionality inside my Windows executable, so if there is
an alternate way to accomplish what I'm thinking, I am open to suggestions.
I am trying hard not to have accompanying dll files in my setup
distribution. A precompiled working static libcurl.lib binary with
up-to-date ssl+zlib functionality would be ideal, though I have not been
able to find exactly that using a Google search, as each of the various
hosted binaries seem to be incomplete or deficient in some way.

So far I seem to have compiled the libcurl.lib successfully. When I try to
link it inside my windows executable, a number of errors fire off. It looks
like all the errors are related to ssl functions.

This is the process I went through to create my libcurl.lib. First I
downloaded the curl-7.17.1 source package. Then I downloaded openssl-0.9.8g.
I put both of these directories at the root of the C: drive. To compile
openssl I followed the direction in INSTALL.W32. First I installed
ActivePerl. Then I loaded up a prompt, and from the
C:\openssl-0.9.8gdirectory I ran

> perl Configure VC-WIN32 --prefix=c:/openssl
> ms\do_masm
>nmake -f ms\nt.mak
>nmake -f ms\nt.mak test
>nmake -f ms\nt.mak install
[note nt.mak and not ntdll.mak, for the static version]

Everything appeared to run fine without complaint. Both libeay32.lib and
ssleay32.lib showed up in C:\openssl-0.9.8g\out32.

Then I followed the Win32->'MSVC from command line' instructions in
libcurl's INSTALL file. I ran my corresponding vcvars32.bat, and set my path
using set OPENSSL_PATH=c:\openssl-0.9.8g (Note my 'g' where the help file
has 'e'. Also, I would later try this with a forward slash, as the output at
the end of the compile process has mismatching slashes. The version shown is
taken directly from the INSTALL file.) Then I ran 'nmake vc' and 'nmake
vc-ssl'.

The end of that output looks something like this (I have run it multiple
times, and it appears to change each time. This is what it looks like
currently.) :

        link.exe /incremental:no /libpath:"../lib" /nologo /out:curl.exe/subsys
tem:console /machine:X86 /LIBPATH:"c:/openssl-0.9.8g/out32" libcurl.lib
libeay3
2.lib ssleay32.lib gdi32.lib user32.lib advapi32.lib wsock32.lib wldap32.libwin
mm.lib hugehelpr.obj writeoutr.obj urlglobr.obj getpassr.obj
homedirr.obj c
urlutilr.obj strtoofftr.obj mainr.obj curlr.res

I then copy the libcurl.lib file from C:\curl-7.17.1\lib\release-ssl to the
root directory of my windows project. I have it set to include
libcurl.liband ws2_32.lib in Project->Properties->Configuration
Properties->Linker->Input : Additional Dependencies.

I also have C:\curl-7.17.1\include listed in my 'Additional Include'
directories. At the beginning of the source file I have

#include <curl/curl.h>

and I have variously defined CURL_STATICLIB using

 #define CURL_STATICLIB

at the beginning of the source file and

-DCURL_STATICLIB

as a command-line option. This command line option is present in the
C/C++->Command Line settings and not in the Linker->Command Line settings.

The errors I get are as follows:

1>Linking...
1>libcurl.lib(sslgen.obj) : error LNK2019: unresolved external symbol
_SSL_pending referenced in function _Curl_ssl_data_pending
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_RAND_status referenced in function _rand_enough
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_RAND_file_name referenced in function _ossl_seed
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_RAND_screen referenced in function _ossl_seed
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_RAND_load_file referenced in function _ossl_seed
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_CTX_check_private_key referenced in function _cert_stuff
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_free referenced in function _cert_stuff
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_EVP_PKEY_free referenced in function _cert_stuff
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_EVP_PKEY_copy_parameters referenced in function _cert_stuff
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_get_privatekey referenced in function _cert_stuff
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_X509_get_pubkey referenced in function _cert_stuff
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_get_certificate referenced in function _cert_stuff
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_new referenced in function _cert_stuff
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_CTX_use_PrivateKey_file referenced in function _cert_stuff
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_CTX_use_certificate_file referenced in function _cert_stuff
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_CTX_use_certificate_chain_file referenced in function _cert_stuff
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_CTX_set_default_passwd_cb referenced in function _cert_stuff
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_CTX_set_default_passwd_cb_userdata referenced in function _cert_stuff
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_X509_NAME_oneline referenced in function _cert_verify_callback
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_X509_get_subject_name referenced in function _cert_verify_callback
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_X509_STORE_CTX_get_current_cert referenced in function
_cert_verify_callback
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_ERR_error_string_n referenced in function _SSL_strerror
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_library_init referenced in function _Curl_ossl_init
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_load_error_strings referenced in function _Curl_ossl_init
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_EVP_cleanup referenced in function _Curl_ossl_cleanup
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_ERR_free_strings referenced in function _Curl_ossl_cleanup
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_peek referenced in function _Curl_ossl_check_cxn
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_CTX_free referenced in function _Curl_ossl_close
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_set_connect_state referenced in function _Curl_ossl_close
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_shutdown referenced in function _Curl_ossl_close
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_ERR_error_string referenced in function _Curl_ossl_shutdown
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_ERR_get_error referenced in function _Curl_ossl_shutdown
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_get_error referenced in function _Curl_ossl_shutdown
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_read referenced in function _Curl_ossl_shutdown
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_SESSION_free referenced in function _Curl_ossl_session_free
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_ERR_remove_state referenced in function _Curl_ossl_close_all
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_CRYPTO_free referenced in function _verifyhost
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_ASN1_STRING_to_UTF8 referenced in function _verifyhost
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_CRYPTO_malloc referenced in function _verifyhost
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_ASN1_STRING_type referenced in function _verifyhost
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_X509_NAME_ENTRY_get_data referenced in function _verifyhost
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_X509_NAME_get_entry referenced in function _verifyhost
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_X509_NAME_get_index_by_NID referenced in function _verifyhost
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_GENERAL_NAMES_free referenced in function _verifyhost
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_ASN1_STRING_length referenced in function _verifyhost
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_ASN1_STRING_data referenced in function _verifyhost
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_sk_value referenced in function _verifyhost
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_sk_num referenced in function _verifyhost
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_X509_get_ext_d2i referenced in function _verifyhost
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_set_fd referenced in function _Curl_ossl_connect_step1
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_set_session referenced in function _Curl_ossl_connect_step1
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_CTX_set_verify referenced in function _Curl_ossl_connect_step1
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_CTX_load_verify_locations referenced in function
_Curl_ossl_connect_step1
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_CTX_set_cipher_list referenced in function _Curl_ossl_connect_step1
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_CTX_ctrl referenced in function _Curl_ossl_connect_step1
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_CTX_callback_ctrl referenced in function _Curl_ossl_connect_step1
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_CTX_new referenced in function _Curl_ossl_connect_step1
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_TLSv1_client_method referenced in function _Curl_ossl_connect_step1
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSLv2_client_method referenced in function _Curl_ossl_connect_step1
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSLv3_client_method referenced in function _Curl_ossl_connect_step1
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSLv23_client_method referenced in function _Curl_ossl_connect_step1
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_CIPHER_get_name referenced in function _Curl_ossl_connect_step2
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_get_current_cipher referenced in function _Curl_ossl_connect_step2
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_connect referenced in function _Curl_ossl_connect_step2
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_X509_verify_cert_error_string referenced in function
_Curl_ossl_connect_step3
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_get_verify_result referenced in function _Curl_ossl_connect_step3
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_X509_get_issuer_name referenced in function _Curl_ossl_connect_step3
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_X509_free referenced in function _Curl_ossl_connect_step3
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_get_peer_certificate referenced in function _Curl_ossl_connect_step3
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_get1_session referenced in function _Curl_ossl_connect_step3
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSL_write referenced in function _Curl_ossl_send
1>libcurl.lib(ssluse.obj) : error LNK2019: unresolved external symbol
_SSLeay referenced in function _Curl_ossl_version
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol
__imp__ldap_unbind_s referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol
__imp__ldap_msgfree referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol
__imp__ldap_next_entry referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol
__imp__ber_free referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol
__imp__ldap_next_attribute referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol
__imp__ldap_memfree referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol
__imp__ldap_value_free_len referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol
__imp__ldap_get_values_len referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol
__imp__ldap_first_attribute referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol
__imp__ldap_get_dn referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol
__imp__ldap_first_entry referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol
__imp__ldap_search_s referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol
__imp__ldap_simple_bind_s referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol
__imp__ldap_init referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol
__imp__ldap_set_option referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol
__imp__ldap_err2string referenced in function _Curl_ldap
1>libcurl.lib(http_ntlm.obj) : error LNK2019: unresolved external symbol
_DES_set_key referenced in function _setup_des_key
1>libcurl.lib(http_ntlm.obj) : error LNK2019: unresolved external symbol
_DES_set_odd_parity referenced in function _setup_des_key
1>libcurl.lib(http_ntlm.obj) : error LNK2019: unresolved external symbol
_DES_ecb_encrypt referenced in function _lm_resp
1>libcurl.lib(http_ntlm.obj) : error LNK2019: unresolved external symbol
_MD4_Final referenced in function _mk_nt_hash
1>libcurl.lib(http_ntlm.obj) : error LNK2019: unresolved external symbol
_MD4_Update referenced in function _mk_nt_hash
1>libcurl.lib(http_ntlm.obj) : error LNK2019: unresolved external symbol
_MD4_Init referenced in function _mk_nt_hash
1>libcurl.lib(http_ntlm.obj) : error LNK2019: unresolved external symbol
_MD5_Final referenced in function _Curl_output_ntlm
1>libcurl.lib(http_ntlm.obj) : error LNK2019: unresolved external symbol
_MD5_Update referenced in function _Curl_output_ntlm
1>libcurl.lib(http_ntlm.obj) : error LNK2019: unresolved external symbol
_MD5_Init referenced in function _Curl_output_ntlm
1>libcurl.lib(http_ntlm.obj) : error LNK2019: unresolved external symbol
_RAND_bytes referenced in function _Curl_output_ntlm
1>Release\Project.exe : fatal error LNK1120: 98 unresolved externals

Any help would be appreciated.

Thank you
Received on 2007-12-05