#3756: Missing -lz option in testsuite
--------------------------------+-------------------------------------------
  Reporter:  daniel.is.fischer  |           Type:  bug         
    Status:  new                |       Priority:  normal      
 Milestone:  6.12.2             |      Component:  Build System
   Version:  6.12.1             |       Keywords:              
Difficulty:                     |             Os:  Linux       
  Testcase:                     |   Architecture:  x86         
   Failure:  Other              |  
--------------------------------+-------------------------------------------

Comment(by daniel.is.fischer):

 Ah, now I (begin to) understand. I had no idea it was connected to -debug
 per se, I thought it was something specific to the tests. Indeed, trying
 to compile something with -debug gives
 {{{
 Linking Trivial ...
 /usr/lib/gcc/i586-suse-linux/4.3/../../../libbfd.a(compress.o):
          In function `bfd_uncompress_section_contents':

 /usr/src/packages/BUILD/binutils-2.19/build-
 dir/bfd/../../bfd/compress.c:96:0:
      undefined reference to `inflateInit_'

 /usr/src/packages/BUILD/binutils-2.19/build-
 dir/bfd/../../bfd/compress.c:103:0:
      undefined reference to `inflate'

 /usr/src/packages/BUILD/binutils-2.19/build-
 dir/bfd/../../bfd/compress.c:106:0:
      undefined reference to `inflateReset'

 /usr/src/packages/BUILD/binutils-2.19/build-
 dir/bfd/../../bfd/compress.c:108:0:
      undefined reference to `inflateEnd'
 collect2: ld returned 1 exit status
 }}}
 unless I pass -optl-lz on the command line (it names libbfd.a even with
 -dynamic, is that necessarily a bug?).

 Okay, I don't know whether that'll help diagnose the problem, but looking
 a bit further,
 {{{
 $ nm /usr/lib/libbfd.a | grep -B 8 inflate
 compress.o:
 00000000 r .LC0
 00000005 r .LC1
          U _GLOBAL_OFFSET_TABLE_
 00000000 T __i686.get_pc_thunk.bx
          U bfd_malloc
 00000000 T bfd_uncompress_section_contents
          U free
          U inflate
          U inflateEnd
          U inflateInit_
          U inflateReset
 }}}
 and with a newly built binutils-2.20,
 {{{
 $ nm bfd/libbfd.a | grep -B 4 inflate
 compress.o:
          U bfd_malloc
 00000000 T bfd_uncompress_section_contents
          U free
          U inflate
          U inflateEnd
          U inflateInit_
          U inflateReset
 }}}
 and in bfd/configure, we find
 {{{
 # Link in zlib if we can.  This allows us to read compressed debug
 sections.
 # This is used only by compress.c.
 }}}
 So it seems binutils inserts the dependency on libz if it finds one during
 configure. It's quite adamant about it, I didn't manage to turn it off by
 configure options, only by editing the code.

 Makes me wonder, how come your libbfd.a doesn't mention inflate* ? What
 does nm libbfd.a | grep -A 4 compress.o return?

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3756#comment:15>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to