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: Tue, 18 Feb 2014 00:33:06 -0500

On Mon, 17 Feb 2014 19:17:11 +0100, "Gisle Vanem" <gvanem_at_yahoo.no> wrote:
> The '-lgdi32' must come after '-lcrypto' since ld is a one-pass linker.
> Not sure why it isn't. Then again, I don't trust autotools.

That was a good find, -lgdi32 before -lcrypto.
Okay this is intresting, ./configure is building the Makefile with these
entries:
...
LIBCURL_LIBS = -lssl -lcrypto -lgdi32 -lssl -lcrypto -lwldap32 -lz -lws2_32
LIBMETALINK_CPPFLAGS =
LIBMETALINK_LDFLAGS =
LIBMETALINK_LIBS =
LIBOBJS =
LIBS = -lssl -lcrypto -lgdi32 -lssl -lcrypto -lwldap32 -lz -lws2_32
...

So after I configure, I manually alter the Makefile to look like this
LIBCURL_LIBS = -lssl -lcrypto -lgdi32 -lwldap32 -lz -lws2_32
LIBMETALINK_CPPFLAGS =
LIBMETALINK_LDFLAGS =
LIBMETALINK_LIBS =
LIBOBJS =
LIBS = -lssl -lcrypto -lgdi32 -lwldap32 -lz -lws2_32

but it's only partly fixed and still crashes from a simialer reason
...
/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 -lssl
-lcrypto -lwldap32 -lz -lws2_32

libtool: link: i686-w64-mingw32-gcc -O2 -Wno-system-headers -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 -L/path/to/mingw32/lib ../lib/.libs/libcurl.a
-lgdi32 -lssl -lcrypto -lwldap32 -lz -lws2_32

/path/to/mingw32/lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0x1070):
undefined reference to `_imp__CreateDCW_at_16'
/path/to/mingw32/lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0x107e):
undefined reference to `_imp__CreateCompatibleDC_at_4'
/path/to/mingw32/lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0x1089):
undefined reference to `_imp__GetDeviceCaps_at_8'
/path/to/mingw32/lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0x10cd):
undefined reference to `_imp__CreateCompatibleBitmap_at_12'
/path/to/mingw32/lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0x10e4):
undefined reference to `_imp__SelectObject_at_8'
/path/to/mingw32/lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0x110a):
undefined reference to `_imp__GetObjectW_at_12'
/path/to/mingw32/lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0x11b7):
undefined reference to `_imp__BitBlt_at_36'
/path/to/mingw32/lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0x11cf):
undefined reference to `_imp__GetBitmapBits_at_12'
/path/to/mingw32/lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0x1249):
undefined reference to `_imp__DeleteObject_at_4'
/path/to/mingw32/lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0x124f):
undefined reference to `_imp__DeleteDC_at_4'
collect2: error: ld returned 1 exit status
make[2]: *** [curl.exe] Error 1
make[2]: Leaving directory `/path/to/mingw32/libcurl/curl-7.35.0/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/path/to/mingw32/libcurl/curl-7.35.0/src'
make: *** [all-recursive] Error 1

I manually redo the last command that failed with the -lssl and -lcrypto
corrections
$ 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 ..

finishes without error, then I just make again
$ PATH=$PATH:/path/to/mingw32/bin make
$ sudo make PATH=$PATH:/path/to/mingw32/bin install
But when I test the static-only buildt curl.exe
$ wine src/curl.exe
err:module:import_dll Library zlib1.dll (which is needed by
L"Z:\\path\\to\\mingw32\\libcurl\\curl-7.35.0\\src\\curl.exe") not found
err:module:LdrInitializeThunk Main exe initialization for
L"Z:\\path\\to\\mingw32\\libcurl\\curl-7.35.0\\src\\curl.exe" failed,
status c0000135
which I dont have, I only have the static zip libraries: libz.a libz.dll.a

I think you might be correct that autotools might not be building things
right

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