使用静态链接到openssl构建libcurl [英] Building libcurl with static linking to openssl

查看:91
本文介绍了使用静态链接到openssl构建libcurl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用与libssl的静态链接来构建libcurl.为此,我使用了以下配置:

I am trying to build libcurl with static linking to openssl. So to achieve that, I have used following configuration:

OpenSSL:

LDFLAGS="-static"
LIBS="-ldl"

cURL:

LDFLAGS="-static"
CPPFLAGS="-I$(CURDIR)/$(3RDPARTY_DIR)$(OPENSSL)/include   
LDFLAGS="-L$(CURDIR)/$(3RDPARTY_DIR)$(OPENSSL)"
./configure --disable-shared --without-zlib --without-libidn --without-librtmp --disable-ldap —-with-ssl=<path where my openssl is installed>

以此,我将生成libcurl.a并将其链接到我的代码,在该代码中,我可以根据需要成功处理HTTPS连接.

With this, I am to generate libcurl.a and link it to my code where I am successfully able to handle HTTPS connections, as per my need.

但是出于学习目的,我想知道SSL符号是否实际上集成到libcurl中.因此,我尝试使用 nm 命令:

But for the sake of learning purpose, I wanted to know are SSL symbols actually integrated into libcurl or not. So for that, I tried using nm command:

nm -A libcurl.a | grep "SSL_"

但是它将所有SSL符号显示为Undefined.例如,

But it shows all SSL symbols as Undefined. For example,

U SSL_connect
U SSL_ctrl

那么这是否意味着libssl.a和libcrypto.a中的符号实际上并未集成到libcurl中?

So does it mean that symbols from libssl.a and libcrypto.a are NOT actually integrated into libcurl?

如果是,该怎么做才能将它们实际集成到libcurl.a中?

If yes, what can be done to actually integrate them into libcurl.a?

感谢您提供任何帮助,以帮助我理解这一点.

Any help is appreciated to help me understand this.

推荐答案

是的,这意味着OpenSSL符号没有集成到libcurl中.

Yes, it means that the OpenSSL symbols are not integrated into libcurl.

构建静态版本的libcurl时,会得到一个适用于静态链接的 libcurl.a 文件.但是,然后您还需要在链接器命令行上同时提供所有(静态)依赖项库,通常不必先将它们全部链接到一个静态库中.(如果您希望完成此操作,则必须自己完成; curl构建系统不会执行此操作.)

When you build a static version of libcurl, you get a libcurl.a file suitable for static linking. But you then need to also provide all the (static) dependency libraries as well on the linker command line, you don't normally link them all together into a single static lib first. (If you want that done, you will have to do it yourself; the curl build system won't do it.)

当您想将应用程序与构建为使用静态OpenSSL的静态libcurl链接时,可以链接您的应用程序,并在链接器命令行上提供所有必需的库.在* nix上,这意味着 -lcurl -lcrypto -lssl ...

When you want to link your application with a static libcurl built to use a static OpenSSL, you link your application and provide all the necessary libs on the linker command line. On a *nix that means -lcurl -lcrypto -lssl...

(大多数libcurl构建也将使用其他依赖项).

(Most libcurl builds will also use additional dependencies).

这篇关于使用静态链接到openssl构建libcurl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆