How do I build a library with other libraries ?

How do I build a library with other libraries ?

Post by don » Fri, 09 Jun 2000 04:00:00



I have created an C++ class the encapsulates Oracle Pro*c.  In order
to get the class to compile I had to include many include files(.h),
object files(.o), and libraries (.a).

Now that the class is complete I would like to build a static library
so that others can use the class with need to link the Oracle
libraries or include the header files.

How do I do this?

I am coding on HPUX 11 using softbench and the aCC compilier.  The IDE
for softbench has an option to create a AC++ArchiveLibrary.  When I
use this option it seems to only add the object files resulting from
my source code to the archive.  I want to also include the Oracle
libraries (and any others used) so that a user will only need my
library.

The softbench version compilies fine giving me two object files (one
for each source file I have written).  The IDE the instructs ar to
build an archive.  After ar completes it runs ranlib.

Te is a check box for staic build but the archive is the same size
regardless of the position of this switch.  It is a very small
archive.

I determined which libaries and objects are linked when an eecutable
is create and added these to the ar command manually.  I then an
ranlib.  The archive is MUCH bigger now but I will still not owrk.

When I create a project that uses this archive I get an error -
unstaisfied symbols.  Is the order of the libraries on the ar command
line important?

Can anyone help me?

Thanks,
        Don

 
 
 

1. Building shared library which includes static libraries

SPARC Solaris 2.4 using 4.0.1 SPARC C++ compiler.

My application comprises of an executable and a number of shared libraries.
One of the shared libraries is an interface to Oracle using OCI calls. This
shared (database) library was built as follows:

    ld -G -dy -B symbolic -o my_shared_lib.so mod1.o mod2.o ... Oracle static
        libraries ... more libraries..

mod1.o, mod2.o ... were compiled with the -PIC option.

Now, when I run my application, I crash, with a bad opcode, whenever any
Oracle function is accessed from the mod1.o mod2.o ... modules. If I link the
Oracle static libraries with the executable, then everything is fine. However,
that is not what I want.

How can I get the above to work, or is it not possible? Any comments/advice
will be greatfully appreciated.

Thanks in advance,

Sanjay Agrawal
--

555 Twin Dolphin Drive #400      Voice: (415)594-8754
Redwood City, CA 94065           Fax:   (415)594-8645

2. Where are the fvwm2 insiders :-?

3. Building shared libraries that contain static libraries.

4. MPEG TV and sound device

5. Help with building shared libraries with dependencies on other shared libraries

6. Apache how setup cgi-bin access?

7. building a library file from other libraries?

8. small fix for wireless.c

9. Using libtool to build shared libraries that depend on static libraries

10. libraries libraries libraries

11. link compat=4 built library with a compat=5 build code

12. 2.4 x86 threads library (and others)

13. Mixing libraries compiled for profiling with others than not