delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/09/24/19:22:47

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Wed, 24 Sep 2003 19:22:28 -0400 (EDT)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Mark Himsley <mark AT mdsh DOT com>
cc: cygwin AT cygwin DOT com
Subject: Re: Linking with zlib
In-Reply-To: <54590953.1064448066@[192.168.0.40]>
Message-ID: <Pine.GSO.4.56.0309241916310.3193@slinky.cs.nyu.edu>
References: <54590953.1064448066@[192.168.0.40]>
Importance: Normal
MIME-Version: 1.0

On Thu, 25 Sep 2003, Mark Himsley wrote:

> I'm sorry if I sound ignorant but I've been looking at this problem for a
> few days and I'm lost. I have googled but failed to find a relevant answer.
>
> I have been trying to compile mergelog <http://mergelog.sourceforge.net/>
> (or more importantly zmergelog which is built from the same source file)
> under Cygwin.
>
> Zmergelog is a fairly simple program to merge gziped Apache log files. It
> uses zlib to open and read the gziped files.
>
> Mergelog's configure script appears to find that I have zlib installed but
> when I get to make zmergelog the link fails with undefined references to
> _gzopen _gzread and _gzclose.
>
> I would be really grateful if someone could give me a hint how to compile
> zmergelog under Cygwin.
>
> The output of the configure / make session and also cygcheck are attached.
>
> Many thanks in advance.

Mark,

This is definitely a bug in zmergelog's Makefile:

gcc -DHAVE_LIBZ=1 -DSTDC_HEADERS=1 -DHAVE_UNISTD_H=1 -DHAVE_MKTIME=1 -I.
    -I.  -g -O2 -lz -DVERSION=\"4.5\" -Wall -DUSE_ZLIB mergelog.c -o zmergelog
                ^^^
The -lz should go to the *end* of the compile line (at least, after the .c
file).  In other words, the correct gcc invocation is

gcc -DHAVE_LIBZ=1 -DSTDC_HEADERS=1 -DHAVE_UNISTD_H=1 -DHAVE_MKTIME=1 -I.
    -I.  -g -O2 -DVERSION=\"4.5\" -Wall -DUSE_ZLIB mergelog.c -lz -o zmergelog

I haven't seen the Makefile, but I have a feeling that this is because the
"zmergelog" target depends on a ".c" file instead of a ".o".  If you
changed the dependence to "mergelog.o", you might get the correct link
sequence.

Hope this helps,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019