[oe] [meta-oe][PATCH] gtest: add -fPIC

Martin Kelly mkelly at xevo.com
Tue Mar 28 21:17:43 UTC 2017


On 03/28/2017 02:05 PM, Andre McCurdy wrote:
> On Tue, Mar 28, 2017 at 1:55 PM, Martin Kelly <mkelly at xevo.com> wrote:
>> On 03/28/2017 01:47 PM, Khem Raj wrote:
>>> On 3/28/17 1:37 PM, Andre McCurdy wrote:
>>>> On Tue, Mar 28, 2017 at 12:33 PM, Martin Kelly <martin at xevo.com> wrote:
>>>>>
>>>>> From: Martin Kelly <mkelly at xevo.com>
>>>>>
>>>>> I tried turning on the Yocto security flags and hit a compilation
>>>>> error due to gtest not compiling. Adding -fPIC fixes the issue.
>>>>
>>>>
>>>> Since gtest only creates static libraries, compiling everything with
>>>> -fPIC might not be the correct solution.
>>>
>>> it still is going to be linked with a PIE binary then it should be PIC
>
> Wouldn't compiling all gtest objects with -fpie work in that case too?
>

I am no expert in this, but from the gcc manpage, it looks like -fPIE 
will work only when linking with executables, while -fPIC will work in 
either case. Thus I suppose it depends on whether we want to support 
linking gtest against a library.



More information about the Openembedded-devel mailing list