Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: C newb - third party libs and using and testing suite Date: Fri, 09 Dec 2016 15:54:35 -0800 Organization: None to speak of Lines: 58 Message-ID: References: <1373812a-ef07-88fe-0ef1-84dff44fc96f@verizon.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="d3e5cee4cb06db8dd070f0b5a238435d"; logging-data="9985"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ydwOiGpsqWW3bD70cPqNS" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:LQNuKmPah+eVR4lKrwl0hTU8YL0= sha1:QWRqx+3L/QQm+1GRvpN0SH+vmTU= Xref: csiph.com comp.lang.c:98627 S390 writes: > On Mon, 05 Dec 2016 23:48:05 -0500, James Kuyper wrote: >>> Well, I guess for the forest for the trees I don't see the issue > >> Because -ljamlib takes "jamlib", and prefixes it with "lib", and then >> adds a ".a" suffix. Net result: it's looking for a file named >> libjamlib.a. Which is fine, if that's the name of the file you want to >> link to. Since the file you actually want to link to is jamlib.a, that's >> a bit of a problem. > > Like my quoted line above...I hate to belabor this point.. but this like > some other things in this is really starting to just frost my cake! ;) :) > > I am using this as an education to understand this... although its really > just starting to annoy me and reinforce why I remember why I never liked > C to start, and trust me I've got axes to grind on things like Python > with its idiotic spacing rules! > > UMMM... where did anything state that -l > > looks for /lib/.a I get from that thing I was reading it needs > appends .a, but where is this prepending of "lib" coming from???? It's documented in the GNU ld manual, among other places (ld is part of the "binutils" package). If you're using a linker other than the GNU binutils version, it should be documented in that linker's manual. Quoting https://sourceware.org/binutils/docs-2.27/ld/Options.html : -l namespec --library=namespec Add the archive or object file specified by namespec to the list of files to link. This option may be used any number of times. If namespec is of the form :filename, ld will search the library path for a file called filename, otherwise it will search the library path for a file called libnamespec.a. On systems which support shared libraries, ld may also search for files other than libnamespec.a. Specifically, on ELF and SunOS systems, ld will search a directory for a library called libnamespec.so before searching for one called libnamespec.a. (By convention, a .so extension indicates a shared library.) Note that this behavior does not apply to :filename, which always specifies a file called filename. Note that if you want to specify an exact file name, you can do so. The libFOO.a naming convention is a bit odd. No doubt there are historical reason for it, but I don't recall exactly what they are. [SNIP] -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"