curl - 适用于 Windows 的最小 cURL 交叉编译

标签 curl libcurl mingw32 cross-compiling

我想从源代码编译 cURL 以在我的 Windows DLL 项目中使用。为此,我安装了一台带有 Ubuntu 的虚拟机,从 http://curl.haxx.se/download/curl-7.37.0.tar.bz2 下载了 cURL 源代码。 ,解压并配置如下:

    ./configure --prefix=$HOME/devel/curl3 --disable-ftp --disable-file\
 --disable-ldap --disable-dict --disable-telnet --disable-tftp\
 --disable-rtsp --disable-pop3 --disable-imap --disable-smtp\
 --disable-gopher --disable-ares --disable-debug --without-ssl\
 --without-zlib --without-libidn --build=i586-pc-linux-gnu\
 --host=i386-pc-mingw32 --disable-shared

所以我有这个输出:

configure: Configured to build curl/libcurl:

  curl version:     7.37.0
  Host setup:       i386-pc-mingw32
  Install prefix:   /home/victor/devel/curl3
  Compiler:         gcc
  SSL support:      no      (--with-{ssl,gnutls,nss,polarssl,cyassl,axtls,winssl,darwinssl} )
  SSH support:      no      (--with-libssh2)
  zlib support:     no      (--with-zlib)
  GSS-API support:  no      (--with-gssapi)
  SPNEGO support:   no      (--with-spnego)
  TLS-SRP support:  no      (--enable-tls-srp)
  resolver:         default (--enable-ares / --enable-threaded-resolver)
  ipv6 support:     no      (--enable-ipv6)
  IDN support:      no      (--with-{libidn,winidn})
  Build libcurl:    Shared=no, Static=yes
  Built-in manual:  enabled
  --libcurl option: enabled (--disable-libcurl-option)
  Verbose errors:   enabled (--disable-verbose)
  SSPI support:     no      (--enable-sspi)
  ca cert bundle:   no
  ca cert path:     no
  LDAP support:     no      (--enable-ldap / --with-ldap-lib / --with-lber-lib)
  LDAPS support:    no      (--enable-ldaps)
  RTSP support:     no      (--enable-rtsp)
  RTMP support:     no      (--with-librtmp)
  metalink support: no      (--with-libmetalink)
  HTTP2 support:    disabled (--with-nghttp2)
  Protocols:        HTTP

然后我只需执行 make & make install 来创建文件(libcurl.a 和 include/curl/)*。 一切运行正常,但问题是:当我导入生成的文件时,缺少一个 header : sys/socket.h。此 header 不是干净的 MingW32 安装的一部分,因此,使用 --host=i386-pc-mingw32 的配置命令不应需要它,因为 Windows 使用 Winsock,对吧?

我在这里缺少什么?

很抱歉问了这么长的问题,提前致谢。

最佳答案

我发现出了什么问题;

我必须下载 mingw32 软件包,然后将其设置为配置和制作命令的工具链。 --host 配置也错误。下载的工具链必须指向“i586-pc-mingw32msvc”,路径设置为:

PATH=(path/to/i586ming):$PATH ./configure <options described above>
PATH=(path/to/i586ming):$PATH make
PATH=(path/to/i586ming):$PATH make install

我的输出是正确的。

关于curl - 适用于 Windows 的最小 cURL 交叉编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24102240/

相关文章:

c - 如何为mingw32指定dll onload函数?

php - cURL 错误 35 - 连接到 api.rkd.reuters.com 时出现未知 SSL 协议(protocol)错误 :443

macos - 如何在 OSX El Capitan 上更新 cURL?

PHP cURL 自定义 header

c - 通过 curl 使用摘要身份验证

c++ - 在eclipse中编译c++时如何自动链接类?

c++ - g++ 不生成任何文件或提供任何输出

php - 在 cUrl php amazon linux 中安装 libssh

libcurl - 使用curl_easy_pause时缓冲区保存在哪里

c++ - 关于 MinGW32 的复制构造函数的疯狂 C++ 编译器错误消息