1
votes

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

1
What is your configure output? Only at the end, from the line "configure: Configured to build curl/libcurl: "osgx
@osgx i also get checking for sys/socket.h... (cached) yes the end line is aboveDaniel
@Daniel, your configure done for MacOS, not for mingw. "--prefix" sets only install directory, but configure knows nothing about your mingw compiler and environment. Updated the answer.osgx
@osgx Ok thanks for the answer. i'll try it and tell you if it worked or notDaniel
Daniel, try a ' i386-pc-mingw32 ' for target and specify a CC parameter. Compiler line from configure output must begin with "Compiler: i386-mingw32-gcc "osgx

1 Answers

0
votes

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).