Need help building & integrating library into target program
Arthur Gold
agold@bga.com
Fri Dec 10 13:02:00 GMT 1999
Stuart Summerville wrote:
>
> Hi all,
>
> I'm trying to build a custom library that is then integrated into other target
> programs. I'm having problems linking the library into the final executable.
>
> Here's the steps I've taken:
> 1) Compile to object file (using -c switch on gcc) each of the source files for
> the library.
> 2) Archive the object files together in mylib.a. This is using 'ar rv mylib.a
> *.o'.
> 3) Compile another source file (new_app.c) ready to use the library. Same
> compilation as before, to an object file.
> 4) Link new_app.o with mylib.a, using gcc. I've tried passing in the -static
> switch also. The output is new_app, which should also contains any required
> functions from mylib.
>
> All goes well until runtime, when ld.so.1 informs me that it couldn't open
> mylib.o (as opposed to mylib.a) & that new_app has been killed.
>
> Why is this happening? Where is it getting mylib.o from?
>
> Another makefile I have aquired, that I've based my makefile on, takes one extra
> step after creating mylib.a. It runs the following:
>
> prompt> : mylib.a
>
> This seems to fuction properly,and does change the file, somehow. The variable
> used to hold this ':' keyword is called $(RANLIB) which suggests its generating
> an index into mylib.a, but I'm not sure how this mapping (of ':' to ranlib or
> 'ar -s') is done, unless its prodding the make program to do so, somehow.
>
> So far as I can tell, my makefile is manipulating the library file just as the
> sample one is.
>
> If necessary, can you suggest some methods of analysing mylib.a to look for
> problems?
>
> Thanks for any help,
>
> sTu.
It would be best to show us how you're trying to link against the
library; knowing your platform would also be helpful.
--ag
>
> ________________________________________________________________________
> Stuart Summerville NEC Australia Pty. Ltd.
> ph: (+61 3) 9264-3090 Integrated Comm Products (R&D)
> fax:(+61 3) 9264-3841 649-655 Springvale Road Mulgrave
> stuarts@<nospam>icpdd.neca.nec.com.au VIC 3170, AUSTRALIA
--
Artie Gold, Austin, TX (finger the cs.utexas.edu account for more info)
mailto:agold@bga.com or mailto:agold@cs.utexas.edu
--
A: Look for a lawyer who speaks Aramaic...about trademark infringement.
More information about the Gcc-help
mailing list