public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: stuarts@icpdd.neca.nec.com.au (Stuart Summerville)
To: help-gcc@gnu.org
Subject: Need help building & integrating library into target program
Date: Fri, 10 Dec 1999 00:21:00 -0000	[thread overview]
Message-ID: <3850aaaa.25683279@news.mul.nec.com.au> (raw)

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.


________________________________________________________________________
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

WARNING: multiple messages have this Message-ID
From: stuarts@icpdd.neca.nec.com.au (Stuart Summerville)
To: help-gcc@gnu.org
Subject: Need help building & integrating library into target program
Date: Fri, 31 Dec 1999 22:24:00 -0000	[thread overview]
Message-ID: <3850aaaa.25683279@news.mul.nec.com.au> (raw)
Message-ID: <19991231222400.-GXU6fxTTcO9yxcPJ_bcXzO0PHMfJ0v59IKL7qlR_wo@z> (raw)

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.


________________________________________________________________________
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

             reply	other threads:[~1999-12-10  0:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-10  0:21 Stuart Summerville [this message]
1999-12-10 13:02 ` Arthur Gold
1999-12-12 14:14   ` Stuart Summerville
1999-12-12 15:56     ` Stuart Summerville
1999-12-31 22:24       ` Stuart Summerville
1999-12-31 22:24     ` Stuart Summerville
1999-12-31 22:24   ` Arthur Gold
1999-12-31 22:24 ` Stuart Summerville
1999-12-11  2:42 Stuart Summerville (Deimus)
1999-12-31 22:24 ` Stuart Summerville (Deimus)
1999-12-11 12:14 Stuart Summerville (NEC)
1999-12-31 22:24 ` Stuart Summerville (NEC)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3850aaaa.25683279@news.mul.nec.com.au \
    --to=stuarts@icpdd.neca.nec.com.au \
    --cc=help-gcc@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).