[GRASSLIST:1886] RE: configuring Grass5.03 on Debian

Glynn Clements glynn.clements at virgin.net
Tue Nov 25 21:46:58 EST 2003


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 at virgin.net>




More information about the grass-user mailing list