AIX and shared libraries (missing vtable)
Joerg.Richter@pdv-FS.de
Joerg.Richter@pdv-FS.de
Tue Jun 3 08:52:00 GMT 2003
Hi,
I have problems building shared libraries on AIX.
$ g++ -v
Reading specs from
/tools/pkg/gcc/3.2.1/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.2.1/specs
Configured with: configure --prefix=/tools/pkg/gcc/3.2.1 --with-ld=/bin/ld
--with-as=/bin/as --enable-languages=c,c++
Thread model: aix
gcc version 3.2.1
I have following reduced testcase:
----- sh.h -----
struct A
{
virtual ~A();
};
----- sh.cc -----
#include "sh.h"
A::~A()
{}
----- main.cc -----
#include "sh.h"
int main()
{
A a;
return 0;
}
----- buildscript -----
CC="/tools/pkg/gcc/3.2.1/bin/g++"
$CC -c -o sh.o sh.cc
$CC -shared -Wl,-bexpall -o shr.o sh.o
ar cruv libsh.a shr.o
ranlib libsh.a
$CC -c -o main.o main.cc
$CC -o main main.o -L. -lsh
The last command has this error messages:
ld: 0711-317 ERROR: Undefined symbol: vtable for A
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more
information.
collect2: ld returned 8 exit status
The best is, that nm on the library says, that the vtable for A is in the
library
dump -Tv says that the symbol for the vtable is not in the export list of
the library. But -bexpall should have made this. I know that this is a
aix-ld option, but perhabs there is any option for g++ that i have overseen?
Can someone please help me figure out what goes wrong?
tia
Joerg Richter
More information about the Gcc-help
mailing list