2017-05-30 46 views
0

我试图用CodeBlocks构建静态链接的OpenSSL + LibCurl控制台应用程序。但是,我无法让它工作。我不断收到这些错误:使用Autotools和MinGW静态链接OpenSSL和cURL

||=== Build: Debug in Filer (compiler: GNU GCC Compiler) ===| 
C:\MinGW\msys\1.0\local\lib\libcurl.a(libcurl_la-openssl.o)|| undefined reference to `SSL_get0_alpn_selected'| 
C:\MinGW\msys\1.0\local\lib\libcurl.a(libcurl_la-openssl.o)|| undefined reference to `SSL_CTX_set_alpn_protos'| 
C:\MinGW\msys\1.0\local\lib\libcurl.a(libcurl_la-openssl.o)|| undefined reference to `SSL_CTX_set_next_proto_select_cb'| 
C:\MinGW\msys\1.0\local\lib\libcurl.a(libcurl_la-openssl.o)|| undefined reference to `SSL_CTX_set_srp_username'| 
C:\MinGW\msys\1.0\local\lib\libcurl.a(libcurl_la-openssl.o)|| undefined reference to `SSL_CTX_set_srp_password'| 
C:\MinGW\msys\1.0\local\lib\libcurl.a(libcurl_la-openssl.o)|| undefined reference to `SSL_COMP_free_compression_methods'| 
||=== Build failed: 6 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===| 

这是生成日志:

mingw32-g++.exe -o bin\Debug\Filer.exe "obj\Debug\MinGW Sources\BASE64\base64.o 
" "obj\Debug\MinGW Sources\SQLite\sqlite3.o" obj\Debug\Users\thoma\Desktop\Filer 
\main.o -static -lcurl -lrtmp -lidn -lssl -lssh2 -lcrypto -lz -lwldap32 -lws2_ 
32 -lwinmm -lgdi32 C:\MinGW\msys\1.0\local\lib\libcrypto.dll.a C:\MinGW\msys\1.0 
\local\lib\libcurl.a C:\MinGW\msys\1.0\local\lib\libcurl.dll.a C:\MinGW\msys\1.0 
\local\lib\libssl.a C:\MinGW\msys\1.0\local\lib\libssl.dll.a C:\MinGW\msys\1.0\l 
ocal\lib\libwxjpeg-3.0.a C:\MinGW\msys\1.0\local\lib\libwxpng-3.0.a C:\MinGW\msy 
s\1.0\local\lib\libwxscintilla-3.0.a C:\MinGW\msys\1.0\local\lib\libwxtiff-3.0.a 
C:\MinGW\msys\1.0\local\lib\libz.a C:\MinGW\msys\1.0\local\lib\libz.dll.a 

我用它概括here的设置。

我设置的一些照片:

enter image description hereenter image description hereenter image description hereenter image description hereenter image description here

+0

你的命令行是否有'-L <卷曲库文件夹路径>'? – user4581301

+0

@ user4581301,不是我能找到的吗?我已经添加了构建日志和设置的一些图片 –

+0

命令行看起来有点奇怪。 '-lcurl'表示curl中的链接,但没有'-L'来告诉链接器在哪里找到它。查看“搜索目录”选项卡上是否有任何内容允许您指定链接程序搜索目录。另一方面,您已经指定了看起来像共享库版本的链接信息的确切位置。既然你想静态链接,我认为你可以没有这种生活。 – user4581301

回答

0

你有你的OpenSSL版本,并通过使用libcurl的OpenSSL的版本不匹配。

+0

好的,这似乎相关。我该如何解决这个问题,以及如何验证两个版本? –

+0

你想我重建我的设置? –

+1

解决它实际上非常棘手,你可能必须重新编译'libcurl'本身。 – arboreal84