Date: Sun, 18 Jun 1995 23:10:25 +0900 (JST) From: "Stephen J. Turnbull" To: macgyver AT infinet DOT com Cc: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Re: lib that's linked? On Sun, 18 Jun 1995, Eli Zaretskii wrote: > macgyver AT infinet DOT com wrote: > > > Is there a way to find out what library is linked to the executable? > > Specifically, I'm trying to find out when libgpp is linked into the > > program. Because I'm trying to deal with GPL/LGPL. > > AFAIK, not directly. The easiest way to know is to try linking > without -lgpp on the command line and see if ld complains about > unresolved externals. This assumes, of course, that *you* are > the person who does the link. My understanding of the matter is that for exactly the reason that libgpp and libgpl have implications for the licensing of the executable, they are never implicitly linked. (This implicit in what Eli wrote, I thought it was worth making it explicit.) Linking any object compiled with bison into your executable puts the whole thing under GPL (not LGPL); I don't think libbison itself has any implications, but you wouldn't use it if you weren't using bison itself so that's just pedantic. I have not checked in about a year, but then flex did *not* impose restrictions similar to bison's, but things may have changed. Those are the only times code written entirely by you will be affected by the GPL AFAIK. I'm not sure what you mean by "when libgpp is linked"; if you want an object by object listing of which of your modules call GPL/LGPL functions, you could do the following: (1) Use nm to list the public symbols in libgpp and libgpl (and possibly libbison); use grep or something to compile a list of public symbols from bison.simple and bison.hairy. Note that variable references will also result in links to GPL'ed code; I don't know how Stallman feels about that, but I would guess he would take a strict approach (otherwise you could make a jump table and linking with libgpp etc would have no implications). This should cover all of your exposure. nm is a standard binary utility provided with DJGPP. John Davis's JED editor package provides a usable implementation of grep; it's not Posix-compliant, but it's very easy to get used to. Aaron Ucko's Perl works well for me; I would guess that it's the tool of choice for this kind of exercise. URLs are from memory (sorry, I'm on a slow link and it's a pain to use Mosaic): JED: file://space.mit.edu/davis/pub/jed or maybe file://space.mit.edu/pub/jed Perl (5.0): file://turnbull.sk.tsukuba.ac.jp/pub/djgpp/packages (Hangs head in shame; no, don't know exactly where stuff is on my own machine these days....) There are also some awks around. (2) Write a Perl script or rgrep command to search directories (recursively) for L?GPL references in source code. (3) Bundle the lot up and make it available somewhere (file://turnbull.sk.tsukuba.ac.jp/incoming/ is OK; notify me by mail, please). :-) -- Steve