Subject: libbfd.a problems???
To: None <current-users@NetBSD.ORG>
From: Brian C. Grayson <bgrayson@ece.utexas.edu>
List: current-users
Date: 10/29/1997 11:40:49
  If I do a `make clean' in /usr/src/gnu/lib/bfd, followed by a
`make', I get:
...
building standard bfd library
/usr/local/bin/nm: /usr/src/gnu/lib/bfd/../../dist/bfd/libbfd.c:
File format not recognized
ranlib libbfd.a
ranlib: libbfd.a is not an archive
*** Error code 1

Stop.
Exit 1

  Is my system messed up, or does everyone else that does `make
clean;make' in the appropriate directory also see this?  I just
finished two sup -o's just to make sure everything was completely
current.  I haven't noticed anyone else complaining about this,
though....

  A quick query-pr turned up nothing matching libbfd.

  (The remainder of this message discusses the reasons and a fix).

  This is due to the Makefile noticing a file called libbfd.c in
the ../../dist/bfd tree, and deciding that libbfd.a, in addition
to all of the specified .o files, should also include libbfd.c,
so ranlib/nm tries to add a .c file to the archive, which
obviously fails.  (My explanation might be slightly wrong, but I
believe that's the overall effect).

  There is a line in the Makefile specifically added to eliminate
this behavior -- the .NOPATH line that intends that libbfd.a et al
should not have .PATH searches done for sources for them.
However, from the make man page, it is not clear that this is the
actual meaning of the .NOPATH bogus target -- from the man page,
it makes it sound like .NOPATH libbfd.a says, "don't look for
libbfd.a in another directory, use the local one or create it if
needed."  .NOPATH libbfd.c should _theoretically_ do the right
thing, but that results in make saying 'I don't know how to make
libbfd.c', because it doesn't exist in the current directory.
.NOPATH $(dist)/bfd/libbfd.c doesn't do the trick either.

  One fix that seems easy is to rename libbfd.c in the
appropriate directory to libbfd_misc.c, or perhaps to just
misc.c, since it is used to build misc.o.  This also involves
changing the rules for building misc (or changing its name to
libbfd_misc), and then the comments about libbfd.c causing
problems and the not-working .NOPATH command can be removed.

  If I don't hear from anyone (i.e., ``your /usr/src tree must be
corrupt in a major way -- it works fine for me!'') within a few
hours or days, I'll submit a PR.

  Brian
-- 
Brian Grayson (bgrayson@ece.utexas.edu)
Graduate Student, Electrical and Computer Engineering
The University of Texas at Austin
Office:  ENS 406       (512) 471-8011
Finger bgrayson@orac.ece.utexas.edu for PGP key.