threads / bug / 14182

BUG (v1.5.6.1): ./configure missing check for zlib.h

Subject: BUG (v1.5.6.1): ./configure missing check for zlib.h

## tl;dr

6 messages between Jun 27, 2008 and Jun 29, 2008.

replies: 5people: 4as markdown or json

Mircea Bardac· Jun 27, 2008, 12:30 UTC · lore

$ ./configure configure: CHECKS for programs checking for cc... cc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether cc accepts -g... yes checking for cc option to accept ANSI C... none needed checking for gar... no checking for ar... ar checking for gtar... no checking for tar... tar checking for asciidoc... no configure: CHECKS for libraries checking for SHA1_Init in -lcrypto... no checking for SHA1_Init in -lssl... no checking for curl_global_init in -lcurl... no checking for XML_ParserCreate in -lexpat... no checking for iconv in -lc... yes checking for deflateBound in -lz... no checking for socket in -lc... yes configure: CHECKS for header files checking how to run the C preprocessor... cc -E checking for egrep... grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking sys/select.h usability... yes checking sys/select.h presence... yes checking for sys/select.h... yes checking for old iconv()... no configure: CHECKS for typedefs, structures, and compiler characteristics checking for struct dirent.d_ino... yes checking for struct dirent.d_type... yes checking for struct sockaddr_storage... yes checking for struct addrinfo... yes checking for getaddrinfo... yes checking whether formatted IO functions support C99 size specifiers... yes checking whether system succeeds to read fopen'ed directory... no checking whether snprintf() and/or vsnprintf() return bogus value... no configure: CHECKS for library functions checking for strcasestr... yes checking for memmem... yes checking for strlcpy... no checking for strtoumax... yes checking for setenv... yes checking for unsetenv... yes checking for mkdtemp... yes configure: CHECKS for site configuration configure: creating ./config.status config.status: creating config.mak.autogen

$ make
GIT_VERSION = 1.5.6.1
     * new build flags or prefix
     CC daemon.o
In file included from daemon.c:1:
cache.h:9:18: error: zlib.h: No such file or directory
make: *** [daemon.o] Error 1
(installing zlib1g-dev on Ubuntu 7.10 fixed the problem)

-- Mircea http://mircea.bardac.net

Jakub Narebski· Jun 27, 2008, 14:46 UTC · re: Mircea Bardac · lore

Re: BUG (v1.5.6.1): ./configure missing check for zlib.h

Mircea Bardac <dev@mircea.bardac.net> writes:
> $ ./configure
[...]
> configure: CHECKS for header files

Here ./configure check for existence of heder files, but only those that can be skipped by defining some macro...

> configure: CHECKS for site configuration
...and here is check for --with-zlib=<path to zlib>
Show 12 quoted lines
> configure: creating ./config.status
> config.status: creating config.mak.autogen
> 
> $ make
> GIT_VERSION = 1.5.6.1
>      * new build flags or prefix
>      CC daemon.o
> In file included from daemon.c:1:
> cache.h:9:18: error: zlib.h: No such file or directory
> make: *** [daemon.o] Error 1
> 
> (installing zlib1g-dev on Ubuntu 7.10 fixed the problem)

What should ./configure do (what ./configure for other programs or packages do)?

You cannot compile git without zlib!
-- 
Jakub Narebski
Poland
ShadeHawk on #git
tom fogal· Jun 27, 2008, 15:07 UTC · re: Jakub Narebski · lore

Re: BUG (v1.5.6.1): ./configure missing check for zlib.h

Jakub Narebski <jnareb@gmail.com> writes:
Show 13 quoted lines
> Mircea Bardac <dev@mircea.bardac.net> writes:
> 
> > $ ./configure
> [...]
> > configure: CHECKS for header files
> > In file included from daemon.c:1:
> > cache.h:9:18: error: zlib.h: No such file or directory
> > make: *** [daemon.o] Error 1
> > 
> > (installing zlib1g-dev on Ubuntu 7.10 fixed the problem)
> 
> What should ./configure do (what ./configure for other programs
> or packages do)?

If one can determine during configure time that a required library is not found, it (IMHO) is nice to give an error message and bomb out (via AC_MSG_ERROR).

The AC macro archive has a zlib macro which does this, as an example:
   http://autoconf-archive.cryp.to/check_zlib.html

I should note, however, that I disagree with that macro's logic in that it `searches' for zlib if the user does not specify it. IMO, if the user does not give a --with option, and it doesn't work `out of the box' (without hacking FLAGS), macros should die with an error rather than retry with changed FLAGS.

-tom
Jakub Narebski· Jun 27, 2008, 23:03 UTC · re: tom fogal · lore

Re: BUG (v1.5.6.1): ./configure missing check for zlib.h

On Fri, 27 Jun 2008, tom fogal wrote:
Show 30 quoted lines
> Jakub Narebski <jnareb@gmail.com> writes:
>> Mircea Bardac <dev@mircea.bardac.net> writes:
>> 
>>> $ ./configure
>> [...]
>>> configure: CHECKS for header files
>>> In file included from daemon.c:1:
>>> cache.h:9:18: error: zlib.h: No such file or directory
>>> make: *** [daemon.o] Error 1
>>> 
>>> (installing zlib1g-dev on Ubuntu 7.10 fixed the problem)
>> 
>> What should ./configure do (what ./configure for other programs
>> or packages do)?
>> 
>> You cannot compile git without zlib!
> 
> If one can determine during configure time that a required library is
> not found, it (IMHO) is nice to give an error message and bomb out (via
> AC_MSG_ERROR).
> 
> The AC macro archive has a zlib macro which does this, as an example:
> 
>    http://autoconf-archive.cryp.to/check_zlib.html
> 
> I should note, however, that I disagree with that macro's logic in that
> it `searches' for zlib if the user does not specify it.  IMO, if the
> user does not give a --with option, and it doesn't work `out of the
> box' (without hacking FLAGS), macros should die with an error rather
> than retry with changed FLAGS.
On Fri, 27 Jun 2008, Mircea Bardac wrote:
>
> Well, as far as I know, if a program depends on any external headers, 
> they should *all* be checked, not only "those that can be skipped by 
> defining some macro" (I personally do not know which are these).

In git (not like usually in other projects) ./configure script (autoconf) is used *only* to generate Makefile configuration. It tries to configure compile (build) process in such a way that building git is possible even if some features are missing or are found not in standard place (and also use compat version of functions if they are not in library). It helps you build system.

I'm not sure if checking if prerequisites exists and failing loudly otherwise would be a good feature to have. Git would fail anyway during build process, so it is not some new feature. The only advantage is that required and unavoidable dependency would be found earlier; on the other hand there is now disadvantage of build process (./configure process) if it misdetects lack of needed header files, i.e. it is possible to compile (build) git, but ./configure detects that it is not so. This happened once to me, and is very annoying...

But as they say, "code speaks louder than words"
-- 
Jakub Narebski
Poland
Ian Hilt· Jun 29, 2008, 03:13 UTC · re: tom fogal · lore

Re: BUG (v1.5.6.1): ./configure missing check for zlib.h

On Fri, 27 Jun 2008 at 11:07am -0000, tom fogal wrote:
Show 7 quoted lines
> I should note, however, that I disagree with that macro's logic in that
> it `searches' for zlib if the user does not specify it.  IMO, if the
> user does not give a --with option, and it doesn't work `out of the
> box' (without hacking FLAGS), macros should die with an error rather
> than retry with changed FLAGS.
> 
> -tom
Or, one could read the INSTALL file included with git,
 - Git is reasonably self-sufficient, but does depend on a few external
   programs and libraries:
	- "zlib", the compression library. Git won't build without it.
-- 
Ian Hilt
Ian.Hilt (at) gmx.com
GnuPG key: 0x4AFC1EE3
Mircea Bardac· Jun 27, 2008, 15:15 UTC · re: Jakub Narebski · lore

Re: BUG (v1.5.6.1): ./configure missing check for zlib.h

Jakub Narebski wrote:
Show 8 quoted lines
> Mircea Bardac <dev@mircea.bardac.net> writes:
> 
>> $ ./configure
> [...]
>> configure: CHECKS for header files
> 
> Here ./configure check for existence of heder files, but only those
> that can be skipped by defining some macro...
Show 8 quoted lines
> [...]
>>
>> (installing zlib1g-dev on Ubuntu 7.10 fixed the problem)
> 
> What should ./configure do (what ./configure for other programs
> or packages do)?
> 
> You cannot compile git without zlib!

Well, as far as I know, if a program depends on any external headers, they should *all* be checked, not only "those that can be skipped by defining some macro" (I personally do not know which are these).

Mircea

-- http://mircea.bardac.net

← back to recent threads