[PATCH] Add libz to dumper.exe link [was Re: Re: speclib vs. -lc trouble.]

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Add libz to dumper.exe link [was Re: Re: speclib vs. -lc trouble.]

Dave Korn-6
[  Why don't I resend this to the proper list, eh?  ]

Dave Korn wrote:

> One slight catch: recent libbfds have grown a dependency on zlib, as they
> can natively handle compressed files.  This broke the build for dumper.exe,
> which uses libbfd.  The attached patch adds libz unconditionally, as it
> won't do any harm with older libbfds that don't need it, and because it's a
> bog-standard package that's easily available everywhere, so I didn't see
> the need to go to great lengths to only require it if the installed libbfd
> is sufficiently new to actually need it.  Anyone building winsup from
> source would probably have zlib-devel installed already anyway.

  Ok?

winsup/utils/ChangeLog

        * Makefile.in (libz):  New makefile variable.
        (build_dumper):  Test it was correctly set.
        (dumper.exe):  Use it.

    cheers,
      DaveK


? winsup/cygwin/include/stdint-h.diff
Index: winsup/utils/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/utils/Makefile.in,v
retrieving revision 1.82
diff -p -u -r1.82 Makefile.in
--- winsup/utils/Makefile.in 18 Mar 2009 04:19:05 -0000 1.82
+++ winsup/utils/Makefile.in 13 Apr 2009 15:07:21 -0000
@@ -81,14 +81,16 @@ ldh.exe: MINGW_LDFLAGS := -nostdlib -lke
 # Check for dumper's requirements and enable it if found.
 LIBICONV := @libiconv@
 libbfd   := ${shell $(CC) -B$(bupdir2)/bfd/ --print-file-name=libbfd.a}
+# Recent libbfd requires libz as it handles compressed files.
+libz     := ${shell $(CC) -B$(bupdir2)/zlib/ --print-file-name=libz.a}
 libintl  := ${shell $(CC) -B$(bupdir2)/intl/ --print-file-name=libintl.a}
-build_dumper := ${shell test -r $(libbfd) -a -r $(libintl) -a -n "$(LIBICONV)" && echo 1}
+build_dumper := ${shell test -r $(libbfd) -a -r $(libz) -a -r $(libintl) -a -n "$(LIBICONV)" && echo 1}
 ifdef build_dumper
 CYGWIN_BINS += dumper.exe
 dumper.o module_info.o parse_pe.o: CXXFLAGS += -I$(bupdir2)/bfd -I$(updir1)/include
 dumper.o parse_pe.o: dumper.h
 dumper.exe: module_info.o parse_pe.o
-dumper.exe: ALL_LDFLAGS += ${libbfd} ${libintl} -L$(bupdir1)/libiberty $(LIBICONV) -liberty
+dumper.exe: ALL_LDFLAGS += ${libbfd} ${libintl} ${libz} -L$(bupdir1)/libiberty $(LIBICONV) -liberty
 else
 all: warn_dumper
 endif

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Add libz to dumper.exe link [was Re: Re: speclib vs. -lc trouble.]

Christopher Faylor-8
On Mon, Apr 13, 2009 at 05:11:10PM +0100, Dave Korn wrote:

>  Ok?
>
>winsup/utils/ChangeLog
>
> * Makefile.in (libz):  New makefile variable.
> (build_dumper):  Test it was correctly set.
> (dumper.exe):  Use it.
>
>Index: winsup/utils/Makefile.in
>===================================================================
>RCS file: /cvs/src/src/winsup/utils/Makefile.in,v
>retrieving revision 1.82
>diff -p -u -r1.82 Makefile.in
>--- winsup/utils/Makefile.in 18 Mar 2009 04:19:05 -0000 1.82
>+++ winsup/utils/Makefile.in 13 Apr 2009 15:07:21 -0000
>@@ -81,14 +81,16 @@ ldh.exe: MINGW_LDFLAGS := -nostdlib -lke
> # Check for dumper's requirements and enable it if found.
> LIBICONV := @libiconv@
> libbfd   := ${shell $(CC) -B$(bupdir2)/bfd/ --print-file-name=libbfd.a}
>+# Recent libbfd requires libz as it handles compressed files.
>+libz     := ${shell $(CC) -B$(bupdir2)/zlib/ --print-file-name=libz.a}
> libintl  := ${shell $(CC) -B$(bupdir2)/intl/ --print-file-name=libintl.a}
>-build_dumper := ${shell test -r $(libbfd) -a -r $(libintl) -a -n "$(LIBICONV)" && echo 1}
>+build_dumper := ${shell test -r $(libbfd) -a -r $(libz) -a -r $(libintl) -a -n "$(LIBICONV)" && echo 1}
> ifdef build_dumper
> CYGWIN_BINS += dumper.exe
> dumper.o module_info.o parse_pe.o: CXXFLAGS += -I$(bupdir2)/bfd -I$(updir1)/include
> dumper.o parse_pe.o: dumper.h
> dumper.exe: module_info.o parse_pe.o
>-dumper.exe: ALL_LDFLAGS += ${libbfd} ${libintl} -L$(bupdir1)/libiberty $(LIBICONV) -liberty
>+dumper.exe: ALL_LDFLAGS += ${libbfd} ${libintl} ${libz} -L$(bupdir1)/libiberty $(LIBICONV) -liberty
> else
> all: warn_dumper
> endif

I think you can get by with just adding -lz to the ALL_LDFLAGS line and
removing the other stuff.  The tests for libintl and libbfd are supposed
to just detect if the appropriate directories are available.  There
isn't likely going to be a libz two levels above cygwin's source
directory so I don't see any reason to specfically check for it.

cgf
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Add libz to dumper.exe link [was Re: Re: speclib vs. -lc trouble.]

Dave Korn-6
Christopher Faylor wrote:

> I think you can get by with just adding -lz to the ALL_LDFLAGS line and
> removing the other stuff.  The tests for libintl and libbfd are supposed
> to just detect if the appropriate directories are available.  There
> isn't likely going to be a libz two levels above cygwin's source
> directory so I don't see any reason to specfically check for it.

  I thought that might happen in a combined tree build with /src and /gcc
together?

    cheers,
      DaveK

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Add libz to dumper.exe link [was Re: Re: speclib vs. -lc trouble.]

Christopher Faylor-8
On Mon, Apr 13, 2009 at 06:34:04PM +0100, Dave Korn wrote:
>Christopher Faylor wrote:
>>I think you can get by with just adding -lz to the ALL_LDFLAGS line and
>>removing the other stuff.  The tests for libintl and libbfd are
>>supposed to just detect if the appropriate directories are available.
>>There isn't likely going to be a libz two levels above cygwin's source
>>directory so I don't see any reason to specfically check for it.
>
>I thought that might happen in a combined tree build with /src and /gcc
>together?

That wasn't the intent of the current checks in the makefile.  They were
just to detect newer versions of libbfd.a or libintl.a.  Even libintl.a
isn't really necessary IMO.  It's not likely that is going to be under
active development and different from what should be installed in /lib.

cgf
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Add libz to dumper.exe link [was Re: Re: speclib vs. -lc trouble.]

Dave Korn-6
Christopher Faylor wrote:

> On Mon, Apr 13, 2009 at 06:34:04PM +0100, Dave Korn wrote:
>> Christopher Faylor wrote:
>>> I think you can get by with just adding -lz to the ALL_LDFLAGS line and
>>> removing the other stuff.  The tests for libintl and libbfd are
>>> supposed to just detect if the appropriate directories are available.
>>> There isn't likely going to be a libz two levels above cygwin's source
>>> directory so I don't see any reason to specfically check for it.
>> I thought that might happen in a combined tree build with /src and /gcc
>> together?
>
> That wasn't the intent of the current checks in the makefile.  They were
> just to detect newer versions of libbfd.a or libintl.a.  Even libintl.a
> isn't really necessary IMO.  It's not likely that is going to be under
> active development and different from what should be installed in /lib.
  Ah, OK, so just like this then:

winsup/utils/ChangeLog

        * Makefile.in (dumper.exe):  Add -lz to ALL_LDFLAGS.

  Tested by making clean then all in an existing
$objdir/i686-pc-cygwin/winsup/utils build directory.  Ok?

    cheers,
      DaveK

Index: winsup/utils/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/utils/Makefile.in,v
retrieving revision 1.82
diff -p -u -r1.82 Makefile.in
--- winsup/utils/Makefile.in 18 Mar 2009 04:19:05 -0000 1.82
+++ winsup/utils/Makefile.in 13 Apr 2009 19:17:16 -0000
@@ -88,7 +88,7 @@ CYGWIN_BINS += dumper.exe
 dumper.o module_info.o parse_pe.o: CXXFLAGS += -I$(bupdir2)/bfd -I$(updir1)/include
 dumper.o parse_pe.o: dumper.h
 dumper.exe: module_info.o parse_pe.o
-dumper.exe: ALL_LDFLAGS += ${libbfd} ${libintl} -L$(bupdir1)/libiberty $(LIBICONV) -liberty
+dumper.exe: ALL_LDFLAGS += ${libbfd} ${libintl} -L$(bupdir1)/libiberty $(LIBICONV) -liberty -lz
 else
 all: warn_dumper
 endif
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Add libz to dumper.exe link [was Re: Re: speclib vs. -lc trouble.]

Christopher Faylor-8
On Mon, Apr 13, 2009 at 08:31:13PM +0100, Dave Korn wrote:

>Christopher Faylor wrote:
>> On Mon, Apr 13, 2009 at 06:34:04PM +0100, Dave Korn wrote:
>>> Christopher Faylor wrote:
>>>> I think you can get by with just adding -lz to the ALL_LDFLAGS line and
>>>> removing the other stuff.  The tests for libintl and libbfd are
>>>> supposed to just detect if the appropriate directories are available.
>>>> There isn't likely going to be a libz two levels above cygwin's source
>>>> directory so I don't see any reason to specfically check for it.
>>> I thought that might happen in a combined tree build with /src and /gcc
>>> together?
>>
>> That wasn't the intent of the current checks in the makefile.  They were
>> just to detect newer versions of libbfd.a or libintl.a.  Even libintl.a
>> isn't really necessary IMO.  It's not likely that is going to be under
>> active development and different from what should be installed in /lib.
>
>  Ah, OK, so just like this then:

Yup.  Thanks.

Please apply.

cgf