静态链接的libcurl采用c [英] Static linking libcurl using c

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

问题描述

我在我的Linux机器上C和GNU编译器应用程序中使用libcurl的。
应用程序还使用OpenSSL库和其他一些库。我想静态链接库,除了 lcurl 与其他库链接正常工作。

I am using Libcurl in my application with C and GNU compiler on a linux machine. Application also uses OpenSSL libraries and some other libraries. I am trying to statically link the libraries, except for lcurl linking with other libraries works fine.

我想下面编译。

gcc -static -I. -o test test.c -lz -lssl -lcrypto -lcurl

难道我做错了什么?
有没有办法来迫使一些librairies的静态链接(libc中的为例)?

Am I doing anything wrong? Is there a way to force static linking of some librairies (libc for exemple) ?

推荐答案

的libcurl本身针对的的其他库,其中大部分是不包含在你的编译命令行的链接。例如,矿(在Debian挤压)对链接:

Libcurl is itself linked against a ton of other libraries, most of which aren't included in your compile command line. For instance, mine (on Debian Squeeze) links against:


  • 的libc

  • libcom_err

  • libcrypto

  • libdl

  • libgcrypt

  • libgnutls

  • 的libgpg错误

  • libgssapi_krb5

  • libidn这个

  • libk5crypto

  • libkeyutils

  • libkrb5

  • libkrb5support

  • liblber-2.4

  • libldap_r-2.4

  • 的libpthread

  • libresolv库

  • librt

  • libsasl2

  • libssh2

  • 的libssl

  • libtasn1

  • libz进行

(您可以通过运行 LDD 在Linux上的图书馆,或 otool -L 达尔文。)

(You can get a similar list for yourself by running ldd on the library on Linux, or otool -L on Darwin.)

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

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