configure:4535: gcc -o conftest -g -O2 conftest.c 1>&5
configure:4597: checking for socket
Glynn,
Yes, this is a mystery. I use Debian because it is low on quirks and
glitches.
The problem is with the -lz switch. When I compile my test code with:
cc -lz testdeflate.c
it also returns:
cannot find -lz
It seems like everything is where it should be. zlib is in /usr/lib. I added
additional links to /usr/liblibz.so and /usr/lib/libz to
/usr/lib/libz.so.1.1.4 just in case that was the problem.
I also tried --with-zlib-libs=/usr/lib, but the problem remained.
This must be rare and quirky, I Googled it and found problems only on Sun
and OsX machines.
Here is the full section:
configure:4623: gcc -o conftest -g -O2 conftest.c 1>&5
configure:4694: checking for location of zlib includes
configure:4720: checking for zlib.h
configure:4728: gcc -E conftest.c >/dev/null 2>conftest.out
configure:4762: checking for location of zlib library
configure:4787: checking for deflate in -lz
configure:4804: gcc -o conftest -g -O2 conftest.c -lz 1>&5
/usr/bin/ld cannot find -lz
collect2 ld returned 1 exit status
configure: failed program was:
#line 4793 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char deflate();
int main() {
deflate()
; return 0; }
Oh, and I knew that my code wouldn't work as such, I was just hoping to
duplicate and isolate the same test so I could trouble shoot it without adding
more to the list server. It would now be easier to run the Grass5.02 binaries,
like I have on other machines, but this is bothering me now. Here I am anyway.
Thanks for the input.
Jim
===== Original Message From Glynn Clements <glynn.clements@virgin.net> =====
Jim Browne wrote:The last part of the logfile states:
configure: failed program was:
I need to see the lines immediately before that, which will contain
the actual error messages. In general, you should quote everything
related to that check, i.e. from the "checking ..." line down to the
start of the next check (including the first line of the following
check confirms that you really have included everything).However, given the limited number of things which can go wrong with a
library as simple as zlib, the error is probably "cannot find -lz" (or
something with an equivalent meaning).In which case, you would need to use --with-zlib-libs=???, where ???
is the directory where zlib (e.g. libz.a, libz.so) resides (e.g.
/usr/local/lib).However, I find it rather odd that zlib isn't found automatically on a
Linux system. Every Linux system I've ever seen has zlib installed,
and has it in /usr/lib, where the linker will find it without the need
for any -L switches.On commercial Unices, it is often elsewhere (e.g. /usr/local/lib,
/sw/lib), and non-Unix systems (e.g. Windows/Cygwin or MacOSX) may not
even have it, but it's pretty common nowadays (zlib implements the
"gzip" compression/decompression algorithms).#line 4793 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid and error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char deflate();int main() {
deflate()
; return 0; }If this is a small test program, I don't see what it does.
The compiled object (.o) file will have a dependency upon the
deflate() function, so the program won't link if the deflate()
function isn't available from the libraries against which it is
linked.The test program is never run; the test only checks whether it is
linked successfully.When compiled on
its own, the compiler complains "undefined reference to deflate" and stops.That is to be expected. The actual test will use the -lz switch, and
possibly one or more -L switches (if you used --with-zlib-libs=...).
The deflate() function isn't likely to be in the C library (libc), so
linking won't succeed without additional libraries. The function will
certainly be in zlib, so the only remaining factor is to ensure that
the -lz switch works given whichever -L switches are used.However, when I add:
#include <zlib.h>
then it only complains of "too few arguments to function 'deflate'" before
it
stops.
That is also to be expected. Given that the program is never actually
run, it only matters that a call to the function occurs. It doesn't
matter whether the call has the correct arguments.What is this testing, and how do I get around this?
It's testing that programs which depend upon deflate() can be built.
In practice, that means that it's testing whether it can find zlib,
i.e. whether --with-zlib-libs=... is necessary and, if so, that it was
used, and with a suitable argument.--
Glynn Clements <glynn.clements@virgin.net>