在 mac os x 10.6 上为 mingw32 (Windows) 编译 libcurl
我正在为 mingw32 编译 libcurl,如下所示:
./configure --prefix=/Users/daniel/mingw32 "CFLAGS= -ABI=32"
make
make install
但是当使用 mingw32-gcc 编译程序时:
i386-mingw32-gcc -lcurl -o bin/remote-win.exe remote.c
我得到:
In file included from /Users/daniel/mingw32/usr/local/include/curl/curl.h:34,
from remote.c:6:
/Users/daniel/mingw32/usr/local/include/curl/curlbuild.h:152:26: sys/socket.h: No such file or directory
In file included from /Users/daniel/mingw32/usr/local/include/curl/curl.h:34,
from remote.c:6:
/Users/daniel/mingw32/usr/local/include/curl/curlbuild.h:165: error: syntax error before "curl_socklen_t"
In file included from /Users/daniel/mingw32/usr/local/include/curl/curl.h:35,
from remote.c:6:
/Users/daniel/mingw32/usr/local/include/curl/curlrules.h:143: error: size of array `__curl_rule_01__' is negative
/Users/daniel/mingw32/usr/local/include/curl/curlrules.h:153: error: size of array `__curl_rule_02__' is negative
我很确定错误是因为 windows 上不存在curl_socklen_t。我已经尝试过 --target=--mingw32 但仍然没有成功。
请帮助
配置结束:
curl 版本:7.21.4 主机设置: x86_64-apple-darwin10.6.0 安装 前缀:/Users/daniel/mingw32
编译器:gcc SSL 支持:
启用 (OpenSSL) SSH 支持:
没有(--with-libssh2)zlib 支持:启用 krb4 支持:
没有(--with-krb4*)GSSAPI 支持:否(--with-gssapi)
SPNEGO 支持:否
(--with-spnego) TLS-SRP 支持:无 (--enable-tls-srp) 解析器:
默认(--enable-ares / --enable-threaded-resolver) ipv6 支持:启用 IDN 支持:
无(--with-libidn)构建 libcurl:共享=是,静态=是
内置手册:启用 Verbose 错误:已启用(--disable-verbose)
SSPI 支持:无
(--enable-sspi) ca 证书捆绑包:否 ca 证书路径:不支持 LDAP:
启用 (OpenLDAP) LDAPS 支持:
已启用 RTSP 支持:已启用
RTMP 支持:无
(--with-librtmp) 协议:
DICT 文件 FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3 POP3S RTSP SMTP SMTPS TELNET TFTP
I'm compiling libcurl for mingw32 as follows:
./configure --prefix=/Users/daniel/mingw32 "CFLAGS= -ABI=32"
make
make install
But when compiling a program using mingw32-gcc:
i386-mingw32-gcc -lcurl -o bin/remote-win.exe remote.c
i get:
In file included from /Users/daniel/mingw32/usr/local/include/curl/curl.h:34,
from remote.c:6:
/Users/daniel/mingw32/usr/local/include/curl/curlbuild.h:152:26: sys/socket.h: No such file or directory
In file included from /Users/daniel/mingw32/usr/local/include/curl/curl.h:34,
from remote.c:6:
/Users/daniel/mingw32/usr/local/include/curl/curlbuild.h:165: error: syntax error before "curl_socklen_t"
In file included from /Users/daniel/mingw32/usr/local/include/curl/curl.h:35,
from remote.c:6:
/Users/daniel/mingw32/usr/local/include/curl/curlrules.h:143: error: size of array `__curl_rule_01__' is negative
/Users/daniel/mingw32/usr/local/include/curl/curlrules.h:153: error: size of array `__curl_rule_02__' is negative
I'm pretty sure the error is because curl_socklen_t does not exist on windows. I've tried --target=--mingw32 but still no success.
Please help
End of configured for:
curl version: 7.21.4 Host setup:
x86_64-apple-darwin10.6.0 Install
prefix: /Users/daniel/mingw32
Compiler: gcc SSL support:
enabled (OpenSSL) SSH support:
no (--with-libssh2) zlib
support: enabled krb4 support:
no (--with-krb4*) GSSAPI
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: enabled IDN support:
no (--with-libidn) Build
libcurl: Shared=yes, Static=yes
Built-in manual: enabled Verbose
errors: enabled (--disable-verbose)
SSPI support: no
(--enable-sspi) ca cert bundle: no
ca cert path: no LDAP support:
enabled (OpenLDAP) LDAPS support:
enabled RTSP support: enabled
RTMP support: no
(--with-librtmp) Protocols:
DICT FILE FTP FTPS GOPHER HTTP HTTPS
IMAP IMAPS LDAP LDAPS POP3 POP3S RTSP
SMTP SMTPS TELNET TFTP
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好像 mingw 没有 sys/socket.h 。刚刚检查了我的新 mingw 本机安装。
因此,您的应用程序无法移植到 mingw(或者配置运行错误)。也许您应该在邮件列表中搜索或询问 http://curl.haxx.se
感谢您的配置输出。您确实为 MacOSX 本身配置了curl,而不是为mingw 进行交叉构建。您应该强制配置使用 mingw 的 gcc,还应该添加交叉编译选项(至少是“--target”选项)。
Seems like mingw have no
sys/socket.h
. Just checked on my fresh mingw native install.So, your application is not portable to mingw (or configure run was wrong). May be you should search or ask in Mailing List at http://curl.haxx.se
Thanks for your configure output. You did configed the curl for MacOSX itself, not for a cross-build for mingw. Your should force configure to use mingw's gcc, also you should to add cross-compilation options (at least '--target' option).