diff mbox

gtest: fix usage on ARM platforms

Message ID 1492602712-28828-1-git-send-email-casantos@datacom.ind.br
State Accepted
Headers show

Commit Message

Carlos Santos April 19, 2017, 11:51 a.m. UTC
Ensure that GTest is compiled with -fPIC to allow linking the static
libraries with dynamically linked programs. This is not a requirement
for most architectures but is mandatory for ARM.

Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
---
 package/gtest/gtest.mk | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Thomas Petazzoni April 19, 2017, 12:33 p.m. UTC | #1
Hello,

On Wed, 19 Apr 2017 08:51:52 -0300, Carlos Santos wrote:
> Ensure that GTest is compiled with -fPIC to allow linking the static
> libraries with dynamically linked programs. This is not a requirement
> for most architectures but is mandatory for ARM.
> 
> Signed-off-by: Carlos Santos <casantos@datacom.ind.br>

Is this fixing an autobuilder issue? If so, the reference to the
autobuilder failure should be included in the commit log.

Thanks!

Thomas
Carlos Santos April 19, 2017, 1:20 p.m. UTC | #2
> From: "Thomas Petazzoni" <thomas.petazzoni@free-electrons.com>
> To: "Carlos Santos" <casantos@datacom.ind.br>
> Cc: buildroot@buildroot.org
> Sent: Wednesday, April 19, 2017 9:33:31 AM
> Subject: Re: [Buildroot] [PATCH] gtest: fix usage on ARM platforms

> Hello,
> 
> On Wed, 19 Apr 2017 08:51:52 -0300, Carlos Santos wrote:
>> Ensure that GTest is compiled with -fPIC to allow linking the static
>> libraries with dynamically linked programs. This is not a requirement
>> for most architectures but is mandatory for ARM.
>> 
>> Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
> 
> Is this fixing an autobuilder issue? If so, the reference to the
> autobuilder failure should be included in the commit log.

It was observed during a local build of one of our products which
has an ARM Cortex-A9 processor.
Thomas Petazzoni April 20, 2017, 8:32 p.m. UTC | #3
Hello,

On Wed, 19 Apr 2017 08:51:52 -0300, Carlos Santos wrote:
> Ensure that GTest is compiled with -fPIC to allow linking the static
> libraries with dynamically linked programs. This is not a requirement
> for most architectures but is mandatory for ARM.
> 
> Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
> ---
>  package/gtest/gtest.mk | 7 +++++++
>  1 file changed, 7 insertions(+)

Applied to master, thanks.

Thomas
diff mbox

Patch

diff --git a/package/gtest/gtest.mk b/package/gtest/gtest.mk
index 329179d..dc43597 100644
--- a/package/gtest/gtest.mk
+++ b/package/gtest/gtest.mk
@@ -37,6 +37,13 @@  HOST_GTEST_GMOCK_PYTHONPATH = \
 # the gtest sources.
 GTEST_CONF_OPTS = -DBUILD_SHARED_LIBS=OFF
 
+# Ensure that GTest is compiled with -fPIC to allow linking the static
+# libraries with dynamically linked programs. This is not a requirement
+# for most architectures but is mandatory for ARM.
+ifeq ($(BR2_STATIC_LIBS),)
+GTEST_CONF_OPTS += -DCMAKE_POSITION_INDEPENDENT_CODE=ON
+endif
+
 GTEST_CONF_OPTS += -DBUILD_GTEST=ON
 
 ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)