From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arthur Gold To: help-gcc@gnu.org Subject: Re: Need help building & integrating library into target program Date: Fri, 10 Dec 1999 13:02:00 -0000 Message-id: <385169EA.2D7A2565@bga.com> References: <3850aaaa.25683279@news.mul.nec.com.au> X-SW-Source: 1999-12/msg00156.html 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@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. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arthur Gold To: help-gcc@gnu.org Subject: Re: Need help building & integrating library into target program Date: Fri, 31 Dec 1999 22:24:00 -0000 Message-ID: <385169EA.2D7A2565@bga.com> References: <3850aaaa.25683279@news.mul.nec.com.au> X-SW-Source: 1999-12n/msg00156.html Message-ID: <19991231222400.GJgkNAvW94AWYG8Wr9M2X05rXclOh8uwa--JJs9NqdU@z> 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@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.