将 libssl 与 nmake 一起使用

发布于 2024-11-03 03:20:26 字数 3331 浏览 0 评论 0原文

    LIBS =   ws2_32.lib winmm.lib advapi32.lib  crypt32.lib user32.lib gdi32.lib   libeay32.lib ssleay32.lib 

OSCOMPAT = /DWIN32 /D_WIN32_WINNT=0x0400
VSCOMPAT = /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE  
CFLAGS= -I . -I$C /MT /W3 $(OSCOMPAT) $(VSCOMPAT) -nologo $(EXTRACFLAGS)

test: $(CCLIENTLIB) test.obj oauth.obj hash.obj oauth_http.obj xmalloc.obj 
    LINK /NOLOGO mtest.obj oauth.obj hash.obj oauth_http.obj xmalloc.obj  $(LIBS) 


test.obj:test.c 
oauth.obj: oauth.c
hash.obj: hash.c
oauth_http.obj: oauth.h oauth_http.c
xmalloc.obj: xmalloc.c

我收到以下错误

    LINK /NOLOGO test.obj oauth.obj hash.obj oauth_http.obj xmalloc.obj    ws2_32.lib winmm.lib advapi32.lib  crypt32.lib user32.lib gdi32.lib   libeay32.lib ssleay32.lib
hash.obj : error LNK2019: unresolved external symbol HMAC referenced in function oauth_sign_hmac_sha1_raw
hash.obj : error LNK2019: unresolved external symbol EVP_sha1 referenced in function oauth_sign_hmac_sha1_raw
hash.obj : error LNK2019: unresolved external symbol EVP_PKEY_free referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol CRYPTO_free referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol EVP_SignFinal referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol EVP_DigestUpdate referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol EVP_DigestInit referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol EVP_PKEY_size referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol BIO_free referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol PEM_read_bio_PrivateKey referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol BIO_new_mem_buf referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol EVP_MD_CTX_cleanup referenced in function oauth_verify_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol EVP_VerifyFinal referenced in function oauth_verify_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol PEM_read_bio_PUBKEY referenced in function oauth_verify_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol X509_free referenced in function oauth_verify_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol X509_get_pubkey referenced in function oauth_verify_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol PEM_read_bio_X509 referenced in function oauth_verify_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol EVP_DigestFinal referenced in function oauth_body_hash_file
hash.obj : error LNK2019: unresolved external symbol EVP_MD_size referenced in function oauth_body_hash_file
hash.obj : error LNK2019: unresolved external symbol EVP_MD_CTX_init referenced in function oauth_body_hash_file
test.exe : fatal error LNK1120: 20 unresolved externals

make file 中的问题是什么。 如何将 libssl 与我的应用程序链接?

您可以从此处下载代码 https://rapidshare.com/files/458792519/test.rar (它包括来自 liboauth 的代码)

    LIBS =   ws2_32.lib winmm.lib advapi32.lib  crypt32.lib user32.lib gdi32.lib   libeay32.lib ssleay32.lib 

OSCOMPAT = /DWIN32 /D_WIN32_WINNT=0x0400
VSCOMPAT = /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE  
CFLAGS= -I . -I$C /MT /W3 $(OSCOMPAT) $(VSCOMPAT) -nologo $(EXTRACFLAGS)

test: $(CCLIENTLIB) test.obj oauth.obj hash.obj oauth_http.obj xmalloc.obj 
    LINK /NOLOGO mtest.obj oauth.obj hash.obj oauth_http.obj xmalloc.obj  $(LIBS) 


test.obj:test.c 
oauth.obj: oauth.c
hash.obj: hash.c
oauth_http.obj: oauth.h oauth_http.c
xmalloc.obj: xmalloc.c

I am getting following errors

    LINK /NOLOGO test.obj oauth.obj hash.obj oauth_http.obj xmalloc.obj    ws2_32.lib winmm.lib advapi32.lib  crypt32.lib user32.lib gdi32.lib   libeay32.lib ssleay32.lib
hash.obj : error LNK2019: unresolved external symbol HMAC referenced in function oauth_sign_hmac_sha1_raw
hash.obj : error LNK2019: unresolved external symbol EVP_sha1 referenced in function oauth_sign_hmac_sha1_raw
hash.obj : error LNK2019: unresolved external symbol EVP_PKEY_free referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol CRYPTO_free referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol EVP_SignFinal referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol EVP_DigestUpdate referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol EVP_DigestInit referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol EVP_PKEY_size referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol BIO_free referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol PEM_read_bio_PrivateKey referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol BIO_new_mem_buf referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol EVP_MD_CTX_cleanup referenced in function oauth_verify_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol EVP_VerifyFinal referenced in function oauth_verify_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol PEM_read_bio_PUBKEY referenced in function oauth_verify_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol X509_free referenced in function oauth_verify_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol X509_get_pubkey referenced in function oauth_verify_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol PEM_read_bio_X509 referenced in function oauth_verify_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol EVP_DigestFinal referenced in function oauth_body_hash_file
hash.obj : error LNK2019: unresolved external symbol EVP_MD_size referenced in function oauth_body_hash_file
hash.obj : error LNK2019: unresolved external symbol EVP_MD_CTX_init referenced in function oauth_body_hash_file
test.exe : fatal error LNK1120: 20 unresolved externals

what is the problem in make file .
how to link libssl with my app ?

you can download code from here
https://rapidshare.com/files/458792519/test.rar
(it includes code from liboauth )

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅唱々樱花落 2024-11-10 03:20:26

为了总结 OP 评论中的对话,我下载了示例代码并对其运行了 nmake (makefile.nt)。我确实遇到了链接器错误,但缺少的符号来自 Win32 库。我将 user32.lib 和 gdi32.lib 添加到 makefile 中的 LIBS 列表中,然后干净地链接(该构建适用于 VS2005、VS2008 和 VS2010)。

正如OP指出的那样,在添加这两个额外的库时它也干净地链接起来。我不清楚这将如何帮助解析 libeay32.lib 中的这些符号。所以我怀疑对 make 文件的更改导致了所有 .obj 文件的完全重建和编译。完全干净的构建使其正常工作。所以也许(我只是猜测).obj 文件最初编译不正确(编译器可能与链接器不能很好地工作?)并且完全重建使一切保持一致。

To summarize the conversation in the comments on the OP, I downloaded the example code and ran nmake against it (makefile.nt). I did get linker errors but the missing symbols were from Win32 libs. I added user32.lib and gdi32.lib to the LIBS list in the makefile and it then linked cleanly (the build worked with VS2005, VS2008, and VS2010).

As the OP points out, it also linked cleanly when adding those two additional libraries. It is not clear to me how that would help resolve those symbols from libeay32.lib. So my suspicion is that the change to the make file resulted in a full rebuild and compile of all .obj files. The full clean build resulted in it working. So maybe (I'm just guessing) the .obj files were compiled incorrectly originally (compiler that didn't work well with the linker perhaps?) and the full rebuild made everything consistent.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文