Operating System - HP-UX
1748185 Members
4021 Online
108759 Solutions
New Discussion

Re: Building Log4cplus fails with "ld: Unsatisfied symbol virtual table of"

 
SOLVED
Go to solution
Pinkerik
Advisor

Building Log4cplus fails with "ld: Unsatisfied symbol virtual table of"

Hello,

I'm trying to compile log4cplus on HP-UX (https://code.launchpad.net/~log4cplus/log4cplus/1.1.x)

$ uname -a
HP-UX migs01a B.11.31 U ia64 0841004181 unlimited-user license

$ aCC --version
aCC: HP C/aC++ B3910B A.06.20 [May 13 2008]

 

Library is compiled just "fine", problem is when it tryes to compile some test program and link created library to it

ld: Unsatisfied symbol "virtual table of loggingserver::ClientThread" in file loggingserver.o
ld: Unsatisfied symbol "virtual table of loggingserver::ClientThread" in file loggingserver.o

 

I suspect that some warnings along library build might cause this error, but I'm not sure

 

Attaching build log from jenkins

 

And btw, on other platforms it compiles OK, even on some realy old AIX

 

Thank you

13 REPLIES 13
SoumitraC
Frequent Advisor

Re: Building Log4cplus fails with "ld: Unsatisfied symbol virtual table of"

Can you please pass on the pre-processed .i file for loggingserver.cxx using the command line options -E -.i as shown below:

 

aCC -DHAVE_CONFIG_H    -I../include -I../include  -DNDEBUG -D_GNU_SOURCE=1 -D_REENTRANT  -AA +DD64 -mt -D_REENTRANT  -E -.i loggingserver.cxx
Soumitra C
HP-UX Compilers
Pinkerik
Advisor

Re: Building Log4cplus fails with "ld: Unsatisfied symbol virtual table of"

Requested preprocessed file

 

Edit: actualy attaching the file (had to add extension to be able to attach it)

Dennis Handly
Acclaimed Contributor

Re: Building Log4cplus fails with "ld: Unsatisfied symbol virtual table of"

>ld: Unsatisfied symbol "virtual table of loggingserver::ClientThread"

 

This means that the source file that defines the first non pure, non inline virtual function in the class loggingserver::ClientThread was not linked into the application.

 

I.e. if you have virtual functions in a class, they MUST be defined.

You have virtual functions "run" and ~ClientThread.  I see the definition of both.  But not of start.

vzeman79
Visitor

Re: Building Log4cplus fails with "ld: Unsatisfied symbol virtual table of"


Dennis Handly wrote:

>ld: Unsatisfied symbol "virtual table of loggingserver::ClientThread"

 

This means that the source file that defines the first non pure, non inline virtual function in the class loggingserver::ClientThread was not linked into the application.

 

I.e. if you have virtual functions in a class, they MUST be defined.

You have virtual functions "run" and ~ClientThread.  I see the definition of both.  But not of start.


The loggingserver is a single source executable. The loggingserver::ClientThread class is wholy defined in the single source. The start() function is inherited from its base class AbstractThread. The same code works on multiple platforms with different compilers. It even works on HP-UX HPPA with aCC with and without +DD64. I have hard time believing that there is anything wrong with the source itself.

Pinkerik
Advisor

Re: Building Log4cplus fails with "ld: Unsatisfied symbol virtual table of"

But it is defined

in src/threads.cxx at line 411

which is then linked into library, which is then linked to that executable

Dennis Handly
Acclaimed Contributor
Solution

Re: Building Log4cplus fails with "ld: Unsatisfied symbol virtual table of"

>I have hard time believing that there is anything wrong with the source itself.

 

Looks like the compiler isn't handling __declspec properly?

Some of the construction subobject vtables aren't generated.

 

Compile with: ... "-D__declspec(X)="

vzeman79
Visitor

Re: Building Log4cplus fails with "ld: Unsatisfied symbol virtual table of"


Dennis Handly wrote:

>I have hard time believing that there is anything wrong with the source itself.

 

Looks like the compiler isn't handling __declspec properly?

Some of the construction subobject vtables aren't generated.

 

Compile with: ... "-D__declspec(X)="


Well, how would this help? The ClientThread class in question does not use any of it. It is declared and defined wholy in the same TU.

Dennis Handly
Acclaimed Contributor

Re: Building Log4cplus fails with "ld: Unsatisfied symbol virtual table of"

>how would this help? The ClientThread class in question does not use any of it. It is declared and defined wholly in the same TU.

 

Because it does?  ;-)

The construction vtables must reference vtables in the base classes.  And it needs to reference AbstractThread::start.

__declspec is confusing the compiler.

Pinkerik
Advisor

Re: Building Log4cplus fails with "ld: Unsatisfied symbol virtual table of"

syntax error near unexpected token `('

 

cant define it like that

should I remove exports?

 

Edit:

altering configure file to always set:

ac_cv_declspec=no

ac_cv__attribute__visibility=no

 

allowed me to finaly build it