[comp.unix.aix] building shared libraries

schorr@ead.dsa.com (Andrew J. Schorr) (10/12/90)

Concerning my previous post: I have now succeeded in getting
the program to find the shared library at run-time.  Unfortunately,
I now get the following error:

   Could not load program test_program 
   Could not load library libtest.0.1.a[shared_object.o]
   Error was: Exec format error

Presumably I am building the shared object incorrectly.  Can
anyone indicate the problem with the build procedure that I
outlined in my previous message?

Thanks for your help,
Andy

marc@arnor.uucp (10/12/90)

take off the -r option - it makes the library non-executable.
you may have to include other (shared) libraries like libc.a
in the build of your shared library.

Marc Auslander

rudy@chukran@austin.iinus.ibm.com (10/15/90)

> Concerning my previous post: I have now succeeded in getting
> the program to find the shared library at run-time.  Unfortunately,
> I now get the following error:
> 
>    Could not load program test_program 
>    Could not load library libtest.0.1.a[shared_object.o]
>    Error was: Exec format error
> 
It looks like the library was built correctly.  I suspect that problem is
in the test_program driver.   It should be linked using cc (or xlf or whatever)
like so:  cc -o test_program a.o b.o ..... -ltest.0.1
and presuming the library lives in /lib or /usr/lib
*********************************************************************
Rudy Chukran            |       EMAIL:            
IBM AIX Porting Center  | RSCS: CHUKRAN at AUSTIN 
11400 Burnet Rd.        | AWDnet: rudy@chukran.austin.ibm.com    
Internal ZIP 2830       | internet: chukran@austin.iinus1.ibm.com
Austin, Texas 78758     | Voice: 512-838-4674  Tieline: 678-4674
*********************************************************************

bengsig@oracle.nl (Bjorn Engsig) (10/23/90)

Article <3865@awdprime.UUCP> by rudy@chukran@austin.iinus.ibm.com () says:
|It looks like the library was built correctly.
No, it was not.  Please remember:

  Shared objects, in or out of archives, must be fully linked,
  i.e. no unresolved references are allowed.

Having a look at 'ar tv /lib/libc.a' will show only a few modules, one 
big one containing most of the functinality of libc.a.
-- 
Bjorn Engsig,         E-mail: bengsig@oracle.com, bengsig@oracle.nl
ORACLE Corporation    From IBM: auschs!ibmaus!cs.utexas.edu!uunet!oracle!bengsig

            "Stepping in others footsteps, doesn't bring you ahead"