building modules in AIX

building modules in AIX

Post by S. Naraya » Fri, 02 Mar 2001 09:23:05



Hi,
I am trying to build load modules on AIX (4.3.3) and am having various
problems using both ld and makeC++SharedLib

  From the Makefile in $TCLDIST/unix/dltests, I tried the following
command to build the module.

$TCLDIST/unix/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512  \
    -bnoentry  -L$TCLDIST/unix -ltcl8.0 -ldl -lm -lbsd -lc -lC example.o\
     example_tcl.o -o example_tcl.so

where example.o is a C++ object file
       example_tcl.o is a object file generated using swig .. this
contains all the TCL wrappers and functions required to build the module
(http://www.swig.org)

I used xlC to build both the .o files.

when I try to load example_tcl.so in TCL, it dies with an "illegal
instruction" error.

If I replace the /bin/ld with makeC++SharedLib, it core dumps with a
segfault.

If somebody can give me the sequence of steps to make a load module for
TCL in AIX (from c/c++ code) I would really appreciate it.

Thank you,

- narayan

PS: I am having exactly the same set of problems building the modules
for perl

 
 
 

building modules in AIX

Post by jmvdval » Sat, 03 Mar 2001 20:09:27




...

Quote:> $TCLDIST/unix/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512  \
>     -bnoentry  -L$TCLDIST/unix -ltcl8.0 -ldl -lm -lbsd -lc -lC example.o\
>      example_tcl.o -o example_tcl.so
...
> when I try to load example_tcl.so in TCL, it dies with an "illegal
> instruction" error.

> If I replace the /bin/ld with makeC++SharedLib, it core dumps with a
> segfault.
...
> PS: I am having exactly the same set of problems building the modules
> for perl

Last monday I got similar symptoms with a DSO when it backreferenced a
function in the main program. It caused a SIGILL. Consequently I set up a
simple test which core dumped with a segmentation fault. I still haven't
got a clue as to the cause of the difference, but a solution was provided
by Jens-Uwe Mager when I posted my problem in this group. If your .so
backreferences the main program as well, it might solve your problem too.

This is the answer I got from Jens-Uwe:

Quote:>This works if you import the symbols in question using an import file.
>At the top of the import file put in the line "#! .", this denotes from
>the linker that the symbols from this import file come from the main part.

Apparently all symbols for the backreferenced functions have to be
explicitly imported into the .so for the loader to be able to resolve them.

It seems a bit awkward to me that a reference to a missing function keeps
the .so from loading, while not explicitly importing symbols results in
these signals.

Anyway, I hope this helps.

Ciao,
Jan Maarten

 
 
 

building modules in AIX

Post by Cameron Lai » Sat, 03 Mar 2001 21:20:55



                        .
                        .
                        .
Quote:>Last monday I got similar symptoms with a DSO when it backreferenced a
>function in the main program. It caused a SIGILL. Consequently I set up a

                        .
                        .
                        .
Quote:>Apparently all symbols for the backreferenced functions have to be
>explicitly imported into the .so for the loader to be able to resolve them.

>It seems a bit awkward to me that a reference to a missing function keeps
>the .so from loading, while not explicitly importing symbols results in
>these signals.

                        .
                        .
                        .
I just want to confirm that these symptoms
are common with various versions of AIX, and
they're the sort of thing that give it a bad
reputation among developers.  They can be
overcome, but it sure helps, in my experience,
to have a more experienced person agree that,
yes, this craziness is true.
--


Business:  http://www.Phaseit.net
Personal:  http://starbase.neosoft.com/~claird/home.html

 
 
 

building modules in AIX

Post by Jeff Hobb » Sun, 04 Mar 2001 07:39:29



> Hi,
> I am trying to build load modules on AIX (4.3.3) and am having various
> problems using both ld and makeC++SharedLib

>   From the Makefile in $TCLDIST/unix/dltests, I tried the following
> command to build the module.

> $TCLDIST/unix/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512  \
>     -bnoentry  -L$TCLDIST/unix -ltcl8.0 -ldl -lm -lbsd -lc -lC example.o\
>      example_tcl.o -o example_tcl.so

> where example.o is a C++ object file
>        example_tcl.o is a object file generated using swig .. this
> contains all the TCL wrappers and functions required to build the module
> (http://www.swig.org)

> I used xlC to build both the .o files.

> when I try to load example_tcl.so in TCL, it dies with an "illegal
> instruction" error.

> If I replace the /bin/ld with makeC++SharedLib, it core dumps with a
> segfault.

> If somebody can give me the sequence of steps to make a load module for
> TCL in AIX (from c/c++ code) I would really appreciate it.

mmmmm, dlls on AIX...  Well, it works much better with 8.1+ (with
stubs), but it was possible with 8.0.  I've built tktable as a dll
on AIX under both 8.0 and 8.2+.  You can see what sort of config
and makefile setup I use at:
        http://tktable.sourceforge.net/

Unfortunately, I don't currently have access to an AIX machine, so
I can't test it again.

--
  Jeff Hobbs                     The Tcl Guy
  Senior Developer               http://www.ActiveState.com/

 
 
 

building modules in AIX

Post by S. Naraya » Fri, 09 Mar 2001 05:10:49


        like I finally found a solution. It turns out that I was running tcl (and perl) built on AIX 4.1
on a 4.3.3 machine. Once I got tcl & perl rebuilt on 4.3.3, I was able to build the dlls
and load them using the following:

$ LIBPATH = -L/usr/ibmcxx/lib -L/opt/perl/lib/5.00502/aix/CORE -L/opt/tcl/lib
$ makeC++SharedLib $LIBPATH -p 0 -lbsd -lC -ltcl8.0 -ldl -lm example.o example_tcl.o -o example_tcl.so
$ makeC++SharedLib $LIBPATH -p 0 -lbsd -lC -lperl -ldl -lm example.o example_perl.o -o example_perl.so

I did not need to build the export file or otherwise do anything special.
To load and run the dll in perl (which contained C++ code), I had to build a new binary following the
instructions in Dean Roehrich's cookbook. (This was not needed if the code did not use the iostream library)

$ h2xs -AXPN CPLUS; cd CPLUS; perl Makefile.PL LINKTYPE=static CC=xlC LD=makeC++SharedLib; make

Thanks for the help,

- narayan


>> Hi,
>> I am trying to build load modules on AIX (4.3.3) and am having various
>> problems using both ld and makeC++SharedLib

>>   From the Makefile in $TCLDIST/unix/dltests, I tried the following
>> command to build the module.

>> $TCLDIST/unix/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512  \
>>     -bnoentry  -L$TCLDIST/unix -ltcl8.0 -ldl -lm -lbsd -lc -lC example.o\
>>      example_tcl.o -o example_tcl.so

>> where example.o is a C++ object file
>>        example_tcl.o is a object file generated using swig .. this
>> contains all the TCL wrappers and functions required to build the module

 
 
 

1. PAM module build for AIX 4.3.3

Hello,

I am trying to build the pam_ldap library for AIX 4.3.3.  It seems to
want to see the /usr/include/security/pam_modules.h file on the
system.  This file is part of the bos.adt.include fileset for AIX
5.1.3 but it doesn't see to be part of the 4.3.3 bos.adt.include
fileset.  Any suggestions of how I can proceed?  Has anyone tried to
do this before?

Thanks very much,

Ben Piela

2. Looking for a Current Hardware Compatibility list...

3. What's 'side effects' of Ksh built-ins?

4. Maximum Subsequence Problem and Bentley

5. shell built ins

6. config.data for INN1.4-SEC on Solaris 2.4

7. Subject: Ksh93 question: special built-ins: why are they special?

8. DRS6000 / dns

9. Compare file modification date using tcsh built-ins

10. Shells and built-ins

11. Module deps when building stacked module outside of kernel source tree

12. Can't Build Kernel Module on V5.1A - no Module created

13. Netscape plug-ins on AIX 4