【问题标题】:Static linking libcurl using c使用c静态链接libcurl
【发布时间】:2011-11-08 22:26:44
【问题描述】:

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

我正在尝试编译如下。

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

我做错了吗? 有没有办法强制一些库的静态链接(例如 libc)?

【问题讨论】:

  • 您遇到的实际问题是什么?我猜 curl 位于另一个目录中......

标签: c curl gnu static-linking


【解决方案1】:

Libcurl 本身与ton 的其他库链接,其中大部分不包含在编译命令行中。例如,我的(在 Debian Squeeze 上)链接:

  • libc
  • libcom_err
  • libcrypto
  • libdl
  • libgcrypt
  • libgnutls
  • libgpg 错误
  • libgssapi_krb5
  • 利比登
  • libk5crypto
  • libkeyutils
  • libkrb5
  • libkrb5 支持
  • liblber-2.4
  • libldap_r-2.4
  • libpthread
  • libresolv
  • librt
  • libsasl2
  • libssh2
  • libssl
  • libtasn1
  • libz

(您可以通过在 Linux 上的库上运行 ldd 或在 Darwin 上运行 otool -L 来为自己获得类似的列表。)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-03-22
    • 1970-01-01
    • 2011-11-14
    • 1970-01-01
    • 2014-10-27
    • 2015-04-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多