[oe] [meta-oe][PATCH] gtest: add -fPIC
Martin Kelly
martin at xevo.com
Tue Mar 28 19:33:29 UTC 2017
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.
Signed-off-by: Martin Kelly <mkelly at xevo.com>
---
meta-oe/recipes-test/gtest/gtest_1.8.0.bb | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/meta-oe/recipes-test/gtest/gtest_1.8.0.bb b/meta-oe/recipes-test/gtest/gtest_1.8.0.bb
index 483dc1f..9ba4ee4 100644
--- a/meta-oe/recipes-test/gtest/gtest_1.8.0.bb
+++ b/meta-oe/recipes-test/gtest/gtest_1.8.0.bb
@@ -19,6 +19,15 @@ S = "${WORKDIR}/googletest-release-${PV}"
inherit cmake
+# -fPIC is needed to prevent relocation errors when we compile with Yocto
+# security flags. See this issue for more details:
+#
+# https://github.com/google/googletest/issues/854
+#
+# If that issue is fixed, we can probably remove the manual -fPIC flags here.
+OECMAKE_C_FLAGS += " -fPIC"
+OECMAKE_CXX_FLAGS += " -fPIC"
+
ALLOW_EMPTY_${PN} = "1"
ALLOW_EMPTY_${PN}-dbg = "1"
--
2.1.4
More information about the Openembedded-devel
mailing list