[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft] Position independent code
From: |
Andreas Falkenhahn |
Subject: |
Re: [ft] Position independent code |
Date: |
Thu, 15 Mar 2018 21:34:54 +0100 |
On 13.03.2018 at 00:32 Werner LEMBERG wrote:
>>>> Suppose I want to compile freetype as position independent code
>>>> because I need to statically link it into a shared object. What's
>>>> the best way to do this? Should I simply run 'configure' like
>>>> this...
>>>> ./configure CFLAGS='-g -O2 -fPIC'
>>>> ...or is there a better way to do that?
>>> I think you don't need that. IIRC, libtool (which is used behind
>>> the scenes to generate the compiler calls in the makefile)
>>> automatically calls `-fPIC'.
>> Even when I say ./configure --enabled-shared=no?
> ??? You write that you want `to statically link it into a shared
> object'. So you actually have to create a shared object, no?
No, I want to *statically* link freetype into a shared object. If
I wanted to *dynamically* link it, I'd need a shared object. But
since I'm statically linking it, I don't need a shared object but
a link library created using ar and of course the individual object
files combined by ar need to use position independent code because
I want to link them into a shared object. Granted, it's a little
complicated :)
> However, libtool allows you to say
> ./configure --disable-shared --with-pic
> which should enable pic objects for static libraries (this is
> untested, though).
Right, that seems to do the job. I've noticed that this also
defines the PIC macro but I don't see this referenced anywhere
in the sources. Is it necessary at all?
--
Best regards,
Andreas Falkenhahn mailto:address@hidden