Problems with shared library (-fPIC) and tango
Lars Ivar Igesund
larsivar at igesund.net
Sat Jul 5 02:06:17 PDT 2008
Marius Muja wrote:
> 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
There is a ticket related to this somewhere. I believe I was told once that
part of the problem is that _all_ of the runtime can't be part of the
dynamic library, but that there needs to be a static portion too with at
least main. The above issue may have more to do with the effect of PIC on
the code though. It would be very good if it could be resolved.
--
Lars Ivar Igesund
blog at http://larsivi.net
DSource, #d.tango & #D: larsivi
Dancing the Tango
More information about the Digitalmars-d
mailing list