cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [Bulk] Re: Trying to cross compile libcurl with MinGW 32-bit from Ubuntu, for Win32 Executables

From: <libcurl_at_double.net23.net>
Date: Wed, 19 Feb 2014 21:09:40 -0500

HOWTO: compile 32-bit libcurl static libraries with MinGW in Ubuntu
$ sudo mv /path/to/mingw32/lib/libz.dll.a
/path/to/mingw32/lib/disablelibz.dll.a
$ PATH=$PATH:/path/to/mingw32/bin ./configure --host=i686-w64-mingw32
--with-zlib=/path/to/mingw32 --prefix=/path/to/mingw32 --enable-static
--disable-shared
$ PATH=$PATH:/path/to/mingw32/bin make
$ cd src/
$ PATH=$PATH:/path/to/mingw32/bin /bin/bash ../libtool --tag=CC
--mode=link i686-w64-mingw32-gcc -O2 -Wno-system-headers
-L/path/to/mingw32/lib -o curl.exe curl-tool_binmode.o curl-tool_bname.o
curl-tool_cb_dbg.o curl-tool_cb_hdr.o curl-tool_cb_prg.o curl-tool_cb_rea.o
curl-tool_cb_see.o curl-tool_cb_wrt.o curl-tool_cfgable.o
curl-tool_convert.o curl-tool_dirhie.o curl-tool_doswin.o
curl-tool_easysrc.o curl-tool_formparse.o curl-tool_getparam.o
curl-tool_getpass.o curl-tool_help.o curl-tool_helpers.o
curl-tool_homedir.o curl-tool_hugehelp.o curl-tool_libinfo.o
curl-tool_main.o curl-tool_metalink.o curl-tool_mfiles.o curl-tool_msgs.o
curl-tool_operate.o curl-tool_operhlp.o curl-tool_panykey.o
curl-tool_paramhlp.o curl-tool_parsecfg.o curl-tool_setopt.o
curl-tool_sleep.o curl-tool_urlglob.o curl-tool_util.o curl-tool_vms.o
curl-tool_writeenv.o curl-tool_writeout.o curl-tool_xattr.o
../lib/curl-strtoofft.o ../lib/curl-strdup.o ../lib/curl-rawstr.o
../lib/curl-nonblock.o ../lib/libcurl.la -lssl -lcrypto -lgdi32 -lwldap32
-lz -lws2_32
$ cd ..
$ PATH=$PATH:/path/to/mingw32/bin make
$ sudo make PATH=$PATH:/path/to/mingw32/bin install
$ sudo mv /path/to/mingw32/lib/disablelibz.dll.a
/path/to/mingw32/lib/libz.dll.a
'wine curl.exe' works just fine :)

and 64-bit, pretty much the same
$ sudo mv /path/to/mingw64/lib/libz.dll.a
/path/to/mingw64/lib/disablelibz.dll.a
$ PATH=$PATH:/path/to/mingw64/bin ./configure --host=x86_64-w64-mingw32
--with-zlib=/path/to/mingw64 --prefix=/path/to/mingw64 --enable-static
--disable-shared
$ PATH=$PATH:/path/to/mingw64/bin make
$ cd src/
$ PATH=$PATH:/path/to/mingw64/bin /bin/bash ../libtool --tag=CC
--mode=link x86_64-w64-mingw32-gcc -O2 -Wno-system-headers
-L/path/to/mingw64/lib -o curl.exe curl-tool_binmode.o curl-tool_bname.o
curl-tool_cb_dbg.o curl-tool_cb_hdr.o curl-tool_cb_prg.o curl-tool_cb_rea.o
curl-tool_cb_see.o curl-tool_cb_wrt.o curl-tool_cfgable.o
curl-tool_convert.o curl-tool_dirhie.o curl-tool_doswin.o
curl-tool_easysrc.o curl-tool_formparse.o curl-tool_getparam.o
curl-tool_getpass.o curl-tool_help.o curl-tool_helpers.o
curl-tool_homedir.o curl-tool_hugehelp.o curl-tool_libinfo.o
curl-tool_main.o curl-tool_metalink.o curl-tool_mfiles.o curl-tool_msgs.o
curl-tool_operate.o curl-tool_operhlp.o curl-tool_panykey.o
curl-tool_paramhlp.o curl-tool_parsecfg.o curl-tool_setopt.o
curl-tool_sleep.o curl-tool_urlglob.o curl-tool_util.o curl-tool_vms.o
curl-tool_writeenv.o curl-tool_writeout.o curl-tool_xattr.o
../lib/curl-strtoofft.o ../lib/curl-strdup.o ../lib/curl-rawstr.o
../lib/curl-nonblock.o ../lib/libcurl.la -lssl -lcrypto -lgdi32 -lwldap32
-lz -lws2_32
$ cd ..
$ PATH=$PATH:/path/to/mingw64/bin make
$ sudo make PATH=$PATH:/path/to/mingw64/bin install
$ sudo mv /path/to/mingw64/lib/disablelibz.dll.a
/path/to/mingw64/lib/libz.dll.a

I think I found in the config.log where it is adding the libraries twice:
configure:20945: checking if argv can be written to
configure:20963: i686-w64-mingw32-gcc -o conftest.exe -O2
-Wno-system-headers -I/path/to/mingw32/include -L/path/to/mingw32/lib
conftest.c -lwldap32 -lz -lws2_32 >&5
configure:20963: $? = 0
configure:20963: ./conftest.exe
configure:20963: $? = 0
configure:20981: result: yes
configure:21009: checking if SPNEGO support is requested
configure:21032: result: no
configure:21073: checking if GSSAPI support is requested
configure:21202: result: no
configure:21263: checking whether to enable Windows native SSL/TLS (Windows
native builds only)
configure:21285: result: no
configure:21301: checking whether to enable iOS/Mac OS X native SSL/TLS
configure:21317: result: no
configure:21383: checking for i686-w64-mingw32-pkg-config
configure:21417: result: no
configure:21427: checking for pkg-config
configure:21446: found /usr/bin/pkg-config
configure:21458: result: /usr/bin/pkg-config
configure:21482: checking for openssl options with pkg-config
configure:21496: result: found
configure:21524: pkg-config: SSL_LIBS: "-lssl -lcrypto "
configure:21526: pkg-config: SSL_LDFLAGS: " "
configure:21528: pkg-config: SSL_CPPFLAGS: " "
configure:21542: checking for gdi32
configure:21557: i686-w64-mingw32-gcc -o conftest.exe -O2
-Wno-system-headers -I/path/to/mingw32/include -L/path/to/mingw32/lib
conftest.c -lgdi32 -lssl -lcrypto -lwldap32 -lz -lws2_32 >&5
configure:21557: $? = 0
configure:21558: result: yes
configure:21571: checking for CRYPTO_lock in -lcrypto
configure:21593: i686-w64-mingw32-gcc -o conftest.exe -O2
-Wno-system-headers -I/path/to/mingw32/include -L/path/to/mingw32/lib
conftest.c -lcrypto -lgdi32 -lssl -lcrypto -lwldap32 -lz -lws2_32 >&5
configure:21593: $? = 0
configure:21602: result: yes
configure:21665: checking for SSL_connect in -lssl
configure:21687: i686-w64-mingw32-gcc -o conftest.exe -O2
-Wno-system-headers -I/path/to/mingw32/include -L/path/to/mingw32/lib
conftest.c -lssl -lcrypto -lgdi32 -lssl -lcrypto -lwldap32 -lz -lws2_32
>&5
configure:21687: $? = 0
configure:21696: result: yes
configure:21770: checking openssl/x509.h usability
configure:21770: i686-w64-mingw32-gcc -c -O2 -Wno-system-headers
-I/path/to/mingw32/include conftest.c >&5

but I don't know why, or how to fix it. swapping
- LIBS="-lgdi32 $LIBS"
+ LIBS="$LIBS -lgdi32"
didn't fix it, i think because it might be the order in which it's added.
but it's definitely on the correct track.

I don't think I can compile it as a shared library yet because I think I'm
missing some shared dependency libraries
If I get closer to getting it to do shared libraries I'll post what I find.

Thank you all for your help

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-02-20