cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker mailing list Archives

[ curl-Bugs-3064852 ] fail configure at cross compile in mingw on Linux

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Sat, 18 Sep 2010 21:42:13 +0000

Bugs item #3064852, was opened at 2010-09-12 19:11
Message generated for change (Settings changed) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=3064852&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: compile or build problem
Group: None
>Status: Pending
>Resolution: Later
Priority: 5
Private: No
Submitted By: pavelvat (pavelvat)
Assigned to: Daniel Stenberg (bagder)
Summary: fail configure at cross compile in mingw on Linux

Initial Comment:
operating system: Arch Linux
version of curl: 7.21.1

fail configure curl for static build(Dependencies mingw32-openssl-static mingw32-zlib-static).
see attach file.

I solved this problem this way:
line 19496 from file "configure", containing "LIBS="-lssl $LIBS""
replaced this line: LIBS="-lssl $LIBS -lz"

Excerpt from the log file config.log containing messages about
"undefined reference" from which I understood what was the problem:
configure:19490: checking for SSL_connect in -lssl
configure:19512: i486-mingw32-gcc -o conftest.exe -g0 -O2 -Wno-system-headers -I/usr/i486-mingw32/include -I/usr/i486-mingw32/include/openssl -L/usr/i486-mingw32/lib conftest.c -lssl -lcrypto -lgdi32 -lws2_32 >&5
/usr/i486-mingw32/lib/libcrypto.a(c_zlib.o):c_zlib.c:(.text+0x6d): undefined reference to `_inflateEnd'
/usr/i486-mingw32/lib/libcrypto.a(c_zlib.o):c_zlib.c:(.text+0x89): undefined reference to `_deflateEnd'
/usr/i486-mingw32/lib/libcrypto.a(c_zlib.o):c_zlib.c:(.text+0x39a): undefined reference to `_deflate'
/usr/i486-mingw32/lib/libcrypto.a(c_zlib.o):c_zlib.c:(.text+0x488): undefined reference to `_zError'
/usr/i486-mingw32/lib/libcrypto.a(c_zlib.o):c_zlib.c:(.text+0x56b): undefined reference to `_inflate'
/usr/i486-mingw32/lib/libcrypto.a(c_zlib.o):c_zlib.c:(.text+0x5c8): undefined reference to `_zError'
/usr/i486-mingw32/lib/libcrypto.a(c_zlib.o):c_zlib.c:(.text+0x66b): undefined reference to `_inflateInit_'
/usr/i486-mingw32/lib/libcrypto.a(c_zlib.o):c_zlib.c:(.text+0x756): undefined reference to `_deflate'
/usr/i486-mingw32/lib/libcrypto.a(c_zlib.o):c_zlib.c:(.text+0x7d8): undefined reference to `_zError'
/usr/i486-mingw32/lib/libcrypto.a(c_zlib.o):c_zlib.c:(.text+0x84a): undefined reference to `_deflateInit_'
/usr/i486-mingw32/lib/libcrypto.a(c_zlib.o):c_zlib.c:(.text+0x933): undefined reference to `_inflate'
/usr/i486-mingw32/lib/libcrypto.a(c_zlib.o):c_zlib.c:(.text+0x9cf): undefined reference to `_deflate'
/usr/i486-mingw32/lib/libcrypto.a(c_zlib.o):c_zlib.c:(.text+0xa04): undefined reference to `_inflateEnd'
/usr/i486-mingw32/lib/libcrypto.a(c_zlib.o):c_zlib.c:(.text+0xa0f): undefined reference to `_deflateEnd'
/usr/i486-mingw32/lib/libcrypto.a(c_zlib.o):c_zlib.c:(.text+0xab4): undefined reference to `_inflateInit_'
/usr/i486-mingw32/lib/libcrypto.a(c_zlib.o):c_zlib.c:(.text+0xb20): undefined reference to `_deflateInit_'
collect2: ld returned 1 exit status
configure:19512: $? = 1
configure: failed program was:

----------------------------------------------------------------------

Comment By: Daniel Stenberg (bagder)
Date: 2010-09-15 18:25

Message:
pkg-config is a concept to store exactly this kind of information. I don't
know if OpenSSL makes it easy or not to generate output data for it. That's
a topic to check with the OpenSSL docs/team.

In order to have the configure test figure this on its own it will need to
be fixed. It has to retry failed OpenSSL checks with dependency libs added
to LIBS, where -lz is an obvious candidate and I'm convinced there's a risk
that others might be used as well.

So yes, it is a flaw or a bug, but not one that I consider to be very
important as it is so easy to work around and since it isn't causing
trouble to users that often - combined with the somewhat awkward fix that
is needed to make it work properly.

I personally have no plans to address this within the nearest future.

----------------------------------------------------------------------

Comment By: pavelvat (pavelvat)
Date: 2010-09-15 18:05

Message:
I want to build curl statically and with statically
dependencies(mingw32-openssl-static and mingw32-zlib-static), using package
from repository AUR:
http://aur.archlinux.org/packages.php?ID=24257
Build instructions:
http://aur.archlinux.org/packages/mingw32-curl-static/mingw32-curl-static/PKGBUILD

Tell me how I can automatically add the flag-lz in the file "config"
without manual editing.
"by using pkg-config" - I unfamiliar pkg-config, you can show an example
how to add-lz to LIBS?

----------------------------------------------------------------------

Comment By: Daniel Stenberg (bagder)
Date: 2010-09-15 13:36

Message:
config.log is the interesting file after configure has failed. The failure
you showed before was indeed proving that the problem is OpenSSL related.

Let me repeat myself: your OpenSSL has been built to use zlib, so when
curl's configure script runs to check for OpenSSL features it fails to
link because it doesn't explicitly add -lz. If it had used a dynamic
OpenSSL, it would've handled those dependencies by elf magic. If you had
had openssl info provided by pkg-config, the configure script would know
how to link correctly.

As it is now, it fails to link with OpenSSL when testing for OpenSSL and
thus concludes it doesn't work.

This can be fixed/worked-around by extending the configure check, by using
a shared OpenSSL, by using pkg-config, by manually providing -lz in LIBS or
similar.

----------------------------------------------------------------------

Comment By: pavelvat (pavelvat)
Date: 2010-09-15 01:44

Message:
After adding the option --disable-shared:
...
checking if we need BUILDING_LIBCURL... yes
checking if we need CURL_STATICLIB... yes
...
checking for SSL_connect in -lssl... no
checking for ssl with RSAglue/rsaref libs in use... checking for
SSL_connect in -lssl... (cached) no
no
configure: error: OpenSSL libs and/or directories were not found where
specified!

full configure out: http://pastebin.com/iUhvPgaC

After all, the reason is not in OpenSSL, but the fact that gcc must
explicitly specify the library libz.a, passing the flag -lz.

----------------------------------------------------------------------

Comment By: Daniel Stenberg (bagder)
Date: 2010-09-12 23:18

Message:
Well, take a look again at the file you attached here and you'll see what I
meant. Your pastebin log is _completely_ different and of course shows
something else than what I just complained about.

AFAICT, this is a problem with the OpenSSL installed that it needs the
zlib when building test programs to check for OpenSSL but I'm not really
sure what the best way to deal with that problem is. If there's no
pkg-config for OpenSSL, the only way for curl's configure would be to
re-try a failed test with -lz added to LIBS I believe. In general the
configure script is not very good at detecting static OpenSSL libs under
these circumstances, cross-compiled or not. Since the work-around is fairly
easy, I'm not sure I'm really up to rewriting the check magic to do zlib
retrying. Are you?

----------------------------------------------------------------------

Comment By: pavelvat (pavelvat)
Date: 2010-09-12 20:21

Message:
"correct those errors first" - I don't understand. about what errors are
you talking? that we should fix?

I wrote a reason:
in file "config.log" containing messages about "undefined reference"

see lines 2644-2741:
http://pastebin.com/iAX2uJR4

----------------------------------------------------------------------

Comment By: Daniel Stenberg (bagder)
Date: 2010-09-12 19:18

Message:
The attached output shows how configure bailed out early since it failed to
build with the given OpenSSL options. Was that really the output from the
configure you invoked then it really is no surprise that things didn't
work. I would advice that you correct those errors first, then rerun
configure and then see if the zlib stuff works.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=3064852&group_id=976
Received on 2010-09-18

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET