Problems with shared library (-fPIC) and tango

Marius Muja mariusm at cs.ubc.ca
Fri Jul 4 17:54:36 PDT 2008


Hi,

I'm working on a project that needs to be compiled both as a standalone 
executable and (part of it) as a shared library. It's been working like 
that on 32 bit machines without any problems, but now I need to compile 
it on a 64 bit machine (to be able to access more the 3GB of memory).

When I tried to build the project on the 64 bit machine I was unable to 
build the shared library because of the following error:

libgphobos.a(ti_AC.o): relocation R_X86_64_32 against 
`_D17TypeInfo_C6Object6__initZ' can not be used when making a shared 
object; recompile with -fPIC

Since the error refers to an object in the standard library (I'm using 
tango) I tried to build the tango library using -fPIC. Doing that I 
didn't get the above error when I build the project, but it get the 
following assertion when I run it:

tango.core.Exception.AssertException at lifetime.d(514): Assertion failure

This makes me think that the tango library doesn't work properly when 
compiled with -fPIC.

Does anyone know a solution to this problem? Is it possible to build a D 
shared library on a 64 bit machine when using tango?


Marius



More information about the Digitalmars-d mailing list